summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-09-06 02:47:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-09-06 02:48:56 +0000
commit200678b8fb0f6ac37eedba69ba15d5ab46993e59 (patch)
tree270a5da7090dd0ce36424513834087f27d3b2c5e
parentReleasing progress-linux version 6.0.2+20181021git007b08d01eff070+ds+~0.3.1+~... (diff)
downloadacorn-200678b8fb0f6ac37eedba69ba15d5ab46993e59.tar.xz
acorn-200678b8fb0f6ac37eedba69ba15d5ab46993e59.zip
Merging upstream version 6.1.1+ds+~0.3.1+~4.0.0+~1.0.0+~5.0.1+ds+~1.6.2+ds.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r--.gitignore3
-rw-r--r--.travis.yml4
-rw-r--r--AUTHORS4
-rw-r--r--README.md5
-rw-r--r--acorn-loose/README.md2
l---------acorn-loose/node_modules/acorn1
-rw-r--r--acorn-loose/rollup.config.js2
-rw-r--r--acorn-walk/README.md2
-rw-r--r--acorn-walk/package.json2
-rw-r--r--acorn/CHANGELOG.md76
-rw-r--r--acorn/README.md2
-rw-r--r--acorn/dist/acorn.d.ts3
-rw-r--r--acorn/package.json2
-rw-r--r--acorn/src/expression.js125
-rw-r--r--acorn/src/index.js2
-rw-r--r--acorn/src/lval.js4
-rw-r--r--acorn/src/options.js2
-rw-r--r--acorn/src/parseutil.js9
-rw-r--r--acorn/src/regexp.js10
-rw-r--r--acorn/src/scope.js38
-rw-r--r--acorn/src/state.js18
-rw-r--r--acorn/src/statement.js78
-rw-r--r--acorn/src/tokencontext.js3
-rw-r--r--acorn/src/tokenize.js5
-rw-r--r--acorn/src/unicode-property-data.js499
-rw-r--r--acorn/src/util.js4
-rw-r--r--acorn/src/whitespace.js2
-rw-r--r--bin/run_test262.js26
-rw-r--r--bin/test262.whitelist276
-rw-r--r--module-node-acorn-import-meta/.gitignore1
-rw-r--r--module-node-acorn-jsx/test/tests-jsx.js3960
-rw-r--r--node-acorn-bigint/.eslintrc.json (renamed from module-node-acorn-bigint/.eslintrc.json)0
-rw-r--r--node-acorn-bigint/.gitignore (renamed from module-node-acorn-bigint/.gitignore)0
-rw-r--r--node-acorn-bigint/CHANGELOG.md (renamed from module-node-acorn-bigint/CHANGELOG.md)0
-rw-r--r--node-acorn-bigint/LICENSE (renamed from module-node-acorn-bigint/LICENSE)0
-rw-r--r--node-acorn-bigint/README.md (renamed from module-node-acorn-bigint/README.md)0
-rw-r--r--node-acorn-bigint/index.js (renamed from module-node-acorn-bigint/index.js)0
-rw-r--r--node-acorn-bigint/package.json (renamed from module-node-acorn-bigint/package.json)0
-rw-r--r--node-acorn-bigint/run_test262.js (renamed from module-node-acorn-bigint/run_test262.js)0
-rw-r--r--node-acorn-bigint/test/.eslintrc.json (renamed from module-node-acorn-bigint/test/.eslintrc.json)0
-rw-r--r--node-acorn-bigint/test/test.js (renamed from module-node-acorn-bigint/test/test.js)0
-rw-r--r--node-acorn-dynamic-import/.babelrc (renamed from module-node-acorn-dynamic-import/.babelrc)0
-rw-r--r--node-acorn-dynamic-import/.eslintignore (renamed from module-node-acorn-dynamic-import/.eslintignore)0
-rw-r--r--node-acorn-dynamic-import/.eslintrc (renamed from module-node-acorn-dynamic-import/.eslintrc)0
-rwxr-xr-xnode-acorn-dynamic-import/.gitignore (renamed from module-node-acorn-dynamic-import/.gitignore)0
-rwxr-xr-xnode-acorn-dynamic-import/.npmignore (renamed from module-node-acorn-dynamic-import/.npmignore)0
-rwxr-xr-xnode-acorn-dynamic-import/.travis.yml (renamed from module-node-acorn-dynamic-import/.travis.yml)0
-rw-r--r--node-acorn-dynamic-import/CHANGELOG.md (renamed from module-node-acorn-dynamic-import/CHANGELOG.md)0
-rwxr-xr-xnode-acorn-dynamic-import/LICENSE (renamed from module-node-acorn-dynamic-import/LICENSE)0
-rwxr-xr-xnode-acorn-dynamic-import/README.md (renamed from module-node-acorn-dynamic-import/README.md)0
-rw-r--r--node-acorn-dynamic-import/package-lock.json (renamed from module-node-acorn-dynamic-import/package-lock.json)0
-rw-r--r--node-acorn-dynamic-import/package.json (renamed from module-node-acorn-dynamic-import/package.json)0
-rw-r--r--node-acorn-dynamic-import/src/index.js (renamed from module-node-acorn-dynamic-import/src/index.js)0
-rw-r--r--node-acorn-dynamic-import/src/walk.js (renamed from module-node-acorn-dynamic-import/src/walk.js)0
-rw-r--r--node-acorn-dynamic-import/test/.eslintrc (renamed from module-node-acorn-dynamic-import/test/.eslintrc)0
-rw-r--r--node-acorn-dynamic-import/test/fixtures/direct-calls-only/actual.js (renamed from module-node-acorn-dynamic-import/test/fixtures/direct-calls-only/actual.js)0
-rw-r--r--node-acorn-dynamic-import/test/fixtures/direct-calls-only/expected.json (renamed from module-node-acorn-dynamic-import/test/fixtures/direct-calls-only/expected.json)0
-rw-r--r--node-acorn-dynamic-import/test/fixtures/import-statement/actual.js (renamed from module-node-acorn-dynamic-import/test/fixtures/import-statement/actual.js)0
-rw-r--r--node-acorn-dynamic-import/test/fixtures/import-statement/expected.json (renamed from module-node-acorn-dynamic-import/test/fixtures/import-statement/expected.json)0
-rw-r--r--node-acorn-dynamic-import/test/fixtures/inside-function/actual.js (renamed from module-node-acorn-dynamic-import/test/fixtures/inside-function/actual.js)0
-rw-r--r--node-acorn-dynamic-import/test/fixtures/inside-function/expected.json (renamed from module-node-acorn-dynamic-import/test/fixtures/inside-function/expected.json)0
-rw-r--r--node-acorn-dynamic-import/test/fixtures/return-value/actual.js (renamed from module-node-acorn-dynamic-import/test/fixtures/return-value/actual.js)0
-rw-r--r--node-acorn-dynamic-import/test/fixtures/return-value/expected.json (renamed from module-node-acorn-dynamic-import/test/fixtures/return-value/expected.json)0
-rw-r--r--node-acorn-dynamic-import/test/fixtures/top-level/actual.js (renamed from module-node-acorn-dynamic-import/test/fixtures/top-level/actual.js)0
-rw-r--r--node-acorn-dynamic-import/test/fixtures/top-level/expected.json (renamed from module-node-acorn-dynamic-import/test/fixtures/top-level/expected.json)0
-rw-r--r--node-acorn-dynamic-import/test/fixtures/variable-argument/actual.js (renamed from module-node-acorn-dynamic-import/test/fixtures/variable-argument/actual.js)0
-rw-r--r--node-acorn-dynamic-import/test/fixtures/variable-argument/expected.json (renamed from module-node-acorn-dynamic-import/test/fixtures/variable-argument/expected.json)0
-rw-r--r--node-acorn-dynamic-import/test/fixtures/yield-import/actual.js (renamed from module-node-acorn-dynamic-import/test/fixtures/yield-import/actual.js)0
-rw-r--r--node-acorn-dynamic-import/test/fixtures/yield-import/expected.json (renamed from module-node-acorn-dynamic-import/test/fixtures/yield-import/expected.json)0
-rw-r--r--node-acorn-dynamic-import/test/index.js (renamed from module-node-acorn-dynamic-import/test/index.js)0
-rw-r--r--node-acorn-dynamic-import/test/mocha.opts (renamed from module-node-acorn-dynamic-import/test/mocha.opts)0
-rw-r--r--node-acorn-dynamic-import/test/testPlugin.js (renamed from module-node-acorn-dynamic-import/test/testPlugin.js)0
-rw-r--r--node-acorn-import-meta/.eslintrc.json (renamed from module-node-acorn-import-meta/.eslintrc.json)0
-rw-r--r--node-acorn-import-meta/.gitignore2
-rw-r--r--node-acorn-import-meta/CHANGELOG.md (renamed from module-node-acorn-import-meta/CHANGELOG.md)4
-rw-r--r--node-acorn-import-meta/LICENSE (renamed from module-node-acorn-import-meta/LICENSE)0
-rw-r--r--node-acorn-import-meta/README.md (renamed from module-node-acorn-import-meta/README.md)0
-rw-r--r--node-acorn-import-meta/index.js (renamed from module-node-acorn-import-meta/index.js)3
-rw-r--r--node-acorn-import-meta/package.json (renamed from module-node-acorn-import-meta/package.json)6
-rw-r--r--node-acorn-import-meta/run_test262.js (renamed from module-node-acorn-import-meta/run_test262.js)10
-rw-r--r--node-acorn-import-meta/test/.eslintrc.json (renamed from module-node-acorn-import-meta/test/.eslintrc.json)0
-rw-r--r--node-acorn-import-meta/test/test.js (renamed from module-node-acorn-import-meta/test/test.js)1
-rw-r--r--node-acorn-jsx/.editorconfig (renamed from module-node-acorn-jsx/.editorconfig)0
-rw-r--r--node-acorn-jsx/.gitattributes (renamed from module-node-acorn-jsx/.gitattributes)0
-rw-r--r--node-acorn-jsx/.gitignore (renamed from module-node-acorn-jsx/.gitignore)0
-rw-r--r--node-acorn-jsx/.npmignore (renamed from module-node-acorn-jsx/.npmignore)0
-rw-r--r--node-acorn-jsx/.travis.yml (renamed from module-node-acorn-jsx/.travis.yml)1
-rw-r--r--node-acorn-jsx/LICENSE (renamed from module-node-acorn-jsx/LICENSE)0
-rw-r--r--node-acorn-jsx/README.md (renamed from module-node-acorn-jsx/README.md)0
-rw-r--r--node-acorn-jsx/index.js (renamed from module-node-acorn-jsx/index.js)22
-rw-r--r--node-acorn-jsx/package.json (renamed from module-node-acorn-jsx/package.json)2
-rw-r--r--node-acorn-jsx/test/driver.js (renamed from module-node-acorn-jsx/test/driver.js)0
-rw-r--r--node-acorn-jsx/test/run.js (renamed from module-node-acorn-jsx/test/run.js)0
-rw-r--r--node-acorn-jsx/xhtml.js (renamed from module-node-acorn-jsx/xhtml.js)0
-rw-r--r--node-acorn-node/.gitignore (renamed from module-node-acorn-node/.gitignore)0
-rw-r--r--node-acorn-node/.travis.yml (renamed from module-node-acorn-node/.travis.yml)2
-rw-r--r--node-acorn-node/CHANGELOG.md (renamed from module-node-acorn-node/CHANGELOG.md)6
-rw-r--r--node-acorn-node/LICENSE.md (renamed from module-node-acorn-node/LICENSE.md)0
-rw-r--r--node-acorn-node/README.md (renamed from module-node-acorn-node/README.md)0
-rw-r--r--node-acorn-node/build.js (renamed from module-node-acorn-node/build.js)0
-rw-r--r--node-acorn-node/index.js (renamed from module-node-acorn-node/index.js)2
-rw-r--r--node-acorn-node/package.json (renamed from module-node-acorn-node/package.json)12
-rw-r--r--node-acorn-node/test/index.js (renamed from module-node-acorn-node/test/index.js)7
-rw-r--r--node-acorn-node/walk.js (renamed from module-node-acorn-node/walk.js)0
-rw-r--r--package.json5
-rw-r--r--test/lint.js2
-rw-r--r--test/tests-async-iteration.js2
-rw-r--r--test/tests-asyncawait.js55
-rw-r--r--test/tests-directive.js27
-rw-r--r--test/tests-harmony.js394
-rw-r--r--test/tests-regexp-2018.js2
-rw-r--r--test/tests.js29316
112 files changed, 816 insertions, 34237 deletions
diff --git a/.gitignore b/.gitignore
index 92ee82d..1052d7d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
.DS_Store
-node_modules
+**/node_modules
+!/acorn-loose/node_modules
/.tern-port
/local
/bin/_acorn.js
diff --git a/.travis.yml b/.travis.yml
index c25967a..27e8b82 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,8 +1,6 @@
language: node_js
sudo: false
-cache:
- directories:
- - "node_modules"
+cache: npm
matrix:
include:
- node_js: '0.12'
diff --git a/AUTHORS b/AUTHORS
index c5ac22c..0fec871 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -9,9 +9,11 @@ Angelo
Aparajita Fishman
Arian Stolwijk
Artem Govorov
+Ben Page
Boopesh Mahendran
Bradley Heinz
Brandon Mills
+Brian Donovan
Charles Hughes
Charmander
Chris McKnight
@@ -21,6 +23,7 @@ David Bonnet
Domenico Matteo
ehmicky
Eugene Obrezkov
+Fabien LOISON
Felix Maier
Forbes Lindesay
Gilad Peleg
@@ -40,6 +43,7 @@ Keheliya Gallaba
Kevin Irish
Kevin Kwok
krator
+kyranet
laosb
luckyzeng
Marek
diff --git a/README.md b/README.md
index e3929c2..ef86c33 100644
--- a/README.md
+++ b/README.md
@@ -3,14 +3,13 @@
[![Build Status](https://travis-ci.org/acornjs/acorn.svg?branch=master)](https://travis-ci.org/acornjs/acorn)
[![NPM version](https://img.shields.io/npm/v/acorn.svg)](https://www.npmjs.com/package/acorn)
[![CDNJS](https://img.shields.io/cdnjs/v/acorn.svg)](https://cdnjs.com/libraries/acorn)
-[Author funding status: ![maintainer happiness](https://marijnhaverbeke.nl/fund/status_s.png?force)](https://marijnhaverbeke.nl/fund/)
A tiny, fast JavaScript parser, written completely in JavaScript.
## Community
Acorn is open source software released under an
-[MIT license](https://github.com/acornjs/acorn/blob/master/LICENSE).
+[MIT license](https://github.com/acornjs/acorn/blob/master/acorn/LICENSE).
You are welcome to
[report bugs](https://github.com/acornjs/acorn/issues) or create pull
@@ -65,7 +64,7 @@ avoid needlessly confusing the JavaScript engine's optimizer.
const {Parser} = require("acorn")
const MyParser = Parser.extend(
- require("acorn-jsx"),
+ require("acorn-jsx")(),
require("acorn-bigint")
)
console.log(MyParser.parse("// Some bigint + JSX code"))
diff --git a/acorn-loose/README.md b/acorn-loose/README.md
index d881a64..3d8f5ba 100644
--- a/acorn-loose/README.md
+++ b/acorn-loose/README.md
@@ -16,7 +16,7 @@ parser when that one finds syntax errors.
## Community
Acorn is open source software released under an
-[MIT license](https://github.com/acornjs/acorn/blob/master/LICENSE).
+[MIT license](https://github.com/acornjs/acorn/blob/master/acorn-loose/LICENSE).
You are welcome to [report
bugs](https://github.com/acornjs/acorn/issues) or create pull requests
diff --git a/acorn-loose/node_modules/acorn b/acorn-loose/node_modules/acorn
new file mode 120000
index 0000000..5933105
--- /dev/null
+++ b/acorn-loose/node_modules/acorn
@@ -0,0 +1 @@
+../../acorn \ No newline at end of file
diff --git a/acorn-loose/rollup.config.js b/acorn-loose/rollup.config.js
index bbaedae..e5cbc30 100644
--- a/acorn-loose/rollup.config.js
+++ b/acorn-loose/rollup.config.js
@@ -11,6 +11,6 @@ export default {
{dest: "acorn-loose/dist/acorn-loose.js", format: "umd"},
{dest: "acorn-loose/dist/acorn-loose.mjs", format: "es"}
],
- external: function (id) { return !/^[\.\/]/.test(id) },
+ external: ["acorn"],
globals: {acorn: "acorn"}
}
diff --git a/acorn-walk/README.md b/acorn-walk/README.md
index 2b94bec..e192bac 100644
--- a/acorn-walk/README.md
+++ b/acorn-walk/README.md
@@ -6,7 +6,7 @@ An abstract syntax tree walker for the
## Community
Acorn is open source software released under an
-[MIT license](https://github.com/acornjs/acorn/blob/master/LICENSE).
+[MIT license](https://github.com/acornjs/acorn/blob/master/acorn-walk/LICENSE).
You are welcome to
[report bugs](https://github.com/acornjs/acorn/issues) or create pull
diff --git a/acorn-walk/package.json b/acorn-walk/package.json
index a6faa45..aee3f25 100644
--- a/acorn-walk/package.json
+++ b/acorn-walk/package.json
@@ -4,7 +4,7 @@
"homepage": "https://github.com/acornjs/acorn",
"main": "dist/walk.js",
"module": "dist/walk.mjs",
- "version": "6.1.0",
+ "version": "6.1.1",
"engines": {"node": ">=0.4.0"},
"maintainers": [
{
diff --git a/acorn/CHANGELOG.md b/acorn/CHANGELOG.md
index 59ae22d..1c8f79c 100644
--- a/acorn/CHANGELOG.md
+++ b/acorn/CHANGELOG.md
@@ -1,3 +1,79 @@
+## 6.1.1 (2019-02-27)
+
+### Bug fixes
+
+Fix bug that caused parsing default exports of with names to fail.
+
+## 6.1.0 (2019-02-08)
+
+### Bug fixes
+
+Fix scope checking when redefining a `var` as a lexical binding.
+
+### New features
+
+Split up `parseSubscripts` to use an internal `parseSubscript` method to make it easier to extend with plugins.
+
+## 6.0.7 (2019-02-04)
+
+### Bug fixes
+
+Check that exported bindings are defined.
+
+Don't treat `\u180e` as a whitespace character.
+
+Check for duplicate parameter names in methods.
+
+Don't allow shorthand properties when they are generators or async methods.
+
+Forbid binding `await` in async arrow function's parameter list.
+
+## 6.0.6 (2019-01-30)
+
+### Bug fixes
+
+The content of class declarations and expressions is now always parsed in strict mode.
+
+Don't allow `let` or `const` to bind the variable name `let`.
+
+Treat class declarations as lexical.
+
+Don't allow a generator function declaration as the sole body of an `if` or `else`.
+
+Ignore `"use strict"` when after an empty statement.
+
+Allow string line continuations with special line terminator characters.
+
+Treat `for` bodies as part of the `for` scope when checking for conflicting bindings.
+
+Fix bug with parsing `yield` in a `for` loop initializer.
+
+Implement special cases around scope checking for functions.
+
+## 6.0.5 (2019-01-02)
+
+### Bug fixes
+
+Fix TypeScript type for `Parser.extend` and add `allowAwaitOutsideFunction` to options type.
+
+Don't treat `let` as a keyword when the next token is `{` on the next line.
+
+Fix bug that broke checking for parentheses around an object pattern in a destructuring assignment when `preserveParens` was on.
+
+## 6.0.4 (2018-11-05)
+
+### Bug fixes
+
+Further improvements to tokenizing regular expressions in corner cases.
+
+## 6.0.3 (2018-11-04)
+
+### Bug fixes
+
+Fix bug in tokenizing an expression-less return followed by a function followed by a regular expression.
+
+Remove stray symlink in the package tarball.
+
## 6.0.2 (2018-09-26)
### Bug fixes
diff --git a/acorn/README.md b/acorn/README.md
index e66dac3..3e5f58d 100644
--- a/acorn/README.md
+++ b/acorn/README.md
@@ -5,7 +5,7 @@ A tiny, fast JavaScript parser written in JavaScript.
## Community
Acorn is open source software released under an
-[MIT license](https://github.com/acornjs/acorn/blob/master/LICENSE).
+[MIT license](https://github.com/acornjs/acorn/blob/master/acorn/LICENSE).
You are welcome to
[report bugs](https://github.com/acornjs/acorn/issues) or create pull
diff --git a/acorn/dist/acorn.d.ts b/acorn/dist/acorn.d.ts
index 1c8d927..c6f9841 100644
--- a/acorn/dist/acorn.d.ts
+++ b/acorn/dist/acorn.d.ts
@@ -19,6 +19,7 @@ declare namespace acorn {
allowReserved?: boolean
allowReturnOutsideFunction?: boolean
allowImportExportEverywhere?: boolean
+ allowAwaitOutsideFunction?: boolean
allowHashBang?: boolean
locations?: boolean
onToken?: ((token: Token) => any) | Token[]
@@ -42,7 +43,7 @@ declare namespace acorn {
getToken(): Token
[Symbol.iterator](): Iterator<Token>
}
- static extend(...plugins: (typeof Parser)[]): typeof Parser
+ static extend(...plugins: ((BaseParser: typeof Parser) => typeof Parser)[]): typeof Parser
}
interface Position { line: number; column: number; offset: number }
diff --git a/acorn/package.json b/acorn/package.json
index 33bc1fa..808d1da 100644
--- a/acorn/package.json
+++ b/acorn/package.json
@@ -4,7 +4,7 @@
"homepage": "https://github.com/acornjs/acorn",
"main": "dist/acorn.js",
"module": "dist/acorn.mjs",
- "version": "6.0.2",
+ "version": "6.1.1",
"engines": {"node": ">=0.4.0"},
"maintainers": [
{
diff --git a/acorn/src/expression.js b/acorn/src/expression.js
index 310b393..97c3fe6 100644
--- a/acorn/src/expression.js
+++ b/acorn/src/expression.js
@@ -105,7 +105,7 @@ pp.parseExpression = function(noIn, refDestructuringErrors) {
pp.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
if (this.isContextual("yield")) {
- if (this.inGenerator) return this.parseYield()
+ if (this.inGenerator) return this.parseYield(noIn)
// The tokenizer will assume an expression is allowed after
// `yield`, but this isn't that kind of yield
else this.exprAllowed = false
@@ -260,42 +260,53 @@ pp.parseExprSubscripts = function(refDestructuringErrors) {
pp.parseSubscripts = function(base, startPos, startLoc, noCalls) {
let maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
this.lastTokEnd === base.end && !this.canInsertSemicolon() && this.input.slice(base.start, base.end) === "async"
- for (let computed;;) {
- if ((computed = this.eat(tt.bracketL)) || this.eat(tt.dot)) {
- let node = this.startNodeAt(startPos, startLoc)
- node.object = base
- node.property = computed ? this.parseExpression() : this.parseIdent(true)
- node.computed = !!computed
- if (computed) this.expect(tt.bracketR)
- base = this.finishNode(node, "MemberExpression")
- } else if (!noCalls && this.eat(tt.parenL)) {
- let refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos
- this.yieldPos = 0
- this.awaitPos = 0
- let exprList = this.parseExprList(tt.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors)
- if (maybeAsyncArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) {
- this.checkPatternErrors(refDestructuringErrors, false)
- this.checkYieldAwaitInDefaultParams()
- this.yieldPos = oldYieldPos
- this.awaitPos = oldAwaitPos
- return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true)
- }
- this.checkExpressionErrors(refDestructuringErrors, true)
- this.yieldPos = oldYieldPos || this.yieldPos
- this.awaitPos = oldAwaitPos || this.awaitPos
- let node = this.startNodeAt(startPos, startLoc)
- node.callee = base
- node.arguments = exprList
- base = this.finishNode(node, "CallExpression")
- } else if (this.type === tt.backQuote) {
- let node = this.startNodeAt(startPos, startLoc)
- node.tag = base
- node.quasi = this.parseTemplate({isTagged: true})
- base = this.finishNode(node, "TaggedTemplateExpression")
- } else {
- return base
+ while (true) {
+ let element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow)
+ if (element === base || element.type === "ArrowFunctionExpression") return element
+ base = element
+ }
+}
+
+pp.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow) {
+ let computed = this.eat(tt.bracketL)
+ if (computed || this.eat(tt.dot)) {
+ let node = this.startNodeAt(startPos, startLoc)
+ node.object = base
+ node.property = computed ? this.parseExpression() : this.parseIdent(true)
+ node.computed = !!computed
+ if (computed) this.expect(tt.bracketR)
+ base = this.finishNode(node, "MemberExpression")
+ } else if (!noCalls && this.eat(tt.parenL)) {
+ let refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos
+ this.yieldPos = 0
+ this.awaitPos = 0
+ this.awaitIdentPos = 0
+ let exprList = this.parseExprList(tt.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors)
+ if (maybeAsyncArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) {
+ this.checkPatternErrors(refDestructuringErrors, false)
+ this.checkYieldAwaitInDefaultParams()
+ if (this.awaitIdentPos > 0)
+ this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function")
+ this.yieldPos = oldYieldPos
+ this.awaitPos = oldAwaitPos
+ this.awaitIdentPos = oldAwaitIdentPos
+ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true)
}
+ this.checkExpressionErrors(refDestructuringErrors, true)
+ this.yieldPos = oldYieldPos || this.yieldPos
+ this.awaitPos = oldAwaitPos || this.awaitPos
+ this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos
+ let node = this.startNodeAt(startPos, startLoc)
+ node.callee = base
+ node.arguments = exprList
+ base = this.finishNode(node, "CallExpression")
+ } else if (this.type === tt.backQuote) {
+ let node = this.startNodeAt(startPos, startLoc)
+ node.tag = base
+ node.quasi = this.parseTemplate({isTagged: true})
+ base = this.finishNode(node, "TaggedTemplateExpression")
}
+ return base
}
// Parse an atomic expression — either a single token that is an
@@ -304,6 +315,10 @@ pp.parseSubscripts = function(base, startPos, startLoc, noCalls) {
// or `{}`.
pp.parseExprAtom = function(refDestructuringErrors) {
+ // If a division operator appears in an expression position, the
+ // tokenizer got confused, and we force it to read a regexp instead.
+ if (this.type === tt.slash) this.readRegexp()
+
let node, canBeArrow = this.potentialArrowAt === this.start
switch (this.type) {
case tt._super:
@@ -330,14 +345,14 @@ pp.parseExprAtom = function(refDestructuringErrors) {
case tt.name:
let startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc
- let id = this.parseIdent(this.type !== tt.name)
+ let id = this.parseIdent(false)
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(tt._function))
return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true)
if (canBeArrow && !this.canInsertSemicolon()) {
if (this.eat(tt.arrow))
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false)
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === tt.name && !containsEsc) {
- id = this.parseIdent()
+ id = this.parseIdent(false)
if (this.canInsertSemicolon() || !this.eat(tt.arrow))
this.unexpected()
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true)
@@ -424,6 +439,7 @@ pp.parseParenAndDistinguishExpression = function(canBeArrow) {
let refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart
this.yieldPos = 0
this.awaitPos = 0
+ // Do not save awaitIdentPos to allow checking awaits nested in parameters
while (this.type !== tt.parenR) {
first ? first = false : this.expect(tt.comma)
if (allowTrailingComma && this.afterTrailingComma(tt.parenR, true)) {
@@ -659,7 +675,10 @@ pp.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos
this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params")
}
} else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
+ if (isGenerator || isAsync) this.unexpected()
this.checkUnreserved(prop.key)
+ if (prop.key.name === "await" && !this.awaitIdentPos)
+ this.awaitIdentPos = startPos
prop.kind = "init"
if (isPattern) {
prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key)
@@ -699,7 +718,7 @@ pp.initFunction = function(node) {
// Parse object or class method.
pp.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
- let node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos
+ let node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos
this.initFunction(node)
if (this.options.ecmaVersion >= 6)
@@ -709,22 +728,24 @@ pp.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
this.yieldPos = 0
this.awaitPos = 0
+ this.awaitIdentPos = 0
this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0))
this.expect(tt.parenL)
node.params = this.parseBindingList(tt.parenR, false, this.options.ecmaVersion >= 8)
this.checkYieldAwaitInDefaultParams()
- this.parseFunctionBody(node, false)
+ this.parseFunctionBody(node, false, true)
this.yieldPos = oldYieldPos
this.awaitPos = oldAwaitPos
+ this.awaitIdentPos = oldAwaitIdentPos
return this.finishNode(node, "FunctionExpression")
}
// Parse arrow function expression with given parameters.
pp.parseArrowExpression = function(node, params, isAsync) {
- let oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos
+ let oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW)
this.initFunction(node)
@@ -732,18 +753,20 @@ pp.parseArrowExpression = function(node, params, isAsync) {
this.yieldPos = 0
this.awaitPos = 0
+ this.awaitIdentPos = 0
node.params = this.toAssignableList(params, true)
- this.parseFunctionBody(node, true)
+ this.parseFunctionBody(node, true, false)
this.yieldPos = oldYieldPos
this.awaitPos = oldAwaitPos
+ this.awaitIdentPos = oldAwaitIdentPos
return this.finishNode(node, "ArrowFunctionExpression")
}
// Parse function body and check parameters.
-pp.parseFunctionBody = function(node, isArrowFunction) {
+pp.parseFunctionBody = function(node, isArrowFunction, isMethod) {
let isExpression = isArrowFunction && this.type !== tt.braceL
let oldStrict = this.strict, useStrict = false
@@ -769,7 +792,7 @@ pp.parseFunctionBody = function(node, isArrowFunction) {
// Add the params to varDeclaredNames to ensure that an error is thrown
// if a let/const declaration in the function clashes with one of the params.
- this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && this.isSimpleParamList(node.params))
+ this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params))
node.body = this.parseBlock(false)
node.expression = false
this.adaptDirectivePrologue(node.body.body)
@@ -828,9 +851,9 @@ pp.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructur
pp.checkUnreserved = function({start, end, name}) {
if (this.inGenerator && name === "yield")
- this.raiseRecoverable(start, "Can not use 'yield' as identifier inside a generator")
+ this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator")
if (this.inAsync && name === "await")
- this.raiseRecoverable(start, "Can not use 'await' as identifier inside an async function")
+ this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function")
if (this.keywords.test(name))
this.raise(start, `Unexpected keyword '${name}'`)
if (this.options.ecmaVersion < 6 &&
@@ -838,7 +861,7 @@ pp.checkUnreserved = function({start, end, name}) {
const re = this.strict ? this.reservedWordsStrict : this.reservedWords
if (re.test(name)) {
if (!this.inAsync && name === "await")
- this.raiseRecoverable(start, "Can not use keyword 'await' outside an async function")
+ this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function")
this.raiseRecoverable(start, `The keyword '${name}' is reserved`)
}
}
@@ -868,13 +891,17 @@ pp.parseIdent = function(liberal, isBinding) {
}
this.next()
this.finishNode(node, "Identifier")
- if (!liberal) this.checkUnreserved(node)
+ if (!liberal) {
+ this.checkUnreserved(node)
+ if (node.name === "await" && !this.awaitIdentPos)
+ this.awaitIdentPos = node.start
+ }
return node
}
// Parses yield expression inside generator.
-pp.parseYield = function() {
+pp.parseYield = function(noIn) {
if (!this.yieldPos) this.yieldPos = this.start
let node = this.startNode()
@@ -884,7 +911,7 @@ pp.parseYield = function() {
node.argument = null
} else {
node.delegate = this.eat(tt.star)
- node.argument = this.parseMaybeAssign()
+ node.argument = this.parseMaybeAssign(noIn)
}
return this.finishNode(node, "YieldExpression")
}
diff --git a/acorn/src/index.js b/acorn/src/index.js
index 9c3ba6e..510648e 100644
--- a/acorn/src/index.js
+++ b/acorn/src/index.js
@@ -32,7 +32,7 @@ export {isIdentifierChar, isIdentifierStart} from "./identifier"
export {Token} from "./tokenize"
export {isNewLine, lineBreak, lineBreakG, nonASCIIwhitespace} from "./whitespace"
-export const version = "6.0.2"
+export const version = "6.1.1"
// The main exported interface (under `self.acorn` when in the
// browser) is a `parse` function that takes a code string and
diff --git a/acorn/src/lval.js b/acorn/src/lval.js
index 17e0faf..dbd220f 100644
--- a/acorn/src/lval.js
+++ b/acorn/src/lval.js
@@ -13,7 +13,7 @@ pp.toAssignable = function(node, isBinding, refDestructuringErrors) {
switch (node.type) {
case "Identifier":
if (this.inAsync && node.name === "await")
- this.raise(node.start, "Can not use 'await' as identifier inside an async function")
+ this.raise(node.start, "Cannot use 'await' as identifier inside an async function")
break
case "ObjectPattern":
@@ -70,7 +70,7 @@ pp.toAssignable = function(node, isBinding, refDestructuringErrors) {
break
case "ParenthesizedExpression":
- this.toAssignable(node.expression, isBinding)
+ this.toAssignable(node.expression, isBinding, refDestructuringErrors)
break
case "MemberExpression":
diff --git a/acorn/src/options.js b/acorn/src/options.js
index e7fa9c5..8101abd 100644
--- a/acorn/src/options.js
+++ b/acorn/src/options.js
@@ -17,7 +17,7 @@ export const defaultOptions = {
sourceType: "script",
// `onInsertedSemicolon` can be a callback that will be called
// when a semicolon is automatically inserted. It will be passed
- // th position of the comma as an offset, and if `locations` is
+ // the position of the comma as an offset, and if `locations` is
// enabled, it is given the location as a `{line, column}` object
// as second argument.
onInsertedSemicolon: null,
diff --git a/acorn/src/parseutil.js b/acorn/src/parseutil.js
index 0409cb9..bce71b5 100644
--- a/acorn/src/parseutil.js
+++ b/acorn/src/parseutil.js
@@ -6,15 +6,22 @@ const pp = Parser.prototype
// ## Parser utilities
-const literal = /^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)"|;)/
+const literal = /^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)")/
pp.strictDirective = function(start) {
for (;;) {
+ // Try to find string literal.
skipWhiteSpace.lastIndex = start
start += skipWhiteSpace.exec(this.input)[0].length
let match = literal.exec(this.input.slice(start))
if (!match) return false
if ((match[1] || match[2]) === "use strict") return true
start += match[0].length
+
+ // Skip semicolon, if any.
+ skipWhiteSpace.lastIndex = start
+ start += skipWhiteSpace.exec(this.input)[0].length
+ if (this.input[start] === ";")
+ start++
}
}
diff --git a/acorn/src/regexp.js b/acorn/src/regexp.js
index c18ee6d..00a4dc2 100644
--- a/acorn/src/regexp.js
+++ b/acorn/src/regexp.js
@@ -1,6 +1,7 @@
import {isIdentifierStart, isIdentifierChar} from "./identifier.js"
import {Parser} from "./state.js"
import UNICODE_PROPERTY_VALUES from "./unicode-property-data.js"
+import {has} from "./util.js"
const pp = Parser.prototype
@@ -8,6 +9,7 @@ export class RegExpValidationState {
constructor(parser) {
this.parser = parser
this.validFlags = `gim${parser.options.ecmaVersion >= 6 ? "uy" : ""}${parser.options.ecmaVersion >= 9 ? "s" : ""}`
+ this.unicodeProperties = UNICODE_PROPERTY_VALUES[parser.options.ecmaVersion >= 10 ? 10 : parser.options.ecmaVersion]
this.source = ""
this.flags = ""
this.start = 0
@@ -784,14 +786,14 @@ pp.regexp_eatUnicodePropertyValueExpression = function(state) {
return false
}
pp.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
- if (!UNICODE_PROPERTY_VALUES.hasOwnProperty(name) || UNICODE_PROPERTY_VALUES[name].indexOf(value) === -1) {
+ if (!has(state.unicodeProperties.nonBinary, name))
state.raise("Invalid property name")
- }
+ if (!state.unicodeProperties.nonBinary[name].test(value))
+ state.raise("Invalid property value")
}
pp.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
- if (UNICODE_PROPERTY_VALUES.$LONE.indexOf(nameOrValue) === -1) {
+ if (!state.unicodeProperties.binary.test(nameOrValue))
state.raise("Invalid property name")
- }
}
// UnicodePropertyName ::
diff --git a/acorn/src/scope.js b/acorn/src/scope.js
index bcf34ec..b0b9866 100644
--- a/acorn/src/scope.js
+++ b/acorn/src/scope.js
@@ -1,5 +1,5 @@
import {Parser} from "./state"
-import {SCOPE_VAR, SCOPE_ARROW, SCOPE_SIMPLE_CATCH, BIND_LEXICAL, BIND_SIMPLE_CATCH, BIND_FUNCTION} from "./scopeflags"
+import {SCOPE_VAR, SCOPE_FUNCTION, SCOPE_TOP, SCOPE_ARROW, SCOPE_SIMPLE_CATCH, BIND_LEXICAL, BIND_SIMPLE_CATCH, BIND_FUNCTION} from "./scopeflags"
const pp = Parser.prototype
@@ -10,6 +10,8 @@ class Scope {
this.var = []
// A list of lexically-declared names in the current lexical scope
this.lexical = []
+ // A list of lexically-declared FunctionDeclaration names in the current lexical scope
+ this.functions = []
}
}
@@ -23,30 +25,56 @@ pp.exitScope = function() {
this.scopeStack.pop()
}
+// The spec says:
+// > At the top level of a function, or script, function declarations are
+// > treated like var declarations rather than like lexical declarations.
+pp.treatFunctionsAsVarInScope = function(scope) {
+ return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
+}
+
pp.declareName = function(name, bindingType, pos) {
let redeclared = false
if (bindingType === BIND_LEXICAL) {
const scope = this.currentScope()
- redeclared = scope.lexical.indexOf(name) > -1 || scope.var.indexOf(name) > -1
+ redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1
scope.lexical.push(name)
+ if (this.inModule && (scope.flags & SCOPE_TOP))
+ delete this.undefinedExports[name]
} else if (bindingType === BIND_SIMPLE_CATCH) {
const scope = this.currentScope()
scope.lexical.push(name)
} else if (bindingType === BIND_FUNCTION) {
const scope = this.currentScope()
- redeclared = scope.lexical.indexOf(name) > -1
- scope.var.push(name)
+ if (this.treatFunctionsAsVar)
+ redeclared = scope.lexical.indexOf(name) > -1
+ else
+ redeclared = scope.lexical.indexOf(name) > -1 || scope.var.indexOf(name) > -1
+ scope.functions.push(name)
} else {
for (let i = this.scopeStack.length - 1; i >= 0; --i) {
const scope = this.scopeStack[i]
- if (scope.lexical.indexOf(name) > -1 && !(scope.flags & SCOPE_SIMPLE_CATCH) && scope.lexical[0] === name) redeclared = true
+ if (scope.lexical.indexOf(name) > -1 && !((scope.flags & SCOPE_SIMPLE_CATCH) && scope.lexical[0] === name) ||
+ !this.treatFunctionsAsVarInScope(scope) && scope.functions.indexOf(name) > -1) {
+ redeclared = true
+ break
+ }
scope.var.push(name)
+ if (this.inModule && (scope.flags & SCOPE_TOP))
+ delete this.undefinedExports[name]
if (scope.flags & SCOPE_VAR) break
}
}
if (redeclared) this.raiseRecoverable(pos, `Identifier '${name}' has already been declared`)
}
+pp.checkLocalExport = function(id) {
+ // scope.functions must be empty as Module code is always strict.
+ if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
+ this.scopeStack[0].var.indexOf(id.name) === -1) {
+ this.undefinedExports[id.name] = id
+ }
+}
+
pp.currentScope = function() {
return this.scopeStack[this.scopeStack.length - 1]
}
diff --git a/acorn/src/state.js b/acorn/src/state.js
index a838742..dce754f 100644
--- a/acorn/src/state.js
+++ b/acorn/src/state.js
@@ -2,27 +2,24 @@ import {reservedWords, keywords} from "./identifier"
import {types as tt} from "./tokentype"
import {lineBreak} from "./whitespace"
import {getOptions} from "./options"
+import {wordsRegexp} from "./util"
import {SCOPE_TOP, SCOPE_FUNCTION, SCOPE_ASYNC, SCOPE_GENERATOR, SCOPE_SUPER, SCOPE_DIRECT_SUPER} from "./scopeflags"
-function keywordRegexp(words) {
- return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$")
-}
-
export class Parser {
constructor(options, input, startPos) {
this.options = options = getOptions(options)
this.sourceFile = options.sourceFile
- this.keywords = keywordRegexp(keywords[options.ecmaVersion >= 6 ? 6 : 5])
+ this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : 5])
let reserved = ""
if (!options.allowReserved) {
for (let v = options.ecmaVersion;; v--)
if (reserved = reservedWords[v]) break
if (options.sourceType === "module") reserved += " await"
}
- this.reservedWords = keywordRegexp(reserved)
+ this.reservedWords = wordsRegexp(reserved)
let reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict
- this.reservedWordsStrict = keywordRegexp(reservedStrict)
- this.reservedWordsStrictBind = keywordRegexp(reservedStrict + " " + reservedWords.strictBind)
+ this.reservedWordsStrict = wordsRegexp(reservedStrict)
+ this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind)
this.input = String(input)
// Used to signal to callers of `readWord1` whether the word
@@ -71,9 +68,11 @@ export class Parser {
this.potentialArrowAt = -1
// Positions to delayed-check that yield/await does not exist in default parameters.
- this.yieldPos = this.awaitPos = 0
+ this.yieldPos = this.awaitPos = this.awaitIdentPos = 0
// Labels in scope.
this.labels = []
+ // Thus-far undefined exports.
+ this.undefinedExports = {}
// If enabled, skip leading hashbang line.
if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!")
@@ -98,6 +97,7 @@ export class Parser {
get inAsync() { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 }
get allowSuper() { return (this.currentThisScope().flags & SCOPE_SUPER) > 0 }
get allowDirectSuper() { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 }
+ get treatFunctionsAsVar() { return this.treatFunctionsAsVarInScope(this.currentScope()) }
// Switch to a getter for 7.0.0.
inNonArrowFunction() { return (this.currentThisScope().flags & SCOPE_FUNCTION) > 0 }
diff --git a/acorn/src/statement.js b/acorn/src/statement.js
index f5e65ef..23a9038 100644
--- a/acorn/src/statement.js
+++ b/acorn/src/statement.js
@@ -22,6 +22,9 @@ pp.parseTopLevel = function(node) {
let stmt = this.parseStatement(null, true, exports)
node.body.push(stmt)
}
+ if (this.inModule)
+ for (let name of Object.keys(this.undefinedExports))
+ this.raiseRecoverable(this.undefinedExports[name].start, `Export '${name}' is not defined`)
this.adaptDirectivePrologue(node.body)
this.next()
if (this.options.ecmaVersion >= 6) {
@@ -32,12 +35,19 @@ pp.parseTopLevel = function(node) {
const loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"}
-pp.isLet = function() {
+pp.isLet = function(context) {
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) return false
skipWhiteSpace.lastIndex = this.pos
let skip = skipWhiteSpace.exec(this.input)
let next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next)
- if (nextCh === 91 || nextCh === 123) return true // '{' and '['
+ // For ambiguous cases, determine if a LexicalDeclaration (or only a
+ // Statement) is allowed here. If context is not empty then only a Statement
+ // is allowed. However, `let [` is an explicit negative lookahead for
+ // ExpressionStatement, so special-case it first.
+ if (nextCh === 91) return true // '['
+ if (context) return false
+
+ if (nextCh === 123) return true // '{'
if (isIdentifierStart(nextCh, true)) {
let pos = next + 1
while (isIdentifierChar(this.input.charCodeAt(pos), true)) ++pos
@@ -72,7 +82,7 @@ pp.isAsyncFunction = function() {
pp.parseStatement = function(context, topLevel, exports) {
let starttype = this.type, node = this.startNode(), kind
- if (this.isLet()) {
+ if (this.isLet(context)) {
starttype = tt._var
kind = "let"
}
@@ -87,7 +97,10 @@ pp.parseStatement = function(context, topLevel, exports) {
case tt._do: return this.parseDoStatement(node)
case tt._for: return this.parseForStatement(node)
case tt._function:
- if ((context && (this.strict || context !== "if")) && this.options.ecmaVersion >= 6) this.unexpected()
+ // Function as sole body of either an if statement or a labeled statement
+ // works, but not when it is part of a labeled statement that is the sole
+ // body of an if statement.
+ if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) this.unexpected()
return this.parseFunctionStatement(node, false, !context)
case tt._class:
if (context) this.unexpected()
@@ -384,11 +397,7 @@ pp.parseLabeledStatement = function(node, maybeName, expr, context) {
} else break
}
this.labels.push({name: maybeName, kind, statementStart: this.start})
- node.body = this.parseStatement(context)
- if (node.body.type === "ClassDeclaration" ||
- node.body.type === "VariableDeclaration" && node.body.kind !== "var" ||
- node.body.type === "FunctionDeclaration" && (this.strict || node.body.generator || node.body.async))
- this.raiseRecoverable(node.body.start, "Invalid labeled declaration")
+ node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label")
this.labels.pop()
node.label = expr
return this.finishNode(node, "LabeledStatement")
@@ -427,8 +436,8 @@ pp.parseFor = function(node, init) {
this.expect(tt.semi)
node.update = this.type === tt.parenR ? null : this.parseExpression()
this.expect(tt.parenR)
- this.exitScope()
node.body = this.parseStatement("for")
+ this.exitScope()
this.labels.pop()
return this.finishNode(node, "ForStatement")
}
@@ -448,8 +457,8 @@ pp.parseForIn = function(node, init) {
node.left = init
node.right = type === "ForInStatement" ? this.parseExpression() : this.parseMaybeAssign()
this.expect(tt.parenR)
- this.exitScope()
node.body = this.parseStatement("for")
+ this.exitScope()
this.labels.pop()
return this.finishNode(node, type)
}
@@ -478,41 +487,54 @@ pp.parseVar = function(node, isFor, kind) {
}
pp.parseVarId = function(decl, kind) {
- decl.id = this.parseBindingAtom(kind)
+ if ((kind === "const" || kind === "let") && this.isContextual("let")) {
+ this.raiseRecoverable(this.start, "let is disallowed as a lexically bound name")
+ }
+ decl.id = this.parseBindingAtom()
this.checkLVal(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false)
}
const FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4
// Parse a function declaration or literal (depending on the
-// `isStatement` parameter).
+// `statement & FUNC_STATEMENT`).
+// Remove `allowExpressionBody` for 7.0.0, as it is only called with false
pp.parseFunction = function(node, statement, allowExpressionBody, isAsync) {
this.initFunction(node)
- if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync)
+ if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
+ if (this.type === tt.star && (statement & FUNC_HANGING_STATEMENT))
+ this.unexpected()
node.generator = this.eat(tt.star)
+ }
if (this.options.ecmaVersion >= 8)
node.async = !!isAsync
if (statement & FUNC_STATEMENT) {
node.id = (statement & FUNC_NULLABLE_ID) && this.type !== tt.name ? null : this.parseIdent()
if (node.id && !(statement & FUNC_HANGING_STATEMENT))
- this.checkLVal(node.id, this.inModule && !this.inFunction ? BIND_LEXICAL : BIND_FUNCTION)
+ // If it is a regular function declaration in sloppy mode, then it is
+ // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
+ // mode depends on properties of the current scope (see
+ // treatFunctionsAsVar).
+ this.checkLVal(node.id, (this.strict || node.generator || node.async) ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION)
}
- let oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos
+ let oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos
this.yieldPos = 0
this.awaitPos = 0
+ this.awaitIdentPos = 0
this.enterScope(functionFlags(node.async, node.generator))
if (!(statement & FUNC_STATEMENT))
node.id = this.type === tt.name ? this.parseIdent() : null
this.parseFunctionParams(node)
- this.parseFunctionBody(node, allowExpressionBody)
+ this.parseFunctionBody(node, allowExpressionBody, false)
this.yieldPos = oldYieldPos
this.awaitPos = oldAwaitPos
+ this.awaitIdentPos = oldAwaitIdentPos
return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression")
}
@@ -528,6 +550,11 @@ pp.parseFunctionParams = function(node) {
pp.parseClass = function(node, isStatement) {
this.next()
+ // ecma-262 14.6 Class Definitions
+ // A class definition is always strict mode code.
+ const oldStrict = this.strict
+ this.strict = true
+
this.parseClassId(node, isStatement)
this.parseClassSuper(node)
let classBody = this.startNode()
@@ -545,6 +572,7 @@ pp.parseClass = function(node, isStatement) {
}
}
node.body = this.finishNode(classBody, "ClassBody")
+ this.strict = oldStrict
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
}
@@ -607,7 +635,15 @@ pp.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper)
}
pp.parseClassId = function(node, isStatement) {
- node.id = this.type === tt.name ? this.parseIdent() : isStatement === true ? this.unexpected() : null
+ if (this.type === tt.name) {
+ node.id = this.parseIdent()
+ if (isStatement)
+ this.checkLVal(node.id, BIND_LEXICAL, false)
+ } else {
+ if (isStatement === true)
+ this.unexpected()
+ node.id = null
+ }
}
pp.parseClassSuper = function(node) {
@@ -633,7 +669,7 @@ pp.parseExport = function(node, exports) {
let fNode = this.startNode()
this.next()
if (isAsync) this.next()
- node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync, true)
+ node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync)
} else if (this.type === tt._class) {
let cNode = this.startNode()
node.declaration = this.parseClass(cNode, "nullableID")
@@ -659,9 +695,11 @@ pp.parseExport = function(node, exports) {
if (this.type !== tt.string) this.unexpected()
node.source = this.parseExprAtom()
} else {
- // check for keywords used as local names
for (let spec of node.specifiers) {
+ // check for keywords used as local names
this.checkUnreserved(spec.local)
+ // check if export is defined
+ this.checkLocalExport(spec.local)
}
node.source = null
diff --git a/acorn/src/tokencontext.js b/acorn/src/tokencontext.js
index 6a89c7f..1ff5556 100644
--- a/acorn/src/tokencontext.js
+++ b/acorn/src/tokencontext.js
@@ -51,7 +51,7 @@ pp.braceIsBlock = function(prevType) {
return true
if (prevType === tt.braceL)
return parent === types.b_stat
- if (prevType === tt._var || prevType === tt.name)
+ if (prevType === tt._var || prevType === tt._const || prevType === tt.name)
return false
return !this.exprAllowed
}
@@ -111,6 +111,7 @@ tt.incDec.updateContext = function() {
tt._function.updateContext = tt._class.updateContext = function(prevType) {
if (prevType.beforeExpr && prevType !== tt.semi && prevType !== tt._else &&
+ !(prevType === tt._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
!((prevType === tt.colon || prevType === tt.braceL) && this.curContext() === types.b_stat))
this.context.push(types.f_expr)
else
diff --git a/acorn/src/tokenize.js b/acorn/src/tokenize.js
index 5fbbb27..acb9bf6 100644
--- a/acorn/src/tokenize.js
+++ b/acorn/src/tokenize.js
@@ -637,6 +637,11 @@ pp.readEscapedChar = function(inTemplate) {
}
return String.fromCharCode(octal)
}
+ if (isNewLine(ch)) {
+ // Unicode new line characters after \ get removed from output in both
+ // template literals and strings
+ return ""
+ }
return String.fromCharCode(ch)
}
}
diff --git a/acorn/src/unicode-property-data.js b/acorn/src/unicode-property-data.js
index d44f1a2..a2c1258 100644
--- a/acorn/src/unicode-property-data.js
+++ b/acorn/src/unicode-property-data.js
@@ -1,463 +1,42 @@
-const data = {
- "$LONE": [
- "ASCII",
- "ASCII_Hex_Digit",
- "AHex",
- "Alphabetic",
- "Alpha",
- "Any",
- "Assigned",
- "Bidi_Control",
- "Bidi_C",
- "Bidi_Mirrored",
- "Bidi_M",
- "Case_Ignorable",
- "CI",
- "Cased",
- "Changes_When_Casefolded",
- "CWCF",
- "Changes_When_Casemapped",
- "CWCM",
- "Changes_When_Lowercased",
- "CWL",
- "Changes_When_NFKC_Casefolded",
- "CWKCF",
- "Changes_When_Titlecased",
- "CWT",
- "Changes_When_Uppercased",
- "CWU",
- "Dash",
- "Default_Ignorable_Code_Point",
- "DI",
- "Deprecated",
- "Dep",
- "Diacritic",
- "Dia",
- "Emoji",
- "Emoji_Component",
- "Emoji_Modifier",
- "Emoji_Modifier_Base",
- "Emoji_Presentation",
- "Extender",
- "Ext",
- "Grapheme_Base",
- "Gr_Base",
- "Grapheme_Extend",
- "Gr_Ext",
- "Hex_Digit",
- "Hex",
- "IDS_Binary_Operator",
- "IDSB",
- "IDS_Trinary_Operator",
- "IDST",
- "ID_Continue",
- "IDC",
- "ID_Start",
- "IDS",
- "Ideographic",
- "Ideo",
- "Join_Control",
- "Join_C",
- "Logical_Order_Exception",
- "LOE",
- "Lowercase",
- "Lower",
- "Math",
- "Noncharacter_Code_Point",
- "NChar",
- "Pattern_Syntax",
- "Pat_Syn",
- "Pattern_White_Space",
- "Pat_WS",
- "Quotation_Mark",
- "QMark",
- "Radical",
- "Regional_Indicator",
- "RI",
- "Sentence_Terminal",
- "STerm",
- "Soft_Dotted",
- "SD",
- "Terminal_Punctuation",
- "Term",
- "Unified_Ideograph",
- "UIdeo",
- "Uppercase",
- "Upper",
- "Variation_Selector",
- "VS",
- "White_Space",
- "space",
- "XID_Continue",
- "XIDC",
- "XID_Start",
- "XIDS"
- ],
- "General_Category": [
- "Cased_Letter",
- "LC",
- "Close_Punctuation",
- "Pe",
- "Connector_Punctuation",
- "Pc",
- "Control",
- "Cc",
- "cntrl",
- "Currency_Symbol",
- "Sc",
- "Dash_Punctuation",
- "Pd",
- "Decimal_Number",
- "Nd",
- "digit",
- "Enclosing_Mark",
- "Me",
- "Final_Punctuation",
- "Pf",
- "Format",
- "Cf",
- "Initial_Punctuation",
- "Pi",
- "Letter",
- "L",
- "Letter_Number",
- "Nl",
- "Line_Separator",
- "Zl",
- "Lowercase_Letter",
- "Ll",
- "Mark",
- "M",
- "Combining_Mark",
- "Math_Symbol",
- "Sm",
- "Modifier_Letter",
- "Lm",
- "Modifier_Symbol",
- "Sk",
- "Nonspacing_Mark",
- "Mn",
- "Number",
- "N",
- "Open_Punctuation",
- "Ps",
- "Other",
- "C",
- "Other_Letter",
- "Lo",
- "Other_Number",
- "No",
- "Other_Punctuation",
- "Po",
- "Other_Symbol",
- "So",
- "Paragraph_Separator",
- "Zp",
- "Private_Use",
- "Co",
- "Punctuation",
- "P",
- "punct",
- "Separator",
- "Z",
- "Space_Separator",
- "Zs",
- "Spacing_Mark",
- "Mc",
- "Surrogate",
- "Cs",
- "Symbol",
- "S",
- "Titlecase_Letter",
- "Lt",
- "Unassigned",
- "Cn",
- "Uppercase_Letter",
- "Lu"
- ],
- "Script": [
- "Adlam",
- "Adlm",
- "Ahom",
- "Anatolian_Hieroglyphs",
- "Hluw",
- "Arabic",
- "Arab",
- "Armenian",
- "Armn",
- "Avestan",
- "Avst",
- "Balinese",
- "Bali",
- "Bamum",
- "Bamu",
- "Bassa_Vah",
- "Bass",
- "Batak",
- "Batk",
- "Bengali",
- "Beng",
- "Bhaiksuki",
- "Bhks",
- "Bopomofo",
- "Bopo",
- "Brahmi",
- "Brah",
- "Braille",
- "Brai",
- "Buginese",
- "Bugi",
- "Buhid",
- "Buhd",
- "Canadian_Aboriginal",
- "Cans",
- "Carian",
- "Cari",
- "Caucasian_Albanian",
- "Aghb",
- "Chakma",
- "Cakm",
- "Cham",
- "Cherokee",
- "Cher",
- "Common",
- "Zyyy",
- "Coptic",
- "Copt",
- "Qaac",
- "Cuneiform",
- "Xsux",
- "Cypriot",
- "Cprt",
- "Cyrillic",
- "Cyrl",
- "Deseret",
- "Dsrt",
- "Devanagari",
- "Deva",
- "Duployan",
- "Dupl",
- "Egyptian_Hieroglyphs",
- "Egyp",
- "Elbasan",
- "Elba",
- "Ethiopic",
- "Ethi",
- "Georgian",
- "Geor",
- "Glagolitic",
- "Glag",
- "Gothic",
- "Goth",
- "Grantha",
- "Gran",
- "Greek",
- "Grek",
- "Gujarati",
- "Gujr",
- "Gurmukhi",
- "Guru",
- "Han",
- "Hani",
- "Hangul",
- "Hang",
- "Hanunoo",
- "Hano",
- "Hatran",
- "Hatr",
- "Hebrew",
- "Hebr",
- "Hiragana",
- "Hira",
- "Imperial_Aramaic",
- "Armi",
- "Inherited",
- "Zinh",
- "Qaai",
- "Inscriptional_Pahlavi",
- "Phli",
- "Inscriptional_Parthian",
- "Prti",
- "Javanese",
- "Java",
- "Kaithi",
- "Kthi",
- "Kannada",
- "Knda",
- "Katakana",
- "Kana",
- "Kayah_Li",
- "Kali",
- "Kharoshthi",
- "Khar",
- "Khmer",
- "Khmr",
- "Khojki",
- "Khoj",
- "Khudawadi",
- "Sind",
- "Lao",
- "Laoo",
- "Latin",
- "Latn",
- "Lepcha",
- "Lepc",
- "Limbu",
- "Limb",
- "Linear_A",
- "Lina",
- "Linear_B",
- "Linb",
- "Lisu",
- "Lycian",
- "Lyci",
- "Lydian",
- "Lydi",
- "Mahajani",
- "Mahj",
- "Malayalam",
- "Mlym",
- "Mandaic",
- "Mand",
- "Manichaean",
- "Mani",
- "Marchen",
- "Marc",
- "Masaram_Gondi",
- "Gonm",
- "Meetei_Mayek",
- "Mtei",
- "Mende_Kikakui",
- "Mend",
- "Meroitic_Cursive",
- "Merc",
- "Meroitic_Hieroglyphs",
- "Mero",
- "Miao",
- "Plrd",
- "Modi",
- "Mongolian",
- "Mong",
- "Mro",
- "Mroo",
- "Multani",
- "Mult",
- "Myanmar",
- "Mymr",
- "Nabataean",
- "Nbat",
- "New_Tai_Lue",
- "Talu",
- "Newa",
- "Nko",
- "Nkoo",
- "Nushu",
- "Nshu",
- "Ogham",
- "Ogam",
- "Ol_Chiki",
- "Olck",
- "Old_Hungarian",
- "Hung",
- "Old_Italic",
- "Ital",
- "Old_North_Arabian",
- "Narb",
- "Old_Permic",
- "Perm",
- "Old_Persian",
- "Xpeo",
- "Old_South_Arabian",
- "Sarb",
- "Old_Turkic",
- "Orkh",
- "Oriya",
- "Orya",
- "Osage",
- "Osge",
- "Osmanya",
- "Osma",
- "Pahawh_Hmong",
- "Hmng",
- "Palmyrene",
- "Palm",
- "Pau_Cin_Hau",
- "Pauc",
- "Phags_Pa",
- "Phag",
- "Phoenician",
- "Phnx",
- "Psalter_Pahlavi",
- "Phlp",
- "Rejang",
- "Rjng",
- "Runic",
- "Runr",
- "Samaritan",
- "Samr",
- "Saurashtra",
- "Saur",
- "Sharada",
- "Shrd",
- "Shavian",
- "Shaw",
- "Siddham",
- "Sidd",
- "SignWriting",
- "Sgnw",
- "Sinhala",
- "Sinh",
- "Sora_Sompeng",
- "Sora",
- "Soyombo",
- "Soyo",
- "Sundanese",
- "Sund",
- "Syloti_Nagri",
- "Sylo",
- "Syriac",
- "Syrc",
- "Tagalog",
- "Tglg",
- "Tagbanwa",
- "Tagb",
- "Tai_Le",
- "Tale",
- "Tai_Tham",
- "Lana",
- "Tai_Viet",
- "Tavt",
- "Takri",
- "Takr",
- "Tamil",
- "Taml",
- "Tangut",
- "Tang",
- "Telugu",
- "Telu",
- "Thaana",
- "Thaa",
- "Thai",
- "Tibetan",
- "Tibt",
- "Tifinagh",
- "Tfng",
- "Tirhuta",
- "Tirh",
- "Ugaritic",
- "Ugar",
- "Vai",
- "Vaii",
- "Warang_Citi",
- "Wara",
- "Yi",
- "Yiii",
- "Zanabazar_Square",
- "Zanb"
- ]
+import {wordsRegexp} from "./util.js"
+
+// This file contains Unicode properties extracted from the ECMAScript
+// specification. The lists are extracted like so:
+// $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText)
+
+// #table-binary-unicode-properties
+const ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS"
+const unicodeBinaryProperties = {
+ 9: ecma9BinaryProperties,
+ 10: ecma9BinaryProperties + " Extended_Pictographic"
+}
+
+// #table-unicode-general-category-values
+const unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu"
+
+// #table-unicode-script-values
+const ecma9ScriptValues = "Adlam Adlm Ahom Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb"
+const unicodeScriptValues = {
+ 9: ecma9ScriptValues,
+ 10: ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd"
+}
+
+const data = {}
+function buildUnicodeData(ecmaVersion) {
+ let d = data[ecmaVersion] = {
+ binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
+ nonBinary: {
+ General_Category: wordsRegexp(unicodeGeneralCategoryValues),
+ Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
+ }
+ }
+ d.nonBinary.Script_Extensions = d.nonBinary.Script
+
+ d.nonBinary.gc = d.nonBinary.General_Category
+ d.nonBinary.sc = d.nonBinary.Script
+ d.nonBinary.scx = d.nonBinary.Script_Extensions
}
-Array.prototype.push.apply(data.$LONE, data.General_Category)
-data.gc = data.General_Category
-data.sc = data.Script_Extensions = data.scx = data.Script
+buildUnicodeData(9)
+buildUnicodeData(10)
export default data
diff --git a/acorn/src/util.js b/acorn/src/util.js
index 9f548a1..a2ac1f1 100644
--- a/acorn/src/util.js
+++ b/acorn/src/util.js
@@ -9,3 +9,7 @@ export function has(obj, propName) {
export const isArray = Array.isArray || ((obj) => (
toString.call(obj) === "[object Array]"
))
+
+export function wordsRegexp(words) {
+ return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$")
+}
diff --git a/acorn/src/whitespace.js b/acorn/src/whitespace.js
index cf8d913..f48f2f2 100644
--- a/acorn/src/whitespace.js
+++ b/acorn/src/whitespace.js
@@ -8,6 +8,6 @@ export function isNewLine(code, ecma2019String) {
return code === 10 || code === 13 || (!ecma2019String && (code === 0x2028 || code === 0x2029))
}
-export const nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/
+export const nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/
export const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g
diff --git a/bin/run_test262.js b/bin/run_test262.js
deleted file mode 100644
index 1c6f885..0000000
--- a/bin/run_test262.js
+++ /dev/null
@@ -1,26 +0,0 @@
-const fs = require("fs")
-const path = require("path")
-const run = require("test262-parser-runner")
-const parse = require("../acorn").parse
-
-const unsupportedFeatures = [
- "BigInt",
- "class-fields-private",
- "class-fields-public",
- "class-methods-private",
- "class-static-fields-private",
- "class-static-fields-public",
- "class-static-methods-private",
- "dynamic-import",
- "export-star-as-namespace-from-module",
- "numeric-separator-literal"
-];
-
-run(
- (content, {sourceType}) => parse(content, {sourceType, ecmaVersion: 10}),
- {
- testsDirectory: path.dirname(require.resolve("test262/package.json")),
- skip: test => (test.attrs.features && unsupportedFeatures.some(f => test.attrs.features.includes(f))),
- whitelist: fs.readFileSync("./bin/test262.whitelist", "utf8").split("\n").filter(v => v)
- }
-)
diff --git a/bin/test262.whitelist b/bin/test262.whitelist
deleted file mode 100644
index 37854ee..0000000
--- a/bin/test262.whitelist
+++ /dev/null
@@ -1,276 +0,0 @@
-built-ins/RegExp/property-escapes/generated/Extended_Pictographic.js (default)
-built-ins/RegExp/property-escapes/generated/Extended_Pictographic.js (strict mode)
-built-ins/RegExp/property-escapes/generated/Script_-_Dogra.js (default)
-built-ins/RegExp/property-escapes/generated/Script_-_Dogra.js (strict mode)
-built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Dogra.js (default)
-built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Dogra.js (strict mode)
-built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Gunjala_Gondi.js (default)
-built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Gunjala_Gondi.js (strict mode)
-built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Hanifi_Rohingya.js (default)
-built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Hanifi_Rohingya.js (strict mode)
-built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Makasar.js (default)
-built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Makasar.js (strict mode)
-built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Medefaidrin.js (default)
-built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Medefaidrin.js (strict mode)
-built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Old_Sogdian.js (default)
-built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Old_Sogdian.js (strict mode)
-built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Sogdian.js (default)
-built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Sogdian.js (strict mode)
-built-ins/RegExp/property-escapes/generated/Script_-_Gunjala_Gondi.js (default)
-built-ins/RegExp/property-escapes/generated/Script_-_Gunjala_Gondi.js (strict mode)
-built-ins/RegExp/property-escapes/generated/Script_-_Hanifi_Rohingya.js (default)
-built-ins/RegExp/property-escapes/generated/Script_-_Hanifi_Rohingya.js (strict mode)
-built-ins/RegExp/property-escapes/generated/Script_-_Makasar.js (default)
-built-ins/RegExp/property-escapes/generated/Script_-_Makasar.js (strict mode)
-built-ins/RegExp/property-escapes/generated/Script_-_Medefaidrin.js (default)
-built-ins/RegExp/property-escapes/generated/Script_-_Medefaidrin.js (strict mode)
-built-ins/RegExp/property-escapes/generated/Script_-_Old_Sogdian.js (default)
-built-ins/RegExp/property-escapes/generated/Script_-_Old_Sogdian.js (strict mode)
-built-ins/RegExp/property-escapes/generated/Script_-_Sogdian.js (default)
-built-ins/RegExp/property-escapes/generated/Script_-_Sogdian.js (strict mode)
-language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
-language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
-language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-class-declaration.js (default)
-language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-function-declaration.js (default)
-language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
-language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js (default)
-language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
-language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
-language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-class-declaration.js (default)
-language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-function-declaration.js (default)
-language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
-language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-var-declaration.js (default)
-language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
-language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
-language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-class-declaration.js (default)
-language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-const-declaration.js (default)
-language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-const-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-function-declaration.js (default)
-language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
-language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-let-declaration.js (default)
-language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-let-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-var-declaration.js (default)
-language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-class-declaration.js (default)
-language/block-scope/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
-language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
-language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-class-declaration.js (default)
-language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
-language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration.js (default)
-language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration-nested-in-function.js (default)
-language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration-nested-in-function.js (strict mode)
-language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
-language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
-language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-class-declaration.js (default)
-language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-function-declaration.js (default)
-language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
-language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-var-declaration.js (default)
-language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-class-declaration.js (default)
-language/block-scope/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
-language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
-language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-class-declaration.js (default)
-language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-function-declaration.js (default)
-language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
-language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
-language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
-language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js (default)
-language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js (strict mode)
-language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js (default)
-language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js (strict mode)
-language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js (default)
-language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js (strict mode)
-language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js (default)
-language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js (strict mode)
-language/expressions/class/class-name-ident-let-escaped.js (default)
-language/expressions/class/class-name-ident-let.js (default)
-language/expressions/class/class-name-ident-static-escaped.js (default)
-language/expressions/class/class-name-ident-static.js (default)
-language/expressions/class/class-name-ident-yield-escaped.js (default)
-language/expressions/class/class-name-ident-yield.js (default)
-language/expressions/class/method-param-dflt-yield.js (default)
-language/expressions/class/static-method-param-dflt-yield.js (default)
-language/expressions/object/method-definition/early-errors-object-method-duplicate-parameters.js (default)
-language/expressions/object/prop-def-invalid-async-prefix.js (default)
-language/expressions/object/prop-def-invalid-async-prefix.js (strict mode)
-language/expressions/yield/in-iteration-stmt.js (default)
-language/expressions/yield/in-iteration-stmt.js (strict mode)
-language/expressions/yield/star-in-iteration-stmt.js (default)
-language/expressions/yield/star-in-iteration-stmt.js (strict mode)
-language/module-code/early-export-global.js (default)
-language/module-code/early-export-global.js (strict mode)
-language/module-code/early-export-unresolvable.js (default)
-language/module-code/early-export-unresolvable.js (strict mode)
-language/statements/class/class-name-ident-let-escaped.js (default)
-language/statements/class/class-name-ident-let.js (default)
-language/statements/class/class-name-ident-static-escaped.js (default)
-language/statements/class/class-name-ident-static.js (default)
-language/statements/class/class-name-ident-yield-escaped.js (default)
-language/statements/class/class-name-ident-yield.js (default)
-language/statements/class/definition/early-errors-class-method-arguments-in-formal-parameters.js (default)
-language/statements/class/definition/early-errors-class-method-duplicate-parameters.js (default)
-language/statements/class/definition/early-errors-class-method-eval-in-formal-parameters.js (default)
-language/statements/class/definition/methods-gen-yield-as-function-expression-binding-identifier.js (default)
-language/statements/class/definition/methods-gen-yield-as-identifier-in-nested-function.js (default)
-language/statements/class/method-param-yield.js (default)
-language/statements/class/static-method-param-yield.js (default)
-language/statements/class/strict-mode/with.js (default)
-language/statements/class/syntax/early-errors/class-definition-evaluation-block-duplicate-binding.js (default)
-language/statements/class/syntax/early-errors/class-definition-evaluation-block-duplicate-binding.js (strict mode)
-language/statements/class/syntax/early-errors/class-definition-evaluation-scriptbody-duplicate-binding.js (default)
-language/statements/class/syntax/early-errors/class-definition-evaluation-scriptbody-duplicate-binding.js (strict mode)
-language/statements/const/syntax/const-declaring-let-split-across-two-lines.js (default)
-language/statements/for-await-of/let-block-with-newline.js (default)
-language/statements/for-await-of/let-identifier-with-newline.js (default)
-language/statements/for/head-let-bound-names-in-stmt.js (default)
-language/statements/for/head-let-bound-names-in-stmt.js (strict mode)
-language/statements/for-in/head-const-bound-names-in-stmt.js (default)
-language/statements/for-in/head-const-bound-names-in-stmt.js (strict mode)
-language/statements/for-in/head-const-bound-names-let.js (default)
-language/statements/for-in/head-let-bound-names-in-stmt.js (default)
-language/statements/for-in/head-let-bound-names-in-stmt.js (strict mode)
-language/statements/for-in/head-let-bound-names-let.js (default)
-language/statements/for-in/let-block-with-newline.js (default)
-language/statements/for-in/let-identifier-with-newline.js (default)
-language/statements/for/let-block-with-newline.js (default)
-language/statements/for/let-identifier-with-newline.js (default)
-language/statements/for-of/head-const-bound-names-in-stmt.js (default)
-language/statements/for-of/head-const-bound-names-in-stmt.js (strict mode)
-language/statements/for-of/head-const-bound-names-let.js (default)
-language/statements/for-of/head-let-bound-names-in-stmt.js (default)
-language/statements/for-of/head-let-bound-names-in-stmt.js (strict mode)
-language/statements/for-of/head-let-bound-names-let.js (default)
-language/statements/for-of/let-block-with-newline.js (default)
-language/statements/for-of/let-identifier-with-newline.js (default)
-language/statements/if/if-gen-else-gen.js (default)
-language/statements/if/if-gen-else-stmt.js (default)
-language/statements/if/if-gen-no-else.js (default)
-language/statements/if/if-stmt-else-gen.js (default)
-language/statements/if/labelled-fn-stmt-first.js (default)
-language/statements/if/labelled-fn-stmt-lone.js (default)
-language/statements/if/labelled-fn-stmt-second.js (default)
-language/statements/if/let-block-with-newline.js (default)
-language/statements/if/let-identifier-with-newline.js (default)
-language/statements/labeled/let-block-with-newline.js (default)
-language/statements/labeled/let-identifier-with-newline.js (default)
-language/statements/let/syntax/identifier-let-disallowed-as-boundname.js (default)
-language/statements/let/syntax/let-let-declaration-split-across-two-lines.js (default)
-language/statements/let/syntax/let-let-declaration-with-initializer-split-across-two-lines.js (default)
-language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
-language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
-language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-class-declaration.js (default)
-language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-function-declaration.js (default)
-language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
-language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js (default)
-language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
-language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
-language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-class-declaration.js (default)
-language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-function-declaration.js (default)
-language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
-language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-var-declaration.js (default)
-language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
-language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
-language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-class-declaration.js (default)
-language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-const-declaration.js (default)
-language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-const-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-function-declaration.js (default)
-language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
-language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-let-declaration.js (default)
-language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-let-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-var-declaration.js (default)
-language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-class-declaration.js (default)
-language/statements/switch/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
-language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
-language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-class-declaration.js (default)
-language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
-language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration.js (default)
-language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
-language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
-language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-class-declaration.js (default)
-language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-function-declaration.js (default)
-language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
-language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-var-declaration.js (default)
-language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-class-declaration.js (default)
-language/statements/switch/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
-language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
-language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-class-declaration.js (default)
-language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-function-declaration.js (default)
-language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
-language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
-language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
-language/statements/try/early-catch-var.js (default)
-language/statements/try/early-catch-var.js (strict mode)
-language/statements/while/let-block-with-newline.js (default)
-language/statements/while/let-identifier-with-newline.js (default)
-language/statements/with/let-block-with-newline.js (default)
-language/statements/with/let-identifier-with-newline.js (default)
-language/white-space/mongolian-vowel-separator.js (default)
-language/white-space/mongolian-vowel-separator.js (strict mode)
diff --git a/module-node-acorn-import-meta/.gitignore b/module-node-acorn-import-meta/.gitignore
deleted file mode 100644
index c2658d7..0000000
--- a/module-node-acorn-import-meta/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-node_modules/
diff --git a/module-node-acorn-jsx/test/tests-jsx.js b/module-node-acorn-jsx/test/tests-jsx.js
deleted file mode 100644
index f8e927b..0000000
--- a/module-node-acorn-jsx/test/tests-jsx.js
+++ /dev/null
@@ -1,3960 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-var fbTestFixture = {
- // Taken and adapted from esprima-fb/fbtest.js.
- 'JSX': {
- '<a />': {
- type: "ExpressionStatement",
- expression: {
- type: "JSXElement",
- openingElement: {
- type: "JSXOpeningElement",
- name: {
- type: "JSXIdentifier",
- name: "a",
- range: [1, 2],
- loc: {
- start: { line: 1, column: 1 },
- end: { line: 1, column: 2 }
- }
- },
- selfClosing: true,
- attributes: [],
- range: [0, 5],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 5 }
- }
- },
- closingElement: null,
- children: [],
- range: [0, 5],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 5 }
- }
- },
- range: [0, 5],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 5 }
- }
- },
-
- '<n:a n:v />': {
- type: 'ExpressionStatement',
- expression: {
- type: 'JSXElement',
- openingElement: {
- type: 'JSXOpeningElement',
- name: {
- type: 'JSXNamespacedName',
- namespace: {
- type: 'JSXIdentifier',
- name: 'n',
- range: [1, 2],
- loc: {
- start: { line: 1, column: 1 },
- end: { line: 1, column: 2 }
- }
- },
- name: {
- type: 'JSXIdentifier',
- name: 'a',
- range: [3, 4],
- loc: {
- start: { line: 1, column: 3 },
- end: { line: 1, column: 4 }
- }
- },
- range: [1, 4],
- loc: {
- start: { line: 1, column: 1 },
- end: { line: 1, column: 4 }
- }
- },
- selfClosing: true,
- attributes: [{
- type: 'JSXAttribute',
- name: {
- type: 'JSXNamespacedName',
- namespace: {
- type: 'JSXIdentifier',
- name: 'n',
- range: [5, 6],
- loc: {
- start: { line: 1, column: 5 },
- end: { line: 1, column: 6 }
- }
- },
- name: {
- type: 'JSXIdentifier',
- name: 'v',
- range: [7, 8],
- loc: {
- start: { line: 1, column: 7 },
- end: { line: 1, column: 8 }
- }
- },
- range: [5, 8],
- loc: {
- start: { line: 1, column: 5 },
- end: { line: 1, column: 8 }
- }
- },
- value: null,
- range: [5, 8],
- loc: {
- start: { line: 1, column: 5 },
- end: { line: 1, column: 8 }
- }
- }],
- range: [0, 11],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 11 }
- }
- },
- closingElement: null,
- children: [],
- range: [0, 11],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 11 }
- }
- },
- range: [0, 11],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 11 }
- }
- },
-
- '<a n:foo="bar"> {value} <b><c /></b></a>': {
- type: 'ExpressionStatement',
- expression: {
- type: 'JSXElement',
- openingElement: {
- type: 'JSXOpeningElement',
- name: {
- type: 'JSXIdentifier',
- name: 'a',
- range: [1, 2],
- loc: {
- start: { line: 1, column: 1 },
- end: { line: 1, column: 2 }
- }
- },
- selfClosing: false,
- attributes: [{
- type: 'JSXAttribute',
- name: {
- type: 'JSXNamespacedName',
- namespace: {
- type: 'JSXIdentifier',
- name: 'n',
- range: [3, 4],
- loc: {
- start: { line: 1, column: 3 },
- end: { line: 1, column: 4 }
- }
- },
- name: {
- type: 'JSXIdentifier',
- name: 'foo',
- range: [5, 8],
- loc: {
- start: { line: 1, column: 5 },
- end: { line: 1, column: 8 }
- }
- },
- range: [3, 8],
- loc: {
- start: { line: 1, column: 3 },
- end: { line: 1, column: 8 }
- }
- },
- value: {
- type: 'Literal',
- value: 'bar',
- raw: '"bar"',
- range: [9, 14],
- loc: {
- start: { line: 1, column: 9 },
- end: { line: 1, column: 14 }
- }
- },
- range: [3, 14],
- loc: {
- start: { line: 1, column: 3 },
- end: { line: 1, column: 14 }
- }
- }],
- range: [0, 15],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 15 }
- }
- },
- closingElement: {
- type: 'JSXClosingElement',
- name: {
- type: 'JSXIdentifier',
- name: 'a',
- range: [38, 39],
- loc: {
- start: { line: 1, column: 38 },
- end: { line: 1, column: 39 }
- }
- },
- range: [36, 40],
- loc: {
- start: { line: 1, column: 36 },
- end: { line: 1, column: 40 }
- }
- },
- children: [{
- type: 'JSXText',
- value: ' ',
- raw: ' ',
- range: [15, 16],
- loc: {
- start: { line: 1, column: 15 },
- end: { line: 1, column: 16 }
- }
- }, {
- type: 'JSXExpressionContainer',
- expression: {
- type: 'Identifier',
- name: 'value',
- range: [17, 22],
- loc: {
- start: { line: 1, column: 17 },
- end: { line: 1, column: 22 }
- }
- },
- range: [16, 23],
- loc: {
- start: { line: 1, column: 16 },
- end: { line: 1, column: 23 }
- }
- }, {
- type: 'JSXText',
- value: ' ',
- raw: ' ',
- range: [23, 24],
- loc: {
- start: { line: 1, column: 23 },
- end: { line: 1, column: 24 }
- }
- }, {
- type: 'JSXElement',
- openingElement: {
- type: 'JSXOpeningElement',
- name: {
- type: 'JSXIdentifier',
- name: 'b',
- range: [25, 26],
- loc: {
- start: { line: 1, column: 25 },
- end: { line: 1, column: 26 }
- }
- },
- selfClosing: false,
- attributes: [],
- range: [24, 27],
- loc: {
- start: { line: 1, column: 24 },
- end: { line: 1, column: 27 }
- }
- },
- closingElement: {
- type: 'JSXClosingElement',
- name: {
- type: 'JSXIdentifier',
- name: 'b',
- range: [34, 35],
- loc: {
- start: { line: 1, column: 34 },
- end: { line: 1, column: 35 }
- }
- },
- range: [32, 36],
- loc: {
- start: { line: 1, column: 32 },
- end: { line: 1, column: 36 }
- }
- },
- children: [{
- type: 'JSXElement',
- openingElement: {
- type: 'JSXOpeningElement',
- name: {
- type: 'JSXIdentifier',
- name: 'c',
- range: [28, 29],
- loc: {
- start: { line: 1, column: 28 },
- end: { line: 1, column: 29 }
- }
- },
- selfClosing: true,
- attributes: [],
- range: [27, 32],
- loc: {
- start: { line: 1, column: 27 },
- end: { line: 1, column: 32 }
- }
- },
- closingElement: null,
- children: [],
- range: [27, 32],
- loc: {
- start: { line: 1, column: 27 },
- end: { line: 1, column: 32 }
- }
- }],
- range: [24, 36],
- loc: {
- start: { line: 1, column: 24 },
- end: { line: 1, column: 36 }
- }
- }],
- range: [0, 40],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 40 }
- }
- },
- range: [0, 40],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 40 }
- }
- },
-
- '<a b={" "} c=" " d="&amp;" e="&ampr;" />': {
- type: "ExpressionStatement",
- expression: {
- type: "JSXElement",
- openingElement: {
- type: "JSXOpeningElement",
- name: {
- type: "JSXIdentifier",
- name: "a",
- range: [1, 2]
- },
- selfClosing: true,
- attributes: [
- {
- type: "JSXAttribute",
- name: {
- type: "JSXIdentifier",
- name: "b",
- range: [3, 4]
- },
- value: {
- type: "JSXExpressionContainer",
- expression: {
- type: "Literal",
- value: " ",
- raw: "\" \"",
- range: [6, 9]
- },
- range: [5, 10]
- },
- range: [3, 10]
- },
- {
- type: "JSXAttribute",
- name: {
- type: "JSXIdentifier",
- name: "c",
- range: [11, 12]
- },
- value: {
- type: "Literal",
- value: " ",
- raw: "\" \"",
- range: [13, 16]
- },
- range: [11, 16]
- },
- {
- type: "JSXAttribute",
- name: {
- type: "JSXIdentifier",
- name: "d",
- range: [17, 18]
- },
- value: {
- type: "Literal",
- value: "&",
- raw: "\"&amp;\"",
- range: [19, 26]
- },
- range: [17, 26]
- },
- {
- type: "JSXAttribute",
- name: {
- type: "JSXIdentifier",
- name: "e",
- range: [27, 28]
- },
- value: {
- type: "Literal",
- value: "&ampr;",
- raw: "\"&ampr;\"",
- range: [29, 37]
- },
- range: [27, 37]
- }
- ],
- range: [0, 40]
- },
- closingElement: null,
- children: [],
- range: [0, 40]
- },
- range: [0, 40]
- },
-
- '<a\n/>': {
- type: "ExpressionStatement",
- expression: {
- type: "JSXElement",
- openingElement: {
- type: "JSXOpeningElement",
- name: {
- type: "JSXIdentifier",
- name: "a",
- range: [
- 1,
- 2
- ],
- loc: {
- start: {
- line: 1,
- column: 1
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- selfClosing: true,
- attributes: [],
- range: [
- 0,
- 5
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 2
- }
- }
- },
- closingElement: null,
- children: [],
- range: [
- 0,
- 5
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 2
- }
- }
- },
- range: [
- 0,
- 5
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 2
- }
- }
- },
-
- '<日本語></日本語>': {
- type: "ExpressionStatement",
- expression: {
- type: "JSXElement",
- openingElement: {
- type: "JSXOpeningElement",
- name: {
- type: "JSXIdentifier",
- name: "日本語",
- range: [
- 1,
- 4
- ],
- loc: {
- start: {
- line: 1,
- column: 1
- },
- end: {
- line: 1,
- column: 4
- }
- }
- },
- selfClosing: false,
- attributes: [],
- range: [
- 0,
- 5
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- closingElement: {
- type: "JSXClosingElement",
- name: {
- type: "JSXIdentifier",
- name: "日本語",
- range: [
- 7,
- 10
- ],
- loc: {
- start: {
- line: 1,
- column: 7
- },
- end: {
- line: 1,
- column: 10
- }
- }
- },
- range: [
- 5,
- 11
- ],
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- children: [],
- range: [
- 0,
- 11
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- range: [
- 0,
- 11
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
-
- '<AbC-def\n test="&#x0026;&#38;">\nbar\nbaz\n</AbC-def>': {
- type: "ExpressionStatement",
- expression: {
- type: "JSXElement",
- openingElement: {
- type: "JSXOpeningElement",
- name: {
- type: "JSXIdentifier",
- name: "AbC-def",
- range: [
- 1,
- 8
- ],
- loc: {
- start: {
- line: 1,
- column: 1
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- selfClosing: false,
- attributes: [
- {
- type: "JSXAttribute",
- name: {
- type: "JSXIdentifier",
- name: "test",
- range: [
- 11,
- 15
- ],
- loc: {
- start: {
- line: 2,
- column: 2
- },
- end: {
- line: 2,
- column: 6
- }
- }
- },
- value: {
- type: "Literal",
- value: "&&",
- raw: "\"&#x0026;&#38;\"",
- range: [
- 16,
- 31
- ],
- loc: {
- start: {
- line: 2,
- column: 7
- },
- end: {
- line: 2,
- column: 22
- }
- }
- },
- range: [
- 11,
- 31
- ],
- loc: {
- start: {
- line: 2,
- column: 2
- },
- end: {
- line: 2,
- column: 22
- }
- }
- }
- ],
- range: [
- 0,
- 32
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 23
- }
- }
- },
- closingElement: {
- type: "JSXClosingElement",
- name: {
- type: "JSXIdentifier",
- name: "AbC-def",
- range: [
- 43,
- 50
- ],
- loc: {
- start: {
- line: 5,
- column: 2
- },
- end: {
- line: 5,
- column: 9
- }
- }
- },
- range: [
- 41,
- 51
- ],
- loc: {
- start: {
- line: 5,
- column: 0
- },
- end: {
- line: 5,
- column: 10
- }
- }
- },
- children: [
- {
- type: "JSXText",
- value: "\nbar\nbaz\n",
- raw: "\nbar\nbaz\n",
- range: [
- 32,
- 41
- ],
- loc: {
- start: {
- line: 2,
- column: 23
- },
- end: {
- line: 5,
- column: 0
- }
- }
- }
- ],
- range: [
- 0,
- 51
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 5,
- column: 10
- }
- }
- },
- range: [
- 0,
- 51
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 5,
- column: 10
- }
- }
- },
-
- '<a b={x ? <c /> : <d />} />': {
- type: "ExpressionStatement",
- expression: {
- type: "JSXElement",
- openingElement: {
- type: "JSXOpeningElement",
- name: {
- type: "JSXIdentifier",
- name: "a",
- range: [
- 1,
- 2
- ],
- loc: {
- start: {
- line: 1,
- column: 1
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- selfClosing: true,
- attributes: [
- {
- type: "JSXAttribute",
- name: {
- type: "JSXIdentifier",
- name: "b",
- range: [
- 3,
- 4
- ],
- loc: {
- start: {
- line: 1,
- column: 3
- },
- end: {
- line: 1,
- column: 4
- }
- }
- },
- value: {
- type: "JSXExpressionContainer",
- expression: {
- type: "ConditionalExpression",
- test: {
- type: "Identifier",
- name: "x",
- range: [
- 6,
- 7
- ],
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- consequent: {
- type: "JSXElement",
- openingElement: {
- type: "JSXOpeningElement",
- name: {
- type: "JSXIdentifier",
- name: "c",
- range: [
- 11,
- 12
- ],
- loc: {
- start: {
- line: 1,
- column: 11
- },
- end: {
- line: 1,
- column: 12
- }
- }
- },
- selfClosing: true,
- attributes: [],
- range: [
- 10,
- 15
- ],
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 15
- }
- }
- },
- closingElement: null,
- children: [],
- range: [
- 10,
- 15
- ],
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 15
- }
- }
- },
- alternate: {
- type: "JSXElement",
- openingElement: {
- type: "JSXOpeningElement",
- name: {
- type: "JSXIdentifier",
- name: "d",
- range: [
- 19,
- 20
- ],
- loc: {
- start: {
- line: 1,
- column: 19
- },
- end: {
- line: 1,
- column: 20
- }
- }
- },
- selfClosing: true,
- attributes: [],
- range: [
- 18,
- 23
- ],
- loc: {
- start: {
- line: 1,
- column: 18
- },
- end: {
- line: 1,
- column: 23
- }
- }
- },
- closingElement: null,
- children: [],
- range: [
- 18,
- 23
- ],
- loc: {
- start: {
- line: 1,
- column: 18
- },
- end: {
- line: 1,
- column: 23
- }
- }
- },
- range: [
- 6,
- 23
- ],
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 23
- }
- }
- },
- range: [
- 5,
- 24
- ],
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 24
- }
- }
- },
- range: [
- 3,
- 24
- ],
- loc: {
- start: {
- line: 1,
- column: 3
- },
- end: {
- line: 1,
- column: 24
- }
- }
- }
- ],
- range: [
- 0,
- 27
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 27
- }
- }
- },
- closingElement: null,
- children: [],
- range: [
- 0,
- 27
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 27
- }
- }
- },
- range: [
- 0,
- 27
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 27
- }
- }
- },
-
- '<a>{}</a>': {
- type: 'ExpressionStatement',
- expression: {
- type: 'JSXElement',
- openingElement: {
- type: 'JSXOpeningElement',
- name: {
- type: 'JSXIdentifier',
- name: 'a',
- range: [1, 2],
- loc: {
- start: { line: 1, column: 1 },
- end: { line: 1, column: 2 }
- }
- },
- selfClosing: false,
- attributes: [],
- range: [0, 3],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 3 }
- }
- },
- closingElement: {
- type: 'JSXClosingElement',
- name: {
- type: 'JSXIdentifier',
- name: 'a',
- range: [7, 8],
- loc: {
- start: { line: 1, column: 7 },
- end: { line: 1, column: 8 }
- }
- },
- range: [5, 9],
- loc: {
- start: { line: 1, column: 5 },
- end: { line: 1, column: 9 }
- }
- },
- children: [{
- type: 'JSXExpressionContainer',
- expression: {
- type: 'JSXEmptyExpression',
- range: [4, 4],
- loc: {
- start: { line: 1, column: 4 },
- end: { line: 1, column: 4 }
- }
- },
- range: [3, 5],
- loc: {
- start: { line: 1, column: 3 },
- end: { line: 1, column: 5 }
- }
- }],
- range: [0, 9],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 9 }
- }
- },
- range: [0, 9],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 9 }
- }
- },
-
- '<a>{/* this is a comment */}</a>': {
- type: 'ExpressionStatement',
- expression: {
- type: 'JSXElement',
- openingElement: {
- type: 'JSXOpeningElement',
- name: {
- type: 'JSXIdentifier',
- name: 'a',
- range: [1, 2],
- loc: {
- start: { line: 1, column: 1 },
- end: { line: 1, column: 2 }
- }
- },
- selfClosing: false,
- attributes: [],
- range: [0, 3],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 3 }
- }
- },
- closingElement: {
- type: 'JSXClosingElement',
- name: {
- type: 'JSXIdentifier',
- name: 'a',
- range: [30, 31],
- loc: {
- start: { line: 1, column: 30 },
- end: { line: 1, column: 31 }
- }
- },
- range: [28, 32],
- loc: {
- start: { line: 1, column: 28 },
- end: { line: 1, column: 32 }
- }
- },
- children: [{
- type: 'JSXExpressionContainer',
- expression: {
- type: 'JSXEmptyExpression',
- range: [4, 27],
- loc: {
- start: { line: 1, column: 4 },
- end: { line: 1, column: 27 }
- }
- },
- range: [3, 28],
- loc: {
- start: { line: 1, column: 3 },
- end: { line: 1, column: 28 }
- }
- }],
- range: [0, 32],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 32 }
- }
- },
- range: [0, 32],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 32 }
- }
- },
-
- '<div>@test content</div>': {
- type: 'ExpressionStatement',
- expression: {
- type: 'JSXElement',
- openingElement: {
- type: 'JSXOpeningElement',
- name: {
- type: 'JSXIdentifier',
- name: 'div',
- range: [1, 4],
- loc: {
- start: { line: 1, column: 1 },
- end: { line: 1, column: 4 }
- }
- },
- selfClosing: false,
- attributes: [],
- range: [0, 5],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 5 }
- }
- },
- closingElement: {
- type: 'JSXClosingElement',
- name: {
- type: 'JSXIdentifier',
- name: 'div',
- range: [20, 23],
- loc: {
- start: { line: 1, column: 20 },
- end: { line: 1, column: 23 }
- }
- },
- range: [18, 24],
- loc: {
- start: { line: 1, column: 18 },
- end: { line: 1, column: 24 }
- }
- },
- children: [{
- type: 'JSXText',
- value: '@test content',
- raw: '@test content',
- range: [5, 18],
- loc: {
- start: { line: 1, column: 5 },
- end: { line: 1, column: 18 }
- }
- }],
- range: [0, 24],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 24 }
- }
- },
- range: [0, 24],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 24 }
- }
- },
-
- '<div><br />7x invalid-js-identifier</div>': {
- type: 'ExpressionStatement',
- expression: {
- type: 'JSXElement',
- openingElement: {
- type: 'JSXOpeningElement',
- name: {
- type: 'JSXIdentifier',
- name: 'div',
- range: [
- 1,
- 4
- ],
- loc: {
- start: {
- line: 1,
- column: 1
- },
- end: {
- line: 1,
- column: 4
- }
- }
- },
- selfClosing: false,
- attributes: [],
- range: [
- 0,
- 5
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- closingElement: {
- type: 'JSXClosingElement',
- name: {
- type: 'JSXIdentifier',
- name: 'div',
- range: [
- 37,
- 40
- ],
- loc: {
- start: {
- line: 1,
- column: 37
- },
- end: {
- line: 1,
- column: 40
- }
- }
- },
- range: [
- 35,
- 41
- ],
- loc: {
- start: {
- line: 1,
- column: 35
- },
- end: {
- line: 1,
- column: 41
- }
- }
- },
- children: [{
- type: 'JSXElement',
- openingElement: {
- type: 'JSXOpeningElement',
- name: {
- type: 'JSXIdentifier',
- name: 'br',
- range: [
- 6,
- 8
- ],
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- selfClosing: true,
- attributes: [],
- range: [
- 5,
- 11
- ],
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- closingElement: null,
- children: [],
- range: [
- 5,
- 11
- ],
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 11
- }
- }
- }, {
- type: 'JSXText',
- value: '7x invalid-js-identifier',
- raw: '7x invalid-js-identifier',
- range: [
- 11,
- 35
- ],
- loc: {
- start: {
- line: 1,
- column: 11
- },
- end: {
- line: 1,
- column: 35
- }
- }
- }],
- range: [
- 0,
- 41
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 41
- }
- }
- },
- range: [
- 0,
- 41
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 41
- }
- }
- },
-
- '<LeftRight left=<a /> right=<b>monkeys /> gorillas</b> />': {
- "type": "ExpressionStatement",
- "expression": {
- "type": "JSXElement",
- "openingElement": {
- "type": "JSXOpeningElement",
- "name": {
- "type": "JSXIdentifier",
- "name": "LeftRight",
- "range": [
- 1,
- 10
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 1
- },
- "end": {
- "line": 1,
- "column": 10
- }
- }
- },
- "selfClosing": true,
- "attributes": [
- {
- "type": "JSXAttribute",
- "name": {
- "type": "JSXIdentifier",
- "name": "left",
- "range": [
- 11,
- 15
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 11
- },
- "end": {
- "line": 1,
- "column": 15
- }
- }
- },
- "value": {
- "type": "JSXElement",
- "openingElement": {
- "type": "JSXOpeningElement",
- "name": {
- "type": "JSXIdentifier",
- "name": "a",
- "range": [
- 17,
- 18
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 17
- },
- "end": {
- "line": 1,
- "column": 18
- }
- }
- },
- "selfClosing": true,
- "attributes": [],
- "range": [
- 16,
- 21
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 16
- },
- "end": {
- "line": 1,
- "column": 21
- }
- }
- },
- closingElement: null,
- "children": [],
- "range": [
- 16,
- 21
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 16
- },
- "end": {
- "line": 1,
- "column": 21
- }
- }
- },
- "range": [
- 11,
- 21
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 11
- },
- "end": {
- "line": 1,
- "column": 21
- }
- }
- },
- {
- "type": "JSXAttribute",
- "name": {
- "type": "JSXIdentifier",
- "name": "right",
- "range": [
- 22,
- 27
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 22
- },
- "end": {
- "line": 1,
- "column": 27
- }
- }
- },
- "value": {
- "type": "JSXElement",
- "openingElement": {
- "type": "JSXOpeningElement",
- "name": {
- "type": "JSXIdentifier",
- "name": "b",
- "range": [
- 29,
- 30
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 29
- },
- "end": {
- "line": 1,
- "column": 30
- }
- }
- },
- "selfClosing": false,
- "attributes": [],
- "range": [
- 28,
- 31
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 28
- },
- "end": {
- "line": 1,
- "column": 31
- }
- }
- },
- "closingElement": {
- "type": "JSXClosingElement",
- "name": {
- "type": "JSXIdentifier",
- "name": "b",
- "range": [
- 52,
- 53
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 52
- },
- "end": {
- "line": 1,
- "column": 53
- }
- }
- },
- "range": [
- 50,
- 54
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 50
- },
- "end": {
- "line": 1,
- "column": 54
- }
- }
- },
- "children": [
- {
- "type": "JSXText",
- "value": "monkeys /> gorillas",
- "raw": "monkeys /> gorillas",
- "range": [
- 31,
- 50
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 31
- },
- "end": {
- "line": 1,
- "column": 50
- }
- }
- }
- ],
- "range": [
- 28,
- 54
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 28
- },
- "end": {
- "line": 1,
- "column": 54
- }
- }
- },
- "range": [
- 22,
- 54
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 22
- },
- "end": {
- "line": 1,
- "column": 54
- }
- }
- }
- ],
- "range": [
- 0,
- 57
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 0
- },
- "end": {
- "line": 1,
- "column": 57
- }
- }
- },
- closingElement: null,
- "children": [],
- "range": [
- 0,
- 57
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 0
- },
- "end": {
- "line": 1,
- "column": 57
- }
- }
- },
- "range": [
- 0,
- 57
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 0
- },
- "end": {
- "line": 1,
- "column": 57
- }
- }
- },
-
- '<a.b></a.b>': {
- type: 'ExpressionStatement',
- expression: {
- type: 'JSXElement',
- openingElement: {
- type: 'JSXOpeningElement',
- name: {
- type: 'JSXMemberExpression',
- object: {
- type: 'JSXIdentifier',
- name: 'a',
- range: [1, 2],
- loc: {
- start: { line: 1, column: 1 },
- end: { line: 1, column: 2 }
- }
- },
- property: {
- type: 'JSXIdentifier',
- name: 'b',
- range: [3, 4],
- loc: {
- start: { line: 1, column: 3 },
- end: { line: 1, column: 4 }
- }
- },
- range: [1, 4],
- loc: {
- start: { line: 1, column: 1 },
- end: { line: 1, column: 4 }
- }
- },
- selfClosing: false,
- attributes: [],
- range: [0, 5],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 5 }
- }
- },
- closingElement: {
- type: 'JSXClosingElement',
- name: {
- type: 'JSXMemberExpression',
- object: {
- type: 'JSXIdentifier',
- name: 'a',
- range: [7, 8],
- loc: {
- start: { line: 1, column: 7 },
- end: { line: 1, column: 8 }
- }
- },
- property: {
- type: 'JSXIdentifier',
- name: 'b',
- range: [9, 10],
- loc: {
- start: { line: 1, column: 9 },
- end: { line: 1, column: 10 }
- }
- },
- range: [7, 10],
- loc: {
- start: { line: 1, column: 7 },
- end: { line: 1, column: 10 }
- }
- },
- range: [5, 11],
- loc: {
- start: { line: 1, column: 5 },
- end: { line: 1, column: 11 }
- }
- },
- children: [],
- range: [0, 11],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 11 }
- }
- },
- range: [0, 11],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 11 }
- }
- },
-
- '<a.b.c></a.b.c>': {
- type: 'ExpressionStatement',
- expression: {
- type: 'JSXElement',
- openingElement: {
- type: 'JSXOpeningElement',
- name: {
- type: 'JSXMemberExpression',
- object: {
- type: 'JSXMemberExpression',
- object: {
- type: 'JSXIdentifier',
- name: 'a',
- range: [1, 2],
- loc: {
- start: { line: 1, column: 1 },
- end: { line: 1, column: 2 }
- }
- },
- property: {
- type: 'JSXIdentifier',
- name: 'b',
- range: [3, 4],
- loc: {
- start: { line: 1, column: 3 },
- end: { line: 1, column: 4 }
- }
- },
- range: [1, 4],
- loc: {
- start: { line: 1, column: 1 },
- end: { line: 1, column: 4 }
- }
- },
- property: {
- type: 'JSXIdentifier',
- name: 'c',
- range: [5, 6],
- loc: {
- start: { line: 1, column: 5 },
- end: { line: 1, column: 6 }
- }
- },
- range: [1, 6],
- loc: {
- start: { line: 1, column: 1 },
- end: { line: 1, column: 6 }
- }
- },
- selfClosing: false,
- attributes: [],
- range: [0, 7],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 7 }
- }
- },
- closingElement: {
- type: 'JSXClosingElement',
- name: {
- type: 'JSXMemberExpression',
- object: {
- type: 'JSXMemberExpression',
- object: {
- type: 'JSXIdentifier',
- name: 'a',
- range: [9, 10],
- loc: {
- start: { line: 1, column: 9 },
- end: { line: 1, column: 10 }
- }
- },
- property: {
- type: 'JSXIdentifier',
- name: 'b',
- range: [11, 12],
- loc: {
- start: { line: 1, column: 11 },
- end: { line: 1, column: 12 }
- }
- },
- range: [9, 12],
- loc: {
- start: { line: 1, column: 9 },
- end: { line: 1, column: 12 }
- }
- },
- property: {
- type: 'JSXIdentifier',
- name: 'c',
- range: [13, 14],
- loc: {
- start: { line: 1, column: 13 },
- end: { line: 1, column: 14 }
- }
- },
- range: [9, 14],
- loc: {
- start: { line: 1, column: 9 },
- end: { line: 1, column: 14 }
- }
- },
- range: [7, 15],
- loc: {
- start: { line: 1, column: 7 },
- end: { line: 1, column: 15 }
- }
- },
- children: [],
- range: [0, 15],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 15 }
- }
- },
- range: [0, 15],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 15 }
- }
- },
-
- // In order to more useful parse errors, we disallow following an
- // JSXElement by a less-than symbol. In the rare case that the binary
- // operator was intended, the tag can be wrapped in parentheses:
- '(<div />) < x;': {
- type: 'ExpressionStatement',
- expression: {
- type: 'BinaryExpression',
- operator: '<',
- left: {
- type: 'JSXElement',
- openingElement: {
- type: 'JSXOpeningElement',
- name: {
- type: 'JSXIdentifier',
- name: 'div',
- range: [2, 5],
- loc: {
- start: { line: 1, column: 2 },
- end: { line: 1, column: 5 }
- }
- },
- selfClosing: true,
- attributes: [],
- range: [1, 8],
- loc: {
- start: { line: 1, column: 1 },
- end: { line: 1, column: 8 }
- }
- },
- closingElement: null,
- children: [],
- range: [1, 8],
- loc: {
- start: { line: 1, column: 1 },
- end: { line: 1, column: 8 }
- }
- },
- right: {
- type: 'Identifier',
- name: 'x',
- range: [12, 13],
- loc: {
- start: { line: 1, column: 12 },
- end: { line: 1, column: 13 }
- }
- },
- range: [0, 13],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 13 }
- }
- },
- range: [0, 14],
- loc: {
- start: { line: 1, column: 0 },
- end: { line: 1, column: 14 }
- }
- },
-
- '<div {...props} />': {
- "type": "ExpressionStatement",
- "expression": {
- "type": "JSXElement",
- "openingElement": {
- "type": "JSXOpeningElement",
- "name": {
- "type": "JSXIdentifier",
- "name": "div",
- "range": [
- 1,
- 4
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 1
- },
- "end": {
- "line": 1,
- "column": 4
- }
- }
- },
- "selfClosing": true,
- "attributes": [
- {
- "type": "JSXSpreadAttribute",
- "argument": {
- "type": "Identifier",
- "name": "props",
- "range": [
- 9,
- 14
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 9
- },
- "end": {
- "line": 1,
- "column": 14
- }
- }
- },
- "range": [
- 5,
- 15
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 5
- },
- "end": {
- "line": 1,
- "column": 15
- }
- }
- }
- ],
- "range": [
- 0,
- 18
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 0
- },
- "end": {
- "line": 1,
- "column": 18
- }
- }
- },
- closingElement: null,
- "children": [],
- "range": [
- 0,
- 18
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 0
- },
- "end": {
- "line": 1,
- "column": 18
- }
- }
- },
- "range": [
- 0,
- 18
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 0
- },
- "end": {
- "line": 1,
- "column": 18
- }
- }
- },
-
- '<div {...props} post="attribute" />': {
- "type": "ExpressionStatement",
- "expression": {
- "type": "JSXElement",
- "openingElement": {
- "type": "JSXOpeningElement",
- "name": {
- "type": "JSXIdentifier",
- "name": "div",
- "range": [
- 1,
- 4
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 1
- },
- "end": {
- "line": 1,
- "column": 4
- }
- }
- },
- "selfClosing": true,
- "attributes": [
- {
- "type": "JSXSpreadAttribute",
- "argument": {
- "type": "Identifier",
- "name": "props",
- "range": [
- 9,
- 14
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 9
- },
- "end": {
- "line": 1,
- "column": 14
- }
- }
- },
- "range": [
- 5,
- 15
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 5
- },
- "end": {
- "line": 1,
- "column": 15
- }
- }
- },
- {
- "type": "JSXAttribute",
- "name": {
- "type": "JSXIdentifier",
- "name": "post",
- "range": [
- 16,
- 20
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 16
- },
- "end": {
- "line": 1,
- "column": 20
- }
- }
- },
- "value": {
- "type": "Literal",
- "value": "attribute",
- "raw": "\"attribute\"",
- "range": [
- 21,
- 32
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 21
- },
- "end": {
- "line": 1,
- "column": 32
- }
- }
- },
- "range": [
- 16,
- 32
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 16
- },
- "end": {
- "line": 1,
- "column": 32
- }
- }
- }
- ],
- "range": [
- 0,
- 35
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 0
- },
- "end": {
- "line": 1,
- "column": 35
- }
- }
- },
- closingElement: null,
- "children": [],
- "range": [
- 0,
- 35
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 0
- },
- "end": {
- "line": 1,
- "column": 35
- }
- }
- },
- "range": [
- 0,
- 35
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 0
- },
- "end": {
- "line": 1,
- "column": 35
- }
- }
- },
-
- '<div pre="leading" pre2="attribute" {...props}></div>': {
- "type": "ExpressionStatement",
- "expression": {
- "type": "JSXElement",
- "openingElement": {
- "type": "JSXOpeningElement",
- "name": {
- "type": "JSXIdentifier",
- "name": "div",
- "range": [
- 1,
- 4
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 1
- },
- "end": {
- "line": 1,
- "column": 4
- }
- }
- },
- "selfClosing": false,
- "attributes": [
- {
- "type": "JSXAttribute",
- "name": {
- "type": "JSXIdentifier",
- "name": "pre",
- "range": [
- 5,
- 8
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 5
- },
- "end": {
- "line": 1,
- "column": 8
- }
- }
- },
- "value": {
- "type": "Literal",
- "value": "leading",
- "raw": "\"leading\"",
- "range": [
- 9,
- 18
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 9
- },
- "end": {
- "line": 1,
- "column": 18
- }
- }
- },
- "range": [
- 5,
- 18
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 5
- },
- "end": {
- "line": 1,
- "column": 18
- }
- }
- },
- {
- "type": "JSXAttribute",
- "name": {
- "type": "JSXIdentifier",
- "name": "pre2",
- "range": [
- 19,
- 23
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 19
- },
- "end": {
- "line": 1,
- "column": 23
- }
- }
- },
- "value": {
- "type": "Literal",
- "value": "attribute",
- "raw": "\"attribute\"",
- "range": [
- 24,
- 35
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 24
- },
- "end": {
- "line": 1,
- "column": 35
- }
- }
- },
- "range": [
- 19,
- 35
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 19
- },
- "end": {
- "line": 1,
- "column": 35
- }
- }
- },
- {
- "type": "JSXSpreadAttribute",
- "argument": {
- "type": "Identifier",
- "name": "props",
- "range": [
- 40,
- 45
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 40
- },
- "end": {
- "line": 1,
- "column": 45
- }
- }
- },
- "range": [
- 36,
- 46
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 36
- },
- "end": {
- "line": 1,
- "column": 46
- }
- }
- }
- ],
- "range": [
- 0,
- 47
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 0
- },
- "end": {
- "line": 1,
- "column": 47
- }
- }
- },
- "closingElement": {
- "type": "JSXClosingElement",
- "name": {
- "type": "JSXIdentifier",
- "name": "div",
- "range": [
- 49,
- 52
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 49
- },
- "end": {
- "line": 1,
- "column": 52
- }
- }
- },
- "range": [
- 47,
- 53
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 47
- },
- "end": {
- "line": 1,
- "column": 53
- }
- }
- },
- "children": [],
- "range": [
- 0,
- 53
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 0
- },
- "end": {
- "line": 1,
- "column": 53
- }
- }
- },
- "range": [
- 0,
- 53
- ],
- "loc": {
- "start": {
- "line": 1,
- "column": 0
- },
- "end": {
- "line": 1,
- "column": 53
- }
- }
- },
-
- '<A aa={aa.bb.cc} bb={bb.cc.dd}><div>{aa.b}</div></A>': {
- "type": "ExpressionStatement",
- "start": 0,
- "end": 52,
- "loc": {
- "start": {
- "line": 1,
- "column": 0
- },
- "end": {
- "line": 1,
- "column": 52
- }
- },
- "range": [
- 0,
- 52
- ],
- "expression": {
- "type": "JSXElement",
- "start": 0,
- "end": 52,
- "loc": {
- "start": {
- "line": 1,
- "column": 0
- },
- "end": {
- "line": 1,
- "column": 52
- }
- },
- "range": [
- 0,
- 52
- ],
- "openingElement": {
- "type": "JSXOpeningElement",
- "start": 0,
- "end": 31,
- "loc": {
- "start": {
- "line": 1,
- "column": 0
- },
- "end": {
- "line": 1,
- "column": 31
- }
- },
- "range": [
- 0,
- 31
- ],
- "attributes": [
- {
- "type": "JSXAttribute",
- "start": 3,
- "end": 16,
- "loc": {
- "start": {
- "line": 1,
- "column": 3
- },
- "end": {
- "line": 1,
- "column": 16
- }
- },
- "range": [
- 3,
- 16
- ],
- "name": {
- "type": "JSXIdentifier",
- "start": 3,
- "end": 5,
- "loc": {
- "start": {
- "line": 1,
- "column": 3
- },
- "end": {
- "line": 1,
- "column": 5
- }
- },
- "range": [
- 3,
- 5
- ],
- "name": "aa"
- },
- "value": {
- "type": "JSXExpressionContainer",
- "start": 6,
- "end": 16,
- "loc": {
- "start": {
- "line": 1,
- "column": 6
- },
- "end": {
- "line": 1,
- "column": 16
- }
- },
- "range": [
- 6,
- 16
- ],
- "expression": {
- "type": "MemberExpression",
- "start": 7,
- "end": 15,
- "loc": {
- "start": {
- "line": 1,
- "column": 7
- },
- "end": {
- "line": 1,
- "column": 15
- }
- },
- "range": [
- 7,
- 15
- ],
- "object": {
- "type": "MemberExpression",
- "start": 7,
- "end": 12,
- "loc": {
- "start": {
- "line": 1,
- "column": 7
- },
- "end": {
- "line": 1,
- "column": 12
- }
- },
- "range": [
- 7,
- 12
- ],
- "object": {
- "type": "Identifier",
- "start": 7,
- "end": 9,
- "loc": {
- "start": {
- "line": 1,
- "column": 7
- },
- "end": {
- "line": 1,
- "column": 9
- }
- },
- "range": [
- 7,
- 9
- ],
- "name": "aa"
- },
- "property": {
- "type": "Identifier",
- "start": 10,
- "end": 12,
- "loc": {
- "start": {
- "line": 1,
- "column": 10
- },
- "end": {
- "line": 1,
- "column": 12
- }
- },
- "range": [
- 10,
- 12
- ],
- "name": "bb"
- },
- "computed": false
- },
- "property": {
- "type": "Identifier",
- "start": 13,
- "end": 15,
- "loc": {
- "start": {
- "line": 1,
- "column": 13
- },
- "end": {
- "line": 1,
- "column": 15
- }
- },
- "range": [
- 13,
- 15
- ],
- "name": "cc"
- },
- "computed": false
- }
- }
- },
- {
- "type": "JSXAttribute",
- "start": 17,
- "end": 30,
- "loc": {
- "start": {
- "line": 1,
- "column": 17
- },
- "end": {
- "line": 1,
- "column": 30
- }
- },
- "range": [
- 17,
- 30
- ],
- "name": {
- "type": "JSXIdentifier",
- "start": 17,
- "end": 19,
- "loc": {
- "start": {
- "line": 1,
- "column": 17
- },
- "end": {
- "line": 1,
- "column": 19
- }
- },
- "range": [
- 17,
- 19
- ],
- "name": "bb"
- },
- "value": {
- "type": "JSXExpressionContainer",
- "start": 20,
- "end": 30,
- "loc": {
- "start": {
- "line": 1,
- "column": 20
- },
- "end": {
- "line": 1,
- "column": 30
- }
- },
- "range": [
- 20,
- 30
- ],
- "expression": {
- "type": "MemberExpression",
- "start": 21,
- "end": 29,
- "loc": {
- "start": {
- "line": 1,
- "column": 21
- },
- "end": {
- "line": 1,
- "column": 29
- }
- },
- "range": [
- 21,
- 29
- ],
- "object": {
- "type": "MemberExpression",
- "start": 21,
- "end": 26,
- "loc": {
- "start": {
- "line": 1,
- "column": 21
- },
- "end": {
- "line": 1,
- "column": 26
- }
- },
- "range": [
- 21,
- 26
- ],
- "object": {
- "type": "Identifier",
- "start": 21,
- "end": 23,
- "loc": {
- "start": {
- "line": 1,
- "column": 21
- },
- "end": {
- "line": 1,
- "column": 23
- }
- },
- "range": [
- 21,
- 23
- ],
- "name": "bb"
- },
- "property": {
- "type": "Identifier",
- "start": 24,
- "end": 26,
- "loc": {
- "start": {
- "line": 1,
- "column": 24
- },
- "end": {
- "line": 1,
- "column": 26
- }
- },
- "range": [
- 24,
- 26
- ],
- "name": "cc"
- },
- "computed": false
- },
- "property": {
- "type": "Identifier",
- "start": 27,
- "end": 29,
- "loc": {
- "start": {
- "line": 1,
- "column": 27
- },
- "end": {
- "line": 1,
- "column": 29
- }
- },
- "range": [
- 27,
- 29
- ],
- "name": "dd"
- },
- "computed": false
- }
- }
- }
- ],
- "name": {
- "type": "JSXIdentifier",
- "start": 1,
- "end": 2,
- "loc": {
- "start": {
- "line": 1,
- "column": 1
- },
- "end": {
- "line": 1,
- "column": 2
- }
- },
- "range": [
- 1,
- 2
- ],
- "name": "A"
- },
- "selfClosing": false
- },
- "closingElement": {
- "type": "JSXClosingElement",
- "start": 48,
- "end": 52,
- "loc": {
- "start": {
- "line": 1,
- "column": 48
- },
- "end": {
- "line": 1,
- "column": 52
- }
- },
- "range": [
- 48,
- 52
- ],
- "name": {
- "type": "JSXIdentifier",
- "start": 50,
- "end": 51,
- "loc": {
- "start": {
- "line": 1,
- "column": 50
- },
- "end": {
- "line": 1,
- "column": 51
- }
- },
- "range": [
- 50,
- 51
- ],
- "name": "A"
- }
- },
- "children": [
- {
- "type": "JSXElement",
- "start": 31,
- "end": 48,
- "loc": {
- "start": {
- "line": 1,
- "column": 31
- },
- "end": {
- "line": 1,
- "column": 48
- }
- },
- "range": [
- 31,
- 48
- ],
- "openingElement": {
- "type": "JSXOpeningElement",
- "start": 31,
- "end": 36,
- "loc": {
- "start": {
- "line": 1,
- "column": 31
- },
- "end": {
- "line": 1,
- "column": 36
- }
- },
- "range": [
- 31,
- 36
- ],
- "attributes": [],
- "name": {
- "type": "JSXIdentifier",
- "start": 32,
- "end": 35,
- "loc": {
- "start": {
- "line": 1,
- "column": 32
- },
- "end": {
- "line": 1,
- "column": 35
- }
- },
- "range": [
- 32,
- 35
- ],
- "name": "div"
- },
- "selfClosing": false
- },
- "closingElement": {
- "type": "JSXClosingElement",
- "start": 42,
- "end": 48,
- "loc": {
- "start": {
- "line": 1,
- "column": 42
- },
- "end": {
- "line": 1,
- "column": 48
- }
- },
- "range": [
- 42,
- 48
- ],
- "name": {
- "type": "JSXIdentifier",
- "start": 44,
- "end": 47,
- "loc": {
- "start": {
- "line": 1,
- "column": 44
- },
- "end": {
- "line": 1,
- "column": 47
- }
- },
- "range": [
- 44,
- 47
- ],
- "name": "div"
- }
- },
- "children": [
- {
- "type": "JSXExpressionContainer",
- "start": 36,
- "end": 42,
- "loc": {
- "start": {
- "line": 1,
- "column": 36
- },
- "end": {
- "line": 1,
- "column": 42
- }
- },
- "range": [
- 36,
- 42
- ],
- "expression": {
- "type": "MemberExpression",
- "start": 37,
- "end": 41,
- "loc": {
- "start": {
- "line": 1,
- "column": 37
- },
- "end": {
- "line": 1,
- "column": 41
- }
- },
- "range": [
- 37,
- 41
- ],
- "object": {
- "type": "Identifier",
- "start": 37,
- "end": 39,
- "loc": {
- "start": {
- "line": 1,
- "column": 37
- },
- "end": {
- "line": 1,
- "column": 39
- }
- },
- "range": [
- 37,
- 39
- ],
- "name": "aa"
- },
- "property": {
- "type": "Identifier",
- "start": 40,
- "end": 41,
- "loc": {
- "start": {
- "line": 1,
- "column": 40
- },
- "end": {
- "line": 1,
- "column": 41
- }
- },
- "range": [
- 40,
- 41
- ],
- "name": "b"
- },
- "computed": false
- }
- }
- ]
- }
- ]
- }
- },
-
- '<><div></div></>': {
- type: 'ExpressionStatement',
- start: 0,
- end: 16,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- },
- range: [0, 16],
- expression: {
- type: 'JSXFragment',
- start: 0,
- end: 16,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- },
- range: [0, 16],
- openingFragment: {
- type: 'JSXOpeningFragment',
- start: 0,
- end: 2,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- },
- range: [0, 2],
- attributes: [],
- selfClosing: false
- },
- closingFragment: {
- type: 'JSXClosingFragment',
- start: 13,
- end: 16,
- loc: {
- start: {
- line: 1,
- column: 13
- },
- end: {
- line: 1,
- column: 16
- }
- },
- range: [13, 16]
- },
- children: [{
- type: 'JSXElement',
- start: 2,
- end: 13,
- loc: {
- start: {
- line: 1,
- column: 2
- },
- end: {
- line: 1,
- column: 13
- }
- },
- range: [2, 13],
- openingElement: {
- type: 'JSXOpeningElement',
- start: 2,
- end: 7,
- loc: {
- start: {
- line: 1,
- column: 2
- },
- end: {
- line: 1,
- column: 7
- }
- },
- range: [2, 7],
- attributes: [],
- name: {
- type: 'JSXIdentifier',
- start: 3,
- end: 6,
- loc: {
- start: {
- line: 1,
- column: 3
- },
- end: {
- line: 1,
- column: 6
- }
- },
- range: [3, 6],
- name: 'div'
- },
- selfClosing: false
- },
- closingElement: {
- type: 'JSXClosingElement',
- start: 7,
- end: 13,
- loc: {
- start: {
- line: 1,
- column: 7
- },
- end: {
- line: 1,
- column: 13
- }
- },
- range: [7, 13],
- name: {
- type: 'JSXIdentifier',
- start: 9,
- end: 12,
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 12
- }
- },
- range: [9, 12],
- name: 'div'
- }
- },
- children: []
- }]
- }
- }
- },
- 'Regression': {
- '<p>foo <a href="test"> bar</a> baz</p> ;': {
- type: "ExpressionStatement",
- start: 0,
- end: 40,
- expression: {
- type: "JSXElement",
- start: 0,
- end: 38,
- openingElement: {
- type: "JSXOpeningElement",
- start: 0,
- end: 3,
- attributes: [],
- name: {
- type: "JSXIdentifier",
- start: 1,
- end: 2,
- name: "p"
- },
- selfClosing: false
- },
- closingElement: {
- type: "JSXClosingElement",
- start: 34,
- end: 38,
- name: {
- type: "JSXIdentifier",
- start: 36,
- end: 37,
- name: "p"
- }
- },
- children: [
- {
- type: "JSXText",
- start: 3,
- end: 7,
- value: "foo ",
- raw: "foo "
- },
- {
- type: "JSXElement",
- start: 7,
- end: 30,
- openingElement: {
- type: "JSXOpeningElement",
- start: 7,
- end: 22,
- attributes: [{
- type: "JSXAttribute",
- start: 10,
- end: 21,
- name: {
- type: "JSXIdentifier",
- start: 10,
- end: 14,
- name: "href"
- },
- value: {
- type: "Literal",
- start: 15,
- end: 21,
- value: "test",
- raw: "\"test\""
- }
- }],
- name: {
- type: "JSXIdentifier",
- start: 8,
- end: 9,
- name: "a"
- },
- selfClosing: false
- },
- closingElement: {
- type: "JSXClosingElement",
- start: 26,
- end: 30,
- name: {
- type: "JSXIdentifier",
- start: 28,
- end: 29,
- name: "a"
- }
- },
- children: [{
- type: "JSXText",
- start: 22,
- end: 26,
- value: " bar",
- raw: " bar"
- }]
- },
- {
- type: "JSXText",
- start: 30,
- end: 34,
- value: " baz",
- raw: " baz"
- }
- ]
- }
- },
-
- '<div>{<div {...test} />}</div>': {
- type: 'ExpressionStatement',
- start: 0,
- end: 30,
- expression: {
- type: 'JSXElement',
- start: 0,
- end: 30,
- openingElement: {
- type: 'JSXOpeningElement',
- start: 0,
- end: 5,
- attributes: [],
- name: {
- type: 'JSXIdentifier',
- start: 1,
- end: 4,
- name: 'div'
- },
- selfClosing: false
- },
- closingElement: {
- type: 'JSXClosingElement',
- start: 24,
- end: 30,
- name: {
- type: 'JSXIdentifier',
- start: 26,
- end: 29,
- name: 'div'
- }
- },
- children: [{
- type: 'JSXExpressionContainer',
- start: 5,
- end: 24,
- expression: {
- type: 'JSXElement',
- start: 6,
- end: 23,
- openingElement: {
- type: 'JSXOpeningElement',
- start: 6,
- end: 23,
- attributes: [
- {
- type: 'JSXSpreadAttribute',
- start: 11,
- end: 20,
- argument: {
- type: 'Identifier',
- start: 15,
- end: 19,
- name: 'test'
- }
- }
- ],
- name: {
- type: 'JSXIdentifier',
- start: 7,
- end: 10,
- name: 'div'
- },
- selfClosing: true
- },
- closingElement: null,
- children: []
- }
- }]
- }
- },
-
- '<div>{ {a} }</div>': {
- type: "ExpressionStatement",
- start: 0,
- end: 18,
- expression: {
- type: "JSXElement",
- start: 0,
- end: 18,
- openingElement: {
- type: "JSXOpeningElement",
- start: 0,
- end: 5,
- attributes: [],
- name: {
- type: "JSXIdentifier",
- start: 1,
- end: 4,
- name: "div"
- },
- selfClosing: false
- },
- closingElement: {
- type: "JSXClosingElement",
- start: 12,
- end: 18,
- name: {
- type: "JSXIdentifier",
- start: 14,
- end: 17,
- name: "div"
- }
- },
- children: [{
- type: "JSXExpressionContainer",
- start: 5,
- end: 12,
- expression: {
- type: "ObjectExpression",
- start: 7,
- end: 10,
- properties: [{
- type: "Property",
- start: 8,
- end: 9,
- method: false,
- shorthand: true,
- computed: false,
- key: {
- type: "Identifier",
- start: 8,
- end: 9,
- name: "a"
- },
- kind: "init",
- value: {
- type: "Identifier",
- start: 8,
- end: 9,
- name: "a"
- }
- }]
- }
- }]
- }
- },
-
- '<div>/text</div>': {
- type: "ExpressionStatement",
- start: 0,
- end: 16,
- expression: {
- type: "JSXElement",
- start: 0,
- end: 16,
- openingElement: {
- type: "JSXOpeningElement",
- start: 0,
- end: 5,
- attributes: [],
- name: {
- type: "JSXIdentifier",
- start: 1,
- end: 4,
- name: "div"
- },
- selfClosing: false
- },
- closingElement: {
- type: "JSXClosingElement",
- start: 10,
- end: 16,
- name: {
- type: "JSXIdentifier",
- start: 12,
- end: 15,
- name: "div"
- }
- },
- children: [{
- type: "JSXText",
- start: 5,
- end: 10,
- value: "/text",
- raw: "/text"
- }]
- }
- },
-
- '<div>{a}{b}</div>': {
- type: "ExpressionStatement",
- start: 0,
- end: 17,
- expression: {
- type: "JSXElement",
- start: 0,
- end: 17,
- openingElement: {
- type: "JSXOpeningElement",
- start: 0,
- end: 5,
- attributes: [],
- name: {
- type: "JSXIdentifier",
- start: 1,
- end: 4,
- name: "div"
- },
- selfClosing: false
- },
- closingElement: {
- type: "JSXClosingElement",
- start: 11,
- end: 17,
- name: {
- type: "JSXIdentifier",
- start: 13,
- end: 16,
- name: "div"
- }
- },
- children: [{
- type: 'JSXExpressionContainer',
- expression: {
- type: 'Identifier',
- name: 'a',
- range: [6, 7],
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- range: [5, 8],
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 8
- }
- }
- }, {
- type: 'JSXExpressionContainer',
- expression: {
- type: 'Identifier',
- name: 'b',
- range: [9, 10],
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 10
- }
- }
- },
- range: [8, 11],
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 11
- }
- }
- }
- ]
- }
- },
-
- '<div pre="leading" {...props} />': {
- type: "ExpressionStatement",
- range: [0, 32],
- expression: {
- type: "JSXElement",
- range: [0, 32],
- openingElement: {
- type: "JSXOpeningElement",
- range: [0, 32],
- attributes: [
- {
- type: "JSXAttribute",
- range: [5, 18],
- name: {
- type: "JSXIdentifier",
- range: [5, 8],
- name: "pre"
- },
- value: {
- type: "Literal",
- range: [9, 18],
- value: "leading"
- }
- },
- {
- type: "JSXSpreadAttribute",
- range: [19, 29],
- argument: {
- type: "Identifier",
- range: [23, 28],
- name: "props"
- }
- }
- ],
- name: {
- type: "JSXIdentifier",
- range: [1, 4],
- name: "div"
- },
- selfClosing: true
- },
- closingElement: null,
- children: []
- }
- },
- '<path d="M230 80\n\t\tA 45 45, 0, 1, 0, 275 125 \r\n L 275 80 Z"/>': {
- type: "ExpressionStatement",
- expression: {
- type: "JSXElement",
- range: [0, 64],
- openingElement: {
- type: "JSXOpeningElement",
- range: [0, 64],
- attributes: [
- {
- type: "JSXAttribute",
- range: [6, 62],
- name: {
- type: "JSXIdentifier",
- range: [6, 7],
- name: "d"
- },
- value: {
- type: "Literal",
- loc: {
- start: { line: 1, column: 8 },
- end: { line: 3, column: 15 }
- },
- range: [8, 62],
- value: "M230 80\n\t\tA 45 45, 0, 1, 0, 275 125 \r\n L 275 80 Z",
- raw: "\"M230 80\n\t\tA 45 45, 0, 1, 0, 275 125 \r\n L 275 80 Z\""
- }
- }
- ],
- name: {
- type: "JSXIdentifier",
- range: [1, 5],
- name: "path"
- },
- selfClosing: true
- },
- closingElement: null,
- children: []
- }
- }
- }
-};
-
-if (typeof exports !== "undefined") {
- var test = require("./driver.js").test;
- var testFail = require("./driver.js").testFail;
- var jsxTokens = require("..").tokTypes;
- var acornTokens = require("acorn").tokTypes;
-}
-
-testFail("var x = <div>one</div><div>two</div>;", "Adjacent JSX elements must be wrapped in an enclosing tag (1:22)");
-
-testFail("<a:b.c />", "Unexpected token (1:4)");
-
-test("<a:b.c />", {
- type: "Program",
- range: [0, 9],
- body: [{
- type: "ExpressionStatement",
- range: [0, 9],
- expression: {
- type: "JSXElement",
- range: [0, 9],
- openingElement: {
- type: "JSXOpeningElement",
- range: [0, 9],
- attributes: [],
- name: {
- type: "JSXMemberExpression",
- range: [1, 6],
- object: {
- type: "JSXNamespacedName",
- range: [1, 4],
- namespace: {
- type: "JSXIdentifier",
- range: [1, 2],
- name: "a"
- },
- name: {
- type: "JSXIdentifier",
- range: [3, 4],
- name: "b"
- }
- },
- property: {
- type: "JSXIdentifier",
- range: [5, 6],
- name: "c"
- }
- },
- selfClosing: true
- },
- closingElement: null,
- children: []
- }
- }]
-}, {
- ranges: true
-}, {
- allowNamespacedObjects: true
-});
-
-testFail('<ns:div />', 'Unexpected token (1:3)', {}, {
- allowNamespaces: false
-});
-
-testFail('<div ns:attr />', 'Unexpected token (1:7)', {}, {
- allowNamespaces: false
-});
-
-test('<a>{/* foo */}</a>', {}, {
- onToken: [
- {
- type: jsxTokens.jsxTagStart,
- value: undefined,
- start: 0,
- end: 1
- },
- {
- type: jsxTokens.jsxName,
- value: 'a',
- start: 1,
- end: 2
- },
- {
- type: jsxTokens.jsxTagEnd,
- value: undefined,
- start: 2,
- end: 3
- },
- {
- type: acornTokens.braceL,
- value: undefined,
- start: 3,
- end: 4
- },
- {
- type: acornTokens.braceR,
- value: undefined,
- start: 13,
- end: 14
- },
- {
- type: jsxTokens.jsxTagStart,
- value: undefined,
- start: 14,
- end: 15
- },
- {
- type: acornTokens.slash,
- value: '/',
- start: 15,
- end: 16
- },
- {
- type: jsxTokens.jsxName,
- value: 'a',
- start: 16,
- end: 17
- },
- {
- type: jsxTokens.jsxTagEnd,
- value: undefined,
- start: 17,
- end: 18
- },
- {
- type: acornTokens.eof,
- value: undefined,
- start: 18,
- end: 18
- }
- ]
-});
-
-test('<!--a', {
- type: 'Program',
- body: []
-}, {
- onComment: [{
- type: 'Line',
- value: 'a'
- }]
-});
-
-for (var ns in fbTestFixture) {
- ns = fbTestFixture[ns];
- for (var code in ns) {
- test(code, {
- type: 'Program',
- body: [ns[code]]
- }, {
- ecmaVersion: 6,
- locations: true,
- ranges: true
- });
- }
-}
diff --git a/module-node-acorn-bigint/.eslintrc.json b/node-acorn-bigint/.eslintrc.json
index 85fb39b..85fb39b 100644
--- a/module-node-acorn-bigint/.eslintrc.json
+++ b/node-acorn-bigint/.eslintrc.json
diff --git a/module-node-acorn-bigint/.gitignore b/node-acorn-bigint/.gitignore
index c2658d7..c2658d7 100644
--- a/module-node-acorn-bigint/.gitignore
+++ b/node-acorn-bigint/.gitignore
diff --git a/module-node-acorn-bigint/CHANGELOG.md b/node-acorn-bigint/CHANGELOG.md
index f0dbe2f..f0dbe2f 100644
--- a/module-node-acorn-bigint/CHANGELOG.md
+++ b/node-acorn-bigint/CHANGELOG.md
diff --git a/module-node-acorn-bigint/LICENSE b/node-acorn-bigint/LICENSE
index 7c2b27a..7c2b27a 100644
--- a/module-node-acorn-bigint/LICENSE
+++ b/node-acorn-bigint/LICENSE
diff --git a/module-node-acorn-bigint/README.md b/node-acorn-bigint/README.md
index b0b6bb5..b0b6bb5 100644
--- a/module-node-acorn-bigint/README.md
+++ b/node-acorn-bigint/README.md
diff --git a/module-node-acorn-bigint/index.js b/node-acorn-bigint/index.js
index 236bdf7..236bdf7 100644
--- a/module-node-acorn-bigint/index.js
+++ b/node-acorn-bigint/index.js
diff --git a/module-node-acorn-bigint/package.json b/node-acorn-bigint/package.json
index 16afd3a..16afd3a 100644
--- a/module-node-acorn-bigint/package.json
+++ b/node-acorn-bigint/package.json
diff --git a/module-node-acorn-bigint/run_test262.js b/node-acorn-bigint/run_test262.js
index 97e927d..97e927d 100644
--- a/module-node-acorn-bigint/run_test262.js
+++ b/node-acorn-bigint/run_test262.js
diff --git a/module-node-acorn-bigint/test/.eslintrc.json b/node-acorn-bigint/test/.eslintrc.json
index 4668ae7..4668ae7 100644
--- a/module-node-acorn-bigint/test/.eslintrc.json
+++ b/node-acorn-bigint/test/.eslintrc.json
diff --git a/module-node-acorn-bigint/test/test.js b/node-acorn-bigint/test/test.js
index 122a36f..122a36f 100644
--- a/module-node-acorn-bigint/test/test.js
+++ b/node-acorn-bigint/test/test.js
diff --git a/module-node-acorn-dynamic-import/.babelrc b/node-acorn-dynamic-import/.babelrc
index e0aceaa..e0aceaa 100644
--- a/module-node-acorn-dynamic-import/.babelrc
+++ b/node-acorn-dynamic-import/.babelrc
diff --git a/module-node-acorn-dynamic-import/.eslintignore b/node-acorn-dynamic-import/.eslintignore
index 051cd48..051cd48 100644
--- a/module-node-acorn-dynamic-import/.eslintignore
+++ b/node-acorn-dynamic-import/.eslintignore
diff --git a/module-node-acorn-dynamic-import/.eslintrc b/node-acorn-dynamic-import/.eslintrc
index 391ada0..391ada0 100644
--- a/module-node-acorn-dynamic-import/.eslintrc
+++ b/node-acorn-dynamic-import/.eslintrc
diff --git a/module-node-acorn-dynamic-import/.gitignore b/node-acorn-dynamic-import/.gitignore
index b0c4eaf..b0c4eaf 100755
--- a/module-node-acorn-dynamic-import/.gitignore
+++ b/node-acorn-dynamic-import/.gitignore
diff --git a/module-node-acorn-dynamic-import/.npmignore b/node-acorn-dynamic-import/.npmignore
index 2c630f1..2c630f1 100755
--- a/module-node-acorn-dynamic-import/.npmignore
+++ b/node-acorn-dynamic-import/.npmignore
diff --git a/module-node-acorn-dynamic-import/.travis.yml b/node-acorn-dynamic-import/.travis.yml
index 99ca47d..99ca47d 100755
--- a/module-node-acorn-dynamic-import/.travis.yml
+++ b/node-acorn-dynamic-import/.travis.yml
diff --git a/module-node-acorn-dynamic-import/CHANGELOG.md b/node-acorn-dynamic-import/CHANGELOG.md
index ab83b3b..ab83b3b 100644
--- a/module-node-acorn-dynamic-import/CHANGELOG.md
+++ b/node-acorn-dynamic-import/CHANGELOG.md
diff --git a/module-node-acorn-dynamic-import/LICENSE b/node-acorn-dynamic-import/LICENSE
index 25c6dc8..25c6dc8 100755
--- a/module-node-acorn-dynamic-import/LICENSE
+++ b/node-acorn-dynamic-import/LICENSE
diff --git a/module-node-acorn-dynamic-import/README.md b/node-acorn-dynamic-import/README.md
index fdfa526..fdfa526 100755
--- a/module-node-acorn-dynamic-import/README.md
+++ b/node-acorn-dynamic-import/README.md
diff --git a/module-node-acorn-dynamic-import/package-lock.json b/node-acorn-dynamic-import/package-lock.json
index 1a775e0..1a775e0 100644
--- a/module-node-acorn-dynamic-import/package-lock.json
+++ b/node-acorn-dynamic-import/package-lock.json
diff --git a/module-node-acorn-dynamic-import/package.json b/node-acorn-dynamic-import/package.json
index f3cea0b..f3cea0b 100644
--- a/module-node-acorn-dynamic-import/package.json
+++ b/node-acorn-dynamic-import/package.json
diff --git a/module-node-acorn-dynamic-import/src/index.js b/node-acorn-dynamic-import/src/index.js
index be88ff6..be88ff6 100644
--- a/module-node-acorn-dynamic-import/src/index.js
+++ b/node-acorn-dynamic-import/src/index.js
diff --git a/module-node-acorn-dynamic-import/src/walk.js b/node-acorn-dynamic-import/src/walk.js
index 97ac573..97ac573 100644
--- a/module-node-acorn-dynamic-import/src/walk.js
+++ b/node-acorn-dynamic-import/src/walk.js
diff --git a/module-node-acorn-dynamic-import/test/.eslintrc b/node-acorn-dynamic-import/test/.eslintrc
index 01a40d3..01a40d3 100644
--- a/module-node-acorn-dynamic-import/test/.eslintrc
+++ b/node-acorn-dynamic-import/test/.eslintrc
diff --git a/module-node-acorn-dynamic-import/test/fixtures/direct-calls-only/actual.js b/node-acorn-dynamic-import/test/fixtures/direct-calls-only/actual.js
index 7be98d3..7be98d3 100644
--- a/module-node-acorn-dynamic-import/test/fixtures/direct-calls-only/actual.js
+++ b/node-acorn-dynamic-import/test/fixtures/direct-calls-only/actual.js
diff --git a/module-node-acorn-dynamic-import/test/fixtures/direct-calls-only/expected.json b/node-acorn-dynamic-import/test/fixtures/direct-calls-only/expected.json
index 66e487a..66e487a 100644
--- a/module-node-acorn-dynamic-import/test/fixtures/direct-calls-only/expected.json
+++ b/node-acorn-dynamic-import/test/fixtures/direct-calls-only/expected.json
diff --git a/module-node-acorn-dynamic-import/test/fixtures/import-statement/actual.js b/node-acorn-dynamic-import/test/fixtures/import-statement/actual.js
index 734f891..734f891 100644
--- a/module-node-acorn-dynamic-import/test/fixtures/import-statement/actual.js
+++ b/node-acorn-dynamic-import/test/fixtures/import-statement/actual.js
diff --git a/module-node-acorn-dynamic-import/test/fixtures/import-statement/expected.json b/node-acorn-dynamic-import/test/fixtures/import-statement/expected.json
index 8fb8166..8fb8166 100644
--- a/module-node-acorn-dynamic-import/test/fixtures/import-statement/expected.json
+++ b/node-acorn-dynamic-import/test/fixtures/import-statement/expected.json
diff --git a/module-node-acorn-dynamic-import/test/fixtures/inside-function/actual.js b/node-acorn-dynamic-import/test/fixtures/inside-function/actual.js
index 0dc972c..0dc972c 100644
--- a/module-node-acorn-dynamic-import/test/fixtures/inside-function/actual.js
+++ b/node-acorn-dynamic-import/test/fixtures/inside-function/actual.js
diff --git a/module-node-acorn-dynamic-import/test/fixtures/inside-function/expected.json b/node-acorn-dynamic-import/test/fixtures/inside-function/expected.json
index 609e3c3..609e3c3 100644
--- a/module-node-acorn-dynamic-import/test/fixtures/inside-function/expected.json
+++ b/node-acorn-dynamic-import/test/fixtures/inside-function/expected.json
diff --git a/module-node-acorn-dynamic-import/test/fixtures/return-value/actual.js b/node-acorn-dynamic-import/test/fixtures/return-value/actual.js
index 603eb2f..603eb2f 100644
--- a/module-node-acorn-dynamic-import/test/fixtures/return-value/actual.js
+++ b/node-acorn-dynamic-import/test/fixtures/return-value/actual.js
diff --git a/module-node-acorn-dynamic-import/test/fixtures/return-value/expected.json b/node-acorn-dynamic-import/test/fixtures/return-value/expected.json
index ad97014..ad97014 100644
--- a/module-node-acorn-dynamic-import/test/fixtures/return-value/expected.json
+++ b/node-acorn-dynamic-import/test/fixtures/return-value/expected.json
diff --git a/module-node-acorn-dynamic-import/test/fixtures/top-level/actual.js b/node-acorn-dynamic-import/test/fixtures/top-level/actual.js
index 7517dec..7517dec 100644
--- a/module-node-acorn-dynamic-import/test/fixtures/top-level/actual.js
+++ b/node-acorn-dynamic-import/test/fixtures/top-level/actual.js
diff --git a/module-node-acorn-dynamic-import/test/fixtures/top-level/expected.json b/node-acorn-dynamic-import/test/fixtures/top-level/expected.json
index 89a8288..89a8288 100644
--- a/module-node-acorn-dynamic-import/test/fixtures/top-level/expected.json
+++ b/node-acorn-dynamic-import/test/fixtures/top-level/expected.json
diff --git a/module-node-acorn-dynamic-import/test/fixtures/variable-argument/actual.js b/node-acorn-dynamic-import/test/fixtures/variable-argument/actual.js
index 272d2eb..272d2eb 100644
--- a/module-node-acorn-dynamic-import/test/fixtures/variable-argument/actual.js
+++ b/node-acorn-dynamic-import/test/fixtures/variable-argument/actual.js
diff --git a/module-node-acorn-dynamic-import/test/fixtures/variable-argument/expected.json b/node-acorn-dynamic-import/test/fixtures/variable-argument/expected.json
index d325999..d325999 100644
--- a/module-node-acorn-dynamic-import/test/fixtures/variable-argument/expected.json
+++ b/node-acorn-dynamic-import/test/fixtures/variable-argument/expected.json
diff --git a/module-node-acorn-dynamic-import/test/fixtures/yield-import/actual.js b/node-acorn-dynamic-import/test/fixtures/yield-import/actual.js
index 5b09c31..5b09c31 100644
--- a/module-node-acorn-dynamic-import/test/fixtures/yield-import/actual.js
+++ b/node-acorn-dynamic-import/test/fixtures/yield-import/actual.js
diff --git a/module-node-acorn-dynamic-import/test/fixtures/yield-import/expected.json b/node-acorn-dynamic-import/test/fixtures/yield-import/expected.json
index 59307f7..59307f7 100644
--- a/module-node-acorn-dynamic-import/test/fixtures/yield-import/expected.json
+++ b/node-acorn-dynamic-import/test/fixtures/yield-import/expected.json
diff --git a/module-node-acorn-dynamic-import/test/index.js b/node-acorn-dynamic-import/test/index.js
index 901cace..901cace 100644
--- a/module-node-acorn-dynamic-import/test/index.js
+++ b/node-acorn-dynamic-import/test/index.js
diff --git a/module-node-acorn-dynamic-import/test/mocha.opts b/node-acorn-dynamic-import/test/mocha.opts
index fdcea47..fdcea47 100644
--- a/module-node-acorn-dynamic-import/test/mocha.opts
+++ b/node-acorn-dynamic-import/test/mocha.opts
diff --git a/module-node-acorn-dynamic-import/test/testPlugin.js b/node-acorn-dynamic-import/test/testPlugin.js
index b1bafe7..b1bafe7 100644
--- a/module-node-acorn-dynamic-import/test/testPlugin.js
+++ b/node-acorn-dynamic-import/test/testPlugin.js
diff --git a/module-node-acorn-import-meta/.eslintrc.json b/node-acorn-import-meta/.eslintrc.json
index b5a1d38..b5a1d38 100644
--- a/module-node-acorn-import-meta/.eslintrc.json
+++ b/node-acorn-import-meta/.eslintrc.json
diff --git a/node-acorn-import-meta/.gitignore b/node-acorn-import-meta/.gitignore
new file mode 100644
index 0000000..504afef
--- /dev/null
+++ b/node-acorn-import-meta/.gitignore
@@ -0,0 +1,2 @@
+node_modules/
+package-lock.json
diff --git a/module-node-acorn-import-meta/CHANGELOG.md b/node-acorn-import-meta/CHANGELOG.md
index d8f87d8..c0c9e4c 100644
--- a/module-node-acorn-import-meta/CHANGELOG.md
+++ b/node-acorn-import-meta/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.0.0 (2018-10-23)
+
+* Don't accept escape sequences in "meta"
+
## 0.3.0 (2018-09-14)
* Update to new acorn 6 interface
diff --git a/module-node-acorn-import-meta/LICENSE b/node-acorn-import-meta/LICENSE
index 7c2b27a..7c2b27a 100644
--- a/module-node-acorn-import-meta/LICENSE
+++ b/node-acorn-import-meta/LICENSE
diff --git a/module-node-acorn-import-meta/README.md b/node-acorn-import-meta/README.md
index 24d015d..24d015d 100644
--- a/module-node-acorn-import-meta/README.md
+++ b/node-acorn-import-meta/README.md
diff --git a/module-node-acorn-import-meta/index.js b/node-acorn-import-meta/index.js
index 3ee3db8..6e74aa4 100644
--- a/module-node-acorn-import-meta/index.js
+++ b/node-acorn-import-meta/index.js
@@ -27,6 +27,9 @@ module.exports = function(Parser) {
if (node.property.name !== "meta") {
this.raiseRecoverable(node.property.start, "The only valid meta property for import is import.meta")
}
+ if (this.containsEsc) {
+ this.raiseRecoverable(node.property.start, "\"meta\" in import.meta must not contain escape sequences")
+ }
return this.finishNode(node, "MetaProperty")
}
diff --git a/module-node-acorn-import-meta/package.json b/node-acorn-import-meta/package.json
index a30eca4..23f9928 100644
--- a/module-node-acorn-import-meta/package.json
+++ b/node-acorn-import-meta/package.json
@@ -21,13 +21,13 @@
"peerDependencies": {
"acorn": "^6.0.0"
},
- "version": "0.3.0",
+ "version": "1.0.0",
"devDependencies": {
"acorn": "^6.0.0",
"eslint": "^5.5.0",
"eslint-plugin-node": "^7.0.1",
"mocha": "^5.2.0",
- "test262": "git+https://github.com/tc39/test262.git#18c1e799a01cc976695983b61e225ce7959bdd91",
- "test262-parser-runner": "^0.3.1"
+ "test262": "git+https://github.com/tc39/test262.git#c3e384c8c5fcee43395bebc958e48e23dc2c8d5b",
+ "test262-parser-runner": "^0.5.0"
}
}
diff --git a/module-node-acorn-import-meta/run_test262.js b/node-acorn-import-meta/run_test262.js
index 38be7f7..f3f524b 100644
--- a/module-node-acorn-import-meta/run_test262.js
+++ b/node-acorn-import-meta/run_test262.js
@@ -2,7 +2,9 @@
const path = require("path")
const run = require("test262-parser-runner")
-const parse = require(".").parse
+const acorn = require("acorn")
+const acornImportMeta = require(".")
+const Parser = acorn.Parser.extend(acornImportMeta)
const unsupportedFeatures = [
"BigInt",
@@ -15,12 +17,10 @@ const unsupportedFeatures = [
"regexp-unicode-property-escapes"
]
-// See https://github.com/tc39/test262/issues/1342
-
run(
- (content, options) => parse(content, {sourceType: options.sourceType, ecmaVersion: 9, plugins: { importMeta: true }}),
+ (content, options) => Parser.parse(content, {sourceType: options.sourceType, ecmaVersion: 10}),
{
testsDirectory: path.dirname(require.resolve("test262/package.json")),
- skip: test => !test.attrs.features || !test.attrs.features.includes("import-meta") || unsupportedFeatures.some(f => test.attrs.features.includes(f)),
+ skip: test => !test.attrs.features || !test.attrs.features.includes("import.meta") || unsupportedFeatures.some(f => test.attrs.features.includes(f)),
}
)
diff --git a/module-node-acorn-import-meta/test/.eslintrc.json b/node-acorn-import-meta/test/.eslintrc.json
index 4668ae7..4668ae7 100644
--- a/module-node-acorn-import-meta/test/.eslintrc.json
+++ b/node-acorn-import-meta/test/.eslintrc.json
diff --git a/module-node-acorn-import-meta/test/test.js b/node-acorn-import-meta/test/test.js
index b174961..f1a1fbf 100644
--- a/module-node-acorn-import-meta/test/test.js
+++ b/node-acorn-import-meta/test/test.js
@@ -241,4 +241,5 @@ describe("acorn-import-meta", function () {
sourceType: "module"
}))
testFail("let x = import.anotherMeta", "The only valid meta property for import is import.meta (1:15)")
+ testFail("import.m\\u0065ta;", "\"meta\" in import.meta must not contain escape sequences (1:7)")
})
diff --git a/module-node-acorn-jsx/.editorconfig b/node-acorn-jsx/.editorconfig
index c14d5c6..c14d5c6 100644
--- a/module-node-acorn-jsx/.editorconfig
+++ b/node-acorn-jsx/.editorconfig
diff --git a/module-node-acorn-jsx/.gitattributes b/node-acorn-jsx/.gitattributes
index fcadb2c..fcadb2c 100644
--- a/module-node-acorn-jsx/.gitattributes
+++ b/node-acorn-jsx/.gitattributes
diff --git a/module-node-acorn-jsx/.gitignore b/node-acorn-jsx/.gitignore
index d502512..d502512 100644
--- a/module-node-acorn-jsx/.gitignore
+++ b/node-acorn-jsx/.gitignore
diff --git a/module-node-acorn-jsx/.npmignore b/node-acorn-jsx/.npmignore
index 2c630f1..2c630f1 100644
--- a/module-node-acorn-jsx/.npmignore
+++ b/node-acorn-jsx/.npmignore
diff --git a/module-node-acorn-jsx/.travis.yml b/node-acorn-jsx/.travis.yml
index d741c3c..1850771 100644
--- a/module-node-acorn-jsx/.travis.yml
+++ b/node-acorn-jsx/.travis.yml
@@ -1,7 +1,6 @@
language: node_js
sudo: false
node_js:
- - '0.12'
- '4'
- '5'
- '6'
diff --git a/module-node-acorn-jsx/LICENSE b/node-acorn-jsx/LICENSE
index 695d4b9..695d4b9 100644
--- a/module-node-acorn-jsx/LICENSE
+++ b/node-acorn-jsx/LICENSE
diff --git a/module-node-acorn-jsx/README.md b/node-acorn-jsx/README.md
index 2bbb1d9..2bbb1d9 100644
--- a/module-node-acorn-jsx/README.md
+++ b/node-acorn-jsx/README.md
diff --git a/module-node-acorn-jsx/index.js b/node-acorn-jsx/index.js
index 292315f..460e793 100644
--- a/module-node-acorn-jsx/index.js
+++ b/node-acorn-jsx/index.js
@@ -1,9 +1,18 @@
+'use strict';
+
const XHTMLEntities = require('./xhtml');
const hexNumber = /^[\da-fA-F]+$/;
const decimalNumber = /^\d+$/;
-const {tokTypes: tt, TokContext, tokContexts, TokenType, isNewLine, isIdentifierStart, isIdentifierChar} = require("acorn");
+const acorn = require("acorn");
+const tt = acorn.tokTypes;
+const TokContext = acorn.TokContext;
+const tokContexts = acorn.tokContexts;
+const TokenType = acorn.TokenType;
+const isNewLine = acorn.isNewLine;
+const isIdentifierStart = acorn.isIdentifierStart;
+const isIdentifierChar = acorn.isIdentifierChar;
const tc_oTag = new TokContext('<tag', false);
const tc_cTag = new TokContext('</tag', false);
@@ -48,15 +57,16 @@ function getQualifiedJSXName(object) {
getQualifiedJSXName(object.property);
}
-module.exports = function(options = {}) {
+module.exports = function(options) {
+ options = options || {};
return function(Parser) {
return plugin({
allowNamespaces: options.allowNamespaces !== false,
allowNamespacedObjects: !!options.allowNamespacedObjects
}, Parser);
}
-}
-module.exports.tokTypes = tok
+};
+module.exports.tokTypes = tok;
function plugin(options, Parser) {
return class extends Parser {
@@ -115,7 +125,7 @@ function plugin(options, Parser) {
}
return out;
- };
+ }
jsx_readString(quote) {
let out = '', chunkStart = ++this.pos;
@@ -428,4 +438,4 @@ function plugin(options, Parser) {
}
}
};
-};
+}
diff --git a/module-node-acorn-jsx/package.json b/node-acorn-jsx/package.json
index 8e719a9..9953608 100644
--- a/module-node-acorn-jsx/package.json
+++ b/node-acorn-jsx/package.json
@@ -2,7 +2,7 @@
"name": "acorn-jsx",
"description": "Alternative, faster React.js JSX parser",
"homepage": "https://github.com/RReverser/acorn-jsx",
- "version": "5.0.0",
+ "version": "5.0.1",
"maintainers": [
{
"name": "Ingvar Stepanyan",
diff --git a/module-node-acorn-jsx/test/driver.js b/node-acorn-jsx/test/driver.js
index 8d3df48..8d3df48 100644
--- a/module-node-acorn-jsx/test/driver.js
+++ b/node-acorn-jsx/test/driver.js
diff --git a/module-node-acorn-jsx/test/run.js b/node-acorn-jsx/test/run.js
index e398b1b..e398b1b 100644
--- a/module-node-acorn-jsx/test/run.js
+++ b/node-acorn-jsx/test/run.js
diff --git a/module-node-acorn-jsx/xhtml.js b/node-acorn-jsx/xhtml.js
index c152009..c152009 100644
--- a/module-node-acorn-jsx/xhtml.js
+++ b/node-acorn-jsx/xhtml.js
diff --git a/module-node-acorn-node/.gitignore b/node-acorn-node/.gitignore
index e3cd5cf..e3cd5cf 100644
--- a/module-node-acorn-node/.gitignore
+++ b/node-acorn-node/.gitignore
diff --git a/module-node-acorn-node/.travis.yml b/node-acorn-node/.travis.yml
index b4092d3..3242452 100644
--- a/module-node-acorn-node/.travis.yml
+++ b/node-acorn-node/.travis.yml
@@ -1,5 +1,7 @@
language: node_js
node_js:
+ - '11'
+ - '10'
- '9'
- '8'
- '6'
diff --git a/module-node-acorn-node/CHANGELOG.md b/node-acorn-node/CHANGELOG.md
index 35c4072..b467c9d 100644
--- a/module-node-acorn-node/CHANGELOG.md
+++ b/node-acorn-node/CHANGELOG.md
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
+## 1.6.2
+
+ * Allow dynamic `import()` in scripts.
+ * Update minimum dependency versions, fixing a peerDependency warning.
+ * Add Node 10 and 11 to CI.
+
## 1.6.1
* Update acorn-dynamic-import to v4.
diff --git a/module-node-acorn-node/LICENSE.md b/node-acorn-node/LICENSE.md
index 3698cf1..3698cf1 100644
--- a/module-node-acorn-node/LICENSE.md
+++ b/node-acorn-node/LICENSE.md
diff --git a/module-node-acorn-node/README.md b/node-acorn-node/README.md
index d689046..d689046 100644
--- a/module-node-acorn-node/README.md
+++ b/node-acorn-node/README.md
diff --git a/module-node-acorn-node/build.js b/node-acorn-node/build.js
index 8075566..8075566 100644
--- a/module-node-acorn-node/build.js
+++ b/node-acorn-node/build.js
diff --git a/module-node-acorn-node/index.js b/node-acorn-node/index.js
index a61aea7..0c979c9 100644
--- a/module-node-acorn-node/index.js
+++ b/node-acorn-node/index.js
@@ -3,8 +3,8 @@ var xtend = require('xtend')
var CJSParser = acorn.Parser
.extend(require('./lib/bigint'))
-var ESModulesParser = CJSParser
.extend(require('acorn-dynamic-import').default)
+var ESModulesParser = CJSParser
.extend(require('./lib/import-meta'))
function mapOptions (opts) {
diff --git a/module-node-acorn-node/package.json b/node-acorn-node/package.json
index c68a9ea..361ef07 100644
--- a/module-node-acorn-node/package.json
+++ b/node-acorn-node/package.json
@@ -1,24 +1,24 @@
{
"name": "acorn-node",
"description": "the acorn javascript parser, preloaded with plugins for syntax parity with recent node versions",
- "version": "1.6.1",
+ "version": "1.6.2",
"author": "Renée Kooi <renee@kooi.me>",
"bugs": {
"url": "https://github.com/browserify/acorn-node/issues"
},
"dependencies": {
- "acorn": "^6.0.1",
+ "acorn": "^6.0.2",
"acorn-dynamic-import": "^4.0.0",
- "acorn-walk": "^6.0.1",
+ "acorn-walk": "^6.1.0",
"xtend": "^4.0.1"
},
"devDependencies": {
- "acorn-bigint": "^0.3.0",
+ "acorn-bigint": "^0.3.1",
"acorn-import-meta": "^0.3.0",
- "buble": "^0.19.3",
+ "buble": "^0.19.6",
"mkdirp": "^0.5.1",
"standard": "^11.0.1",
- "tape": "^4.8.0"
+ "tape": "^4.9.1"
},
"homepage": "https://github.com/browserify/acorn-node",
"keywords": [
diff --git a/module-node-acorn-node/test/index.js b/node-acorn-node/test/index.js
index 73f0b7d..891129a 100644
--- a/module-node-acorn-node/test/index.js
+++ b/node-acorn-node/test/index.js
@@ -87,6 +87,13 @@ test('supports dynamic import() with sourceType: module', function (t) {
t.end()
})
+test('supports dynamic import() with sourceType: script', function (t) {
+ t.doesNotThrow(function () {
+ acorn.parse('import("./whatever.mjs")', { sourceType: 'script' })
+ })
+ t.end()
+})
+
test('walk supports plugin syntax', function (t) {
var ast = acorn.parse(
'async function* a() { try { await import(xyz); } catch { for await (x of null) {} } yield import.meta.url }',
diff --git a/module-node-acorn-node/walk.js b/node-acorn-node/walk.js
index 3d9f89a..3d9f89a 100644
--- a/module-node-acorn-node/walk.js
+++ b/node-acorn-node/walk.js
diff --git a/package.json b/package.json
index 7808934..b208c92 100644
--- a/package.json
+++ b/package.json
@@ -22,8 +22,7 @@
"license": "MIT",
"scripts": {
"prepare": "npm run test",
- "test": "npm run link && node test/run.js && node test/lint.js",
- "link": "mkdir -p acorn-loose/node_modules && ln -s ../../acorn acorn-loose/node_modules/acorn",
+ "test": "node test/run.js && node test/lint.js",
"pretest": "npm run build:main && npm run build:loose",
"test:test262": "node bin/run_test262.js",
"build": "npm run build:main && npm run build:walk && npm run build:loose && npm run build:bin",
@@ -42,7 +41,7 @@
"eslint-plugin-standard": "^3.0.1",
"rollup": "^0.45.0",
"rollup-plugin-buble": "^0.16.0",
- "test262": "git+https://github.com/tc39/test262.git#3936950114fcdf49ece33bbbc52b71ac4ebbb32c",
+ "test262": "git+https://github.com/tc39/test262.git#e39604fa41b1ad0effdcf586e4d554ff2d8c3eb7",
"test262-parser-runner": "^0.5.0",
"unicode-11.0.0": "^0.7.7"
}
diff --git a/test/lint.js b/test/lint.js
index c82730b..2793506 100644
--- a/test/lint.js
+++ b/test/lint.js
@@ -3,7 +3,7 @@ if (parseInt(process.versions.node) > 4) {
var join = require("path").join
try {
require("child_process").execSync(
- join("node_modules", ".bin", "eslint") + " " + join(__dirname, "..", "src"),
+ join("node_modules", ".bin", "eslint") + " " + join(__dirname, "..", "*", "src"),
{encoding: "utf8", stdio: "inherit"}
)
console.log("OK")
diff --git a/test/tests-async-iteration.js b/test/tests-async-iteration.js
index 9db423f..8984fba 100644
--- a/test/tests-async-iteration.js
+++ b/test/tests-async-iteration.js
@@ -1099,7 +1099,7 @@ testFail("class A { async\n* f() {} }", "Unexpected token (2:0)", { ecmaVersion:
testFail("class A { *async f() {} }", "Unexpected token (1:17)", { ecmaVersion: 9 })
testFail("class A { *async* f() {} }", "Unexpected token (1:16)", { ecmaVersion: 9 })
testFail("class A { async* f() { () => await a; } }", "Unexpected token (1:35)", { ecmaVersion: 9 })
-testFail("class A { async* f() { () => yield a; } }", "Unexpected token (1:35)", { ecmaVersion: 9 })
+testFail("class A { async* f() { () => yield a; } }", "The keyword 'yield' is reserved (1:29)", { ecmaVersion: 9 })
testFail("f = async function*() { await a; yield b; }", "Unexpected token (1:18)", { ecmaVersion: 8 })
testFail("obj = { async* f() { await a; yield b; } }", "Unexpected token (1:13)", { ecmaVersion: 8 })
diff --git a/test/tests-asyncawait.js b/test/tests-asyncawait.js
index 7f1387a..77de3c8 100644
--- a/test/tests-asyncawait.js
+++ b/test/tests-asyncawait.js
@@ -216,9 +216,9 @@ test("async function await() { }", {
}, {ecmaVersion: 8})
// cannot use 'await' inside async functions.
-testFail("async function wrap() {\nasync function await() { }\n}", "Can not use 'await' as identifier inside an async function (2:15)", {ecmaVersion: 8})
-testFail("async function foo(await) { }", "Can not use 'await' as identifier inside an async function (1:19)", {ecmaVersion: 8})
-testFail("async function foo() { return {await} }", "Can not use 'await' as identifier inside an async function (1:31)", {ecmaVersion: 8})
+testFail("async function wrap() {\nasync function await() { }\n}", "Cannot use 'await' as identifier inside an async function (2:15)", {ecmaVersion: 8})
+testFail("async function foo(await) { }", "Cannot use 'await' as identifier inside an async function (1:19)", {ecmaVersion: 8})
+testFail("async function foo() { return {await} }", "Cannot use 'await' as identifier inside an async function (1:31)", {ecmaVersion: 8})
//-----------------------------------------------------------------------------
// Async Function Expressions
@@ -333,9 +333,9 @@ test("export default (async function() { })", {
}, {ecmaVersion: 8, sourceType: "module"})
// cannot use 'await' inside async functions.
-testFail("(async function await() { })", "Can not use 'await' as identifier inside an async function (1:16)", {ecmaVersion: 8})
-testFail("(async function foo(await) { })", "Can not use 'await' as identifier inside an async function (1:20)", {ecmaVersion: 8})
-testFail("(async function foo() { return {await} })", "Can not use 'await' as identifier inside an async function (1:32)", {ecmaVersion: 8})
+testFail("(async function await() { })", "Cannot use 'await' as identifier inside an async function (1:16)", {ecmaVersion: 8})
+testFail("(async function foo(await) { })", "Cannot use 'await' as identifier inside an async function (1:20)", {ecmaVersion: 8})
+testFail("(async function foo() { return {await} })", "Cannot use 'await' as identifier inside an async function (1:32)", {ecmaVersion: 8})
//-----------------------------------------------------------------------------
// Async Arrow Function Expressions
@@ -825,11 +825,26 @@ test("async (await)", {
}, {ecmaVersion: 8})
// cannot use 'await' inside async functions.
-testFail("async await => 1", "Can not use 'await' as identifier inside an async function (1:6)", {ecmaVersion: 8})
-testFail("async (await) => 1", "Can not use 'await' as identifier inside an async function (1:7)", {ecmaVersion: 8})
-testFail("async ({await}) => 1", "Can not use 'await' as identifier inside an async function (1:8)", {ecmaVersion: 8})
-testFail("async ({a: await}) => 1", "Can not use 'await' as identifier inside an async function (1:11)", {ecmaVersion: 8})
-testFail("async ([await]) => 1", "Can not use 'await' as identifier inside an async function (1:8)", {ecmaVersion: 8})
+testFail("async await => 1", "Cannot use 'await' as identifier inside an async function (1:6)", {ecmaVersion: 8})
+testFail("async (await) => 1", "Cannot use 'await' as identifier inside an async function (1:7)", {ecmaVersion: 8})
+testFail("async (...await) => 1", "Cannot use 'await' as identifier inside an async function (1:10)", {ecmaVersion: 8})
+testFail("async ({await}) => 1", "Cannot use 'await' as identifier inside an async function (1:8)", {ecmaVersion: 8})
+testFail("async ({a: await}) => 1", "Cannot use 'await' as identifier inside an async function (1:11)", {ecmaVersion: 8})
+test("async ({await: a}) => 1", {}, {ecmaVersion: 8})
+testFail("async ([await]) => 1", "Cannot use 'await' as identifier inside an async function (1:8)", {ecmaVersion: 8})
+testFail("async ([...await]) => 1", "Cannot use 'await' as identifier inside an async function (1:11)", {ecmaVersion: 8})
+test("async (b = {await: a}) => 1", {}, {ecmaVersion: 8})
+testFail("async (b = {await}) => 1", "Cannot use 'await' as identifier inside an async function (1:12)", {ecmaVersion: 8})
+testFail("async (b = {a: await}) => 1", "Cannot use 'await' as identifier inside an async function (1:15)", {ecmaVersion: 8})
+test("async (b = {await: a}) => 1", {}, {ecmaVersion: 8})
+testFail("async (b = [await]) => 1", "Cannot use 'await' as identifier inside an async function (1:12)", {ecmaVersion: 8})
+testFail("async (b = [...await]) => 1", "Cannot use 'await' as identifier inside an async function (1:15)", {ecmaVersion: 8})
+testFail("async (b = class await {}) => 1", "Cannot use 'await' as identifier inside an async function (1:17)", {ecmaVersion: 8})
+test("async (b = function await() {}) => 1", {}, {ecmaVersion: 8})
+test("async (b = function* await() {}) => 1", {}, {ecmaVersion: 8})
+testFail("async (b = (await) => {}) => 1", "Cannot use 'await' as identifier inside an async function (1:12)", {ecmaVersion: 8})
+testFail("async (await, b = async()) => 2", "Cannot use 'await' as identifier inside an async function (1:7)", {ecmaVersion: 8})
+testFail("async (await, b = async () => {}) => 1", "Cannot use 'await' as identifier inside an async function (1:7)", {ecmaVersion: 8})
// can use 'yield' identifier outside generators.
test("async yield => 1", {
@@ -1095,9 +1110,9 @@ test("({async await() { }})", {
// cannot use 'await' inside async functions.
test("async function wrap() {\n({async await() { }})\n}", {}, {ecmaVersion: 8})
-testFail("({async foo() { var await }})", "Can not use 'await' as identifier inside an async function (1:20)", {ecmaVersion: 8})
-testFail("({async foo(await) { }})", "Can not use 'await' as identifier inside an async function (1:12)", {ecmaVersion: 8})
-testFail("({async foo() { return {await} }})", "Can not use 'await' as identifier inside an async function (1:24)", {ecmaVersion: 8})
+testFail("({async foo() { var await }})", "Cannot use 'await' as identifier inside an async function (1:20)", {ecmaVersion: 8})
+testFail("({async foo(await) { }})", "Cannot use 'await' as identifier inside an async function (1:12)", {ecmaVersion: 8})
+testFail("({async foo() { return {await} }})", "Cannot use 'await' as identifier inside an async function (1:24)", {ecmaVersion: 8})
// invalid syntax 'async foo: 1'
testFail("({async foo: 1})", "Unexpected token (1:11)", {ecmaVersion: 8})
@@ -1641,9 +1656,9 @@ test("class A {static async await() { }}", {
// cannot use 'await' inside async functions.
test("async function wrap() {\nclass A {async await() { }}\n}", {}, {ecmaVersion: 8})
-testFail("class A {async foo() { var await }}", "Can not use 'await' as identifier inside an async function (1:27)", {ecmaVersion: 8})
-testFail("class A {async foo(await) { }}", "Can not use 'await' as identifier inside an async function (1:19)", {ecmaVersion: 8})
-testFail("class A {async foo() { return {await} }}", "Can not use 'await' as identifier inside an async function (1:31)", {ecmaVersion: 8})
+testFail("class A {async foo() { var await }}", "Cannot use 'await' as identifier inside an async function (1:27)", {ecmaVersion: 8})
+testFail("class A {async foo(await) { }}", "Cannot use 'await' as identifier inside an async function (1:19)", {ecmaVersion: 8})
+testFail("class A {async foo() { return {await} }}", "Cannot use 'await' as identifier inside an async function (1:31)", {ecmaVersion: 8})
//-----------------------------------------------------------------------------
// Await Expressions
@@ -1669,11 +1684,11 @@ test("await", {
}, {ecmaVersion: 8})
// 'await' is a keyword in modules.
-testFail("await", "Can not use keyword 'await' outside an async function (1:0)", {ecmaVersion: 8, sourceType: "module"})
+testFail("await", "Cannot use keyword 'await' outside an async function (1:0)", {ecmaVersion: 8, sourceType: "module"})
// Await expressions is invalid outside of async functions.
testFail("await a", "Unexpected token (1:6)", {ecmaVersion: 8})
-testFail("await a", "Can not use keyword 'await' outside an async function (1:0)", {ecmaVersion: 8, sourceType: "module"})
+testFail("await a", "Cannot use keyword 'await' outside an async function (1:0)", {ecmaVersion: 8, sourceType: "module"})
// Await expressions in async functions.
test("async function foo(a, b) { await a }", {
@@ -3507,4 +3522,4 @@ test(
test("({ async delete() {} })", {}, {ecmaVersion: 8})
-testFail("abc: async function a() {}", "Invalid labeled declaration (1:5)", {ecmaVersion: 8})
+testFail("abc: async function a() {}", "Unexpected token (1:5)", {ecmaVersion: 8})
diff --git a/test/tests-directive.js b/test/tests-directive.js
index d013c7d..f83a7cf 100644
--- a/test/tests-directive.js
+++ b/test/tests-directive.js
@@ -221,6 +221,33 @@ test("\"use strict\" + 1", {
]
}, { ecmaVersion: 6 })
+test("; 'use strict'; with ({}) {}", {
+ type: "Program",
+ body: [
+ { type: "EmptyStatement" },
+ {
+ type: "ExpressionStatement",
+ expression: {
+ type: "Literal",
+ value: "use strict",
+ raw: "'use strict'"
+ },
+ directive: undefined // check this property does not exist.
+ },
+ {
+ type: "WithStatement",
+ object: {
+ type: "ObjectExpression",
+ properties: []
+ },
+ body: {
+ type: "BlockStatement",
+ body: []
+ }
+ }
+ ]
+}, { ecmaVersion: 6 })
+
//------------------------------------------------------------------------
// One directive
//------------------------------------------------------------------------
diff --git a/test/tests-harmony.js b/test/tests-harmony.js
index 9860e8d..e370474 100644
--- a/test/tests-harmony.js
+++ b/test/tests-harmony.js
@@ -804,7 +804,7 @@ test("`$`", {
locations: true
});
-test("`\\n\\r\\b\\v\\t\\f\\\n\\\r\n`", {
+test("`\\n\\r\\b\\v\\t\\f\\\n\\\r\n\\\u2028\\\u2029`", {
type: "Program",
body: [{
type: "ExpressionStatement",
@@ -812,27 +812,27 @@ test("`\\n\\r\\b\\v\\t\\f\\\n\\\r\n`", {
type: "TemplateLiteral",
quasis: [{
type: "TemplateElement",
- value: {raw: "\\n\\r\\b\\v\\t\\f\\\n\\\n", cooked: "\n\r\b\u000b\t\f"},
+ value: {raw: "\\n\\r\\b\\v\\t\\f\\\n\\\n\\\u2028\\\u2029", cooked: "\n\r\b\u000b\t\f"},
tail: true,
loc: {
start: {line: 1, column: 1},
- end: {line: 3, column: 0}
+ end: {line: 3, column: 4}
}
}],
expressions: [],
loc: {
start: {line: 1, column: 0},
- end: {line: 3, column: 1}
+ end: {line: 3, column: 5}
}
},
loc: {
start: {line: 1, column: 0},
- end: {line: 3, column: 1}
+ end: {line: 3, column: 5}
}
}],
loc: {
start: {line: 1, column: 0},
- end: {line: 3, column: 1}
+ end: {line: 3, column: 5}
}
}, {
ecmaVersion: 6,
@@ -4078,7 +4078,7 @@ test("export var document = { }", {
locations: true
});
-testFail("export var await", "Can not use keyword 'await' outside an async function (1:11)", { ecmaVersion: 6, sourceType: "module" })
+testFail("export var await", "Cannot use keyword 'await' outside an async function (1:11)", { ecmaVersion: 6, sourceType: "module" })
test("export let document", {
type: "Program",
@@ -4499,7 +4499,7 @@ test("export * from \"crypto\"", {
locations: true
});
-test("export { encrypt }", {
+test("export { encrypt }\nvar encrypt", {
type: "Program",
body: [{
type: "ExportNamedDeclaration",
@@ -4532,10 +4532,33 @@ test("export { encrypt }", {
start: {line: 1, column: 0},
end: {line: 1, column: 18}
}
+ }, {
+ type: "VariableDeclaration",
+ declarations: [{
+ type: "VariableDeclarator",
+ id: {
+ type: "Identifier",
+ name: "encrypt",
+ loc: {
+ start: {line: 2, column: 4},
+ end: {line: 2, column: 11}
+ }
+ },
+ init: null,
+ loc: {
+ start: {line: 2, column: 4},
+ end: {line: 2, column: 11}
+ }
+ }],
+ kind: "var",
+ loc: {
+ start: {line: 2, column: 0},
+ end: {line: 2, column: 11}
+ }
}],
loc: {
start: {line: 1, column: 0},
- end: {line: 1, column: 18}
+ end: {line: 2, column: 11}
}
}, {
ecmaVersion: 6,
@@ -4544,9 +4567,55 @@ test("export { encrypt }", {
locations: true
});
-test("export { encrypt, decrypt }", {
+test("function encrypt() {} let decrypt; export { encrypt, decrypt }", {
type: "Program",
body: [{
+ type: "FunctionDeclaration",
+ id: {
+ type: "Identifier",
+ name: "encrypt",
+ loc: {
+ start: {line: 1, column: 9},
+ end: {line: 1, column: 16}
+ }
+ },
+ params: [],
+ body: {
+ type: "BlockStatement",
+ body: [],
+ loc: {
+ start: {line: 1, column: 19},
+ end: {line: 1, column: 21}
+ }
+ },
+ loc: {
+ start: {line: 1, column: 0},
+ end: {line: 1, column: 21}
+ }
+ }, {
+ type: "VariableDeclaration",
+ declarations: [{
+ type: "VariableDeclarator",
+ id: {
+ type: "Identifier",
+ name: "decrypt",
+ loc: {
+ start: {line: 1, column: 26},
+ end: {line: 1, column: 33}
+ }
+ },
+ init: null,
+ loc: {
+ start: {line: 1, column: 26},
+ end: {line: 1, column: 33}
+ }
+ }],
+ kind: "let",
+ loc: {
+ start: {line: 1, column: 22},
+ end: {line: 1, column: 34}
+ }
+ }, {
type: "ExportNamedDeclaration",
declaration: null,
specifiers: [
@@ -4556,21 +4625,21 @@ test("export { encrypt, decrypt }", {
type: "Identifier",
name: "encrypt",
loc: {
- start: {line: 1, column: 9},
- end: {line: 1, column: 16}
+ start: {line: 1, column: 44},
+ end: {line: 1, column: 51}
}
},
local: {
type: "Identifier",
name: "encrypt",
loc: {
- start: {line: 1, column: 9},
- end: {line: 1, column: 16}
+ start: {line: 1, column: 44},
+ end: {line: 1, column: 51}
}
},
loc: {
- start: {line: 1, column: 9},
- end: {line: 1, column: 16}
+ start: {line: 1, column: 44},
+ end: {line: 1, column: 51}
}
},
{
@@ -4579,33 +4648,33 @@ test("export { encrypt, decrypt }", {
type: "Identifier",
name: "decrypt",
loc: {
- start: {line: 1, column: 18},
- end: {line: 1, column: 25}
+ start: {line: 1, column: 53},
+ end: {line: 1, column: 60}
}
},
local: {
type: "Identifier",
name: "decrypt",
loc: {
- start: {line: 1, column: 18},
- end: {line: 1, column: 25}
+ start: {line: 1, column: 53},
+ end: {line: 1, column: 60}
}
},
loc: {
- start: {line: 1, column: 18},
- end: {line: 1, column: 25}
+ start: {line: 1, column: 53},
+ end: {line: 1, column: 60}
}
}
],
source: null,
loc: {
- start: {line: 1, column: 0},
- end: {line: 1, column: 27}
+ start: {line: 1, column: 35},
+ end: {line: 1, column: 62}
}
}],
loc: {
start: {line: 1, column: 0},
- end: {line: 1, column: 27}
+ end: {line: 1, column: 62}
}
}, {
ecmaVersion: 6,
@@ -4614,7 +4683,52 @@ test("export { encrypt, decrypt }", {
locations: true
});
-test("export { encrypt as default }", {
+testFail("export { encrypt }", "Export 'encrypt' is not defined (1:9)", {
+ ecmaVersion: 6,
+ sourceType: "module"
+});
+
+testFail("class Test {}; export default class Test {}", "Identifier 'Test' has already been declared (1:36)", {
+ ecmaVersion: 6,
+ sourceType: "module"
+});
+
+test("export default class Test {}; export { Test }", {}, {
+ ecmaVersion: 6,
+ sourceType: "module"
+});
+
+testFail("export { encrypt, encrypt }", "Duplicate export 'encrypt' (1:18)", {
+ ecmaVersion: 6,
+ sourceType: "module"
+});
+
+testFail("export { encrypt }; export { encrypt }", "Duplicate export 'encrypt' (1:29)", {
+ ecmaVersion: 6,
+ sourceType: "module"
+});
+
+testFail("export { decrypt as encrypt }; function encrypt() {}", "Export 'decrypt' is not defined (1:9)", {
+ ecmaVersion: 6,
+ sourceType: "module"
+});
+
+testFail("export { encrypt }; if (true) function encrypt() {}", "Unexpected token (1:30)", {
+ ecmaVersion: 6,
+ sourceType: "module"
+});
+
+testFail("{ function encrypt() {} } export { encrypt }", "Export 'encrypt' is not defined (1:35)", {
+ ecmaVersion: 6,
+ sourceType: "module"
+});
+
+test("{ var encrypt } export { encrypt }", {}, {
+ ecmaVersion: 6,
+ sourceType: "module"
+});
+
+test("export { encrypt as default }; function* encrypt() {}", {
type: "Program",
body: [{
type: "ExportNamedDeclaration",
@@ -4645,21 +4759,36 @@ test("export { encrypt as default }", {
source: null,
loc: {
start: {line: 1, column: 0},
- end: {line: 1, column: 29}
+ end: {line: 1, column: 30}
+ }
+ }, {
+ type: "FunctionDeclaration",
+ generator: true,
+ params: [],
+ body: {
+ type: "BlockStatement",
+ body: [],
+ loc: {
+ start: {line: 1, column: 51},
+ end: {line: 1, column: 53}
+ }
+ },
+ loc: {
+ start: {line: 1, column: 31},
+ end: {line: 1, column: 53}
}
}],
loc: {
start: {line: 1, column: 0},
- end: {line: 1, column: 29}
+ end: {line: 1, column: 53}
}
}, {
ecmaVersion: 6,
sourceType: "module",
- ranges: true,
locations: true
});
-test("export { encrypt, decrypt as dec }", {
+test("export { encrypt, decrypt as dec }; let encrypt, decrypt", {
type: "Program",
body: [{
type: "ExportNamedDeclaration",
@@ -4715,12 +4844,50 @@ test("export { encrypt, decrypt as dec }", {
source: null,
loc: {
start: {line: 1, column: 0},
- end: {line: 1, column: 34}
+ end: {line: 1, column: 35}
+ }
+ }, {
+ type: "VariableDeclaration",
+ declarations: [{
+ type: "VariableDeclarator",
+ id: {
+ type: "Identifier",
+ name: "encrypt",
+ loc: {
+ start: {line: 1, column: 40},
+ end: {line: 1, column: 47}
+ }
+ },
+ init: null,
+ loc: {
+ start: {line: 1, column: 40},
+ end: {line: 1, column: 47}
+ }
+ }, {
+ type: "VariableDeclarator",
+ id: {
+ type: "Identifier",
+ name: "decrypt",
+ loc: {
+ start: {line: 1, column: 49},
+ end: {line: 1, column: 56}
+ }
+ },
+ init: null,
+ loc: {
+ start: {line: 1, column: 49},
+ end: {line: 1, column: 56}
+ }
+ }],
+ kind: "let",
+ loc: {
+ start: {line: 1, column: 36},
+ end: {line: 1, column: 56}
}
}],
loc: {
start: {line: 1, column: 0},
- end: {line: 1, column: 34}
+ end: {line: 1, column: 56}
}
}, {
ecmaVersion: 6,
@@ -6031,6 +6198,109 @@ test("for (let x of list) process(x);", {
locations: true
});
+test("for (let\n{x} of list) process(x);", {
+ type: "Program",
+ body: [{
+ type: "ForOfStatement",
+ left: {
+ type: "VariableDeclaration",
+ declarations: [{
+ type: "VariableDeclarator",
+ id: {
+ type: "ObjectPattern",
+ loc: {
+ start: {line: 2, column: 0},
+ end: {line: 2, column: 3}
+ },
+ properties: [{
+ type: "Property",
+ kind: "init",
+ key: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 2, column: 1},
+ end: {line: 2, column: 2}
+ }
+ },
+ value: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 2, column: 1},
+ end: {line: 2, column: 2}
+ }
+ },
+ loc: {
+ start: {line: 2, column: 1},
+ end: {line: 2, column: 2}
+ }
+ }]
+ },
+ init: null,
+ loc: {
+ start: {line: 2, column: 0},
+ end: {line: 2, column: 3}
+ }
+ }],
+ kind: "let",
+ loc: {
+ start: {line: 1, column: 5},
+ end: {line: 2, column: 3}
+ }
+ },
+ right: {
+ type: "Identifier",
+ name: "list",
+ loc: {
+ start: {line: 2, column: 7},
+ end: {line: 2, column: 11}
+ }
+ },
+ body: {
+ type: "ExpressionStatement",
+ expression: {
+ type: "CallExpression",
+ callee: {
+ type: "Identifier",
+ name: "process",
+ loc: {
+ start: {line: 2, column: 13},
+ end: {line: 2, column: 20}
+ }
+ },
+ arguments: [{
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 2, column: 21},
+ end: {line: 2, column: 22}
+ }
+ }],
+ loc: {
+ start: {line: 2, column: 13},
+ end: {line: 2, column: 23}
+ }
+ },
+ loc: {
+ start: {line: 2, column: 13},
+ end: {line: 2, column: 24}
+ }
+ },
+ loc: {
+ start: {line: 1, column: 0},
+ end: {line: 2, column: 24}
+ }
+ }],
+ loc: {
+ start: {line: 1, column: 0},
+ end: {line: 2, column: 24}
+ }
+}, {
+ ecmaVersion: 6,
+ locations: true
+});
+
// Harmony: Class (strawman)
test("var A = class extends B {}", {
@@ -13217,6 +13487,16 @@ test("var let = 1", {
testFail("'use strict'; let + 1", "The keyword 'let' is reserved (1:14)", {ecmaVersion: 6})
+testFail("let let", "let is disallowed as a lexically bound name (1:4)", {ecmaVersion: 6})
+
+testFail("const let", "let is disallowed as a lexically bound name (1:6)", {ecmaVersion: 6})
+
+testFail("'use strict'; let let", "let is disallowed as a lexically bound name (1:18)", {ecmaVersion: 6})
+
+testFail("'use strict'; const let", "let is disallowed as a lexically bound name (1:20)", {ecmaVersion: 6})
+
+test("if (1) let\n{}", {}, {ecmaVersion: 6})
+
test("var yield = 2", {
"type": "Program",
"body": [
@@ -13245,10 +13525,12 @@ testFail("(function() { \"use strict\"; f(yield v) })", "The keyword 'yield' is
testFail("var obj = { *test** }", "Unexpected token (1:17)", {ecmaVersion: 6});
-testFail("class A extends yield B { }", "Unexpected token (1:22)", {ecmaVersion: 6});
+testFail("class A extends yield B { }", "The keyword 'yield' is reserved (1:16)", {ecmaVersion: 6});
testFail("class default", "Unexpected token (1:6)", {ecmaVersion: 6});
+testFail("class let {}", "The keyword 'let' is reserved (1:6)", {ecmaVersion: 6})
+
testFail("`test", "Unterminated template (1:1)", {ecmaVersion: 6});
testFail("switch `test`", "Unexpected token (1:7)", {ecmaVersion: 6});
@@ -14523,7 +14805,7 @@ testFail("var [x]", "Complex binding patterns require an initialization value (1
testFail("var _𖫵 = 11;", "Unexpected character '𖫵' (1:5)", {ecmaVersion: 6});
testFail("var 𫠞_ = 12;", "Unexpected character '𫠞' (1:4)", {ecmaVersion: 6});
testFail("var 𫠝_ = 10;", "Unexpected character '𫠝' (1:4)", {ecmaVersion: 5});
-testFail("if (1) let x = 10;", "Unexpected token (1:7)", {ecmaVersion: 6});
+testFail("if (1) let x = 10;", "Unexpected token (1:11)", {ecmaVersion: 6});
testFail("for (;;) const x = 10;", "Unexpected token (1:9)", {ecmaVersion: 6});
testFail("while (1) function foo(){}", "Unexpected token (1:10)", {ecmaVersion: 6});
testFail("if (1) ; else class Cls {}", "Unexpected token (1:14)", {ecmaVersion: 6});
@@ -14533,7 +14815,7 @@ testFail("'use strict'; ({eval = defValue} = obj)", "Assigning to eval in strict
testFail("[...eval] = arr", "Assigning to eval in strict mode (1:4)", {ecmaVersion: 6, sourceType: "module"});
-testFail("function* y({yield}) {}", "Can not use 'yield' as identifier inside a generator (1:13)", {ecmaVersion: 6});
+testFail("function* y({yield}) {}", "Cannot use 'yield' as identifier inside a generator (1:13)", {ecmaVersion: 6});
test("function foo() { new.target; }", {
type: "Program",
@@ -14750,7 +15032,7 @@ test("var await = 0", {
allowReserved: false,
locations: true
})
-testFail("var await = 0", "Can not use keyword 'await' outside an async function (1:4)", {
+testFail("var await = 0", "Cannot use keyword 'await' outside an async function (1:4)", {
ecmaVersion: 6,
sourceType: "module",
allowReserved: false,
@@ -15395,8 +15677,9 @@ test("class A {*yield() {}}", {
"sourceType": "script"
}, {ecmaVersion: 6})
-testFail("(function* yield() {})", "Can not use 'yield' as identifier inside a generator (1:11)", {ecmaVersion: 6})
-testFail("function* wrap() {\nfunction* yield() {}\n}", "Can not use 'yield' as identifier inside a generator (2:10)", {ecmaVersion: 6})
+testFail("(function* g() {\nfor (yield '' in {}; ; ) ;\n }", "Assigning to rvalue (2:5)", {ecmaVersion: 6})
+testFail("(function* yield() {})", "Cannot use 'yield' as identifier inside a generator (1:11)", {ecmaVersion: 6})
+testFail("function* wrap() {\nfunction* yield() {}\n}", "Cannot use 'yield' as identifier inside a generator (2:10)", {ecmaVersion: 6})
test("function* wrap() {\n({*yield() {}})\n}", {}, {ecmaVersion: 6})
test("function* wrap() {\nclass A {*yield() {}}\n}", {}, {ecmaVersion: 6})
@@ -15936,9 +16219,12 @@ testFail("export { default} from './y.js';\nexport default 42;",
testFail("export * from foo", "Unexpected token (1:14)", {sourceType: "module", ecmaVersion: 6, loose: false});
testFail("export { bar } from foo", "Unexpected token (1:20)", {sourceType: "module", ecmaVersion: 6, loose: false});
-testFail("foo: class X {}", "Invalid labeled declaration (1:5)", {ecmaVersion: 6})
+testFail("foo: class X {}", "Unexpected token (1:5)", {ecmaVersion: 6})
+
+testFail("'use strict'; bar: function x() {}", "Unexpected token (1:19)", {ecmaVersion: 6})
-testFail("'use strict'; bar: function x() {}", "Invalid labeled declaration (1:19)", {ecmaVersion: 6})
+testFail("'use strict'; bar: function* x() {}", "Unexpected token (1:19)", {ecmaVersion: 6})
+testFail("bar: function* x() {}", "Unexpected token (1:13)", {ecmaVersion: 6})
testFail("({x, y}) = {}", "Parenthesized pattern (1:0)", {ecmaVersion: 6})
@@ -15950,8 +16236,16 @@ testFail("var foo = 1; let foo = 1;", "Identifier 'foo' has already been declare
testFail("{ var foo = 1; let foo = 1; }", "Identifier 'foo' has already been declared (1:19)", {ecmaVersion: 6})
+testFail("let bar; var foo = 1; let foo = 1;", "Identifier 'foo' has already been declared (1:26)", {ecmaVersion: 6})
+
+testFail("{ let bar; var foo = 1; let foo = 1; }", "Identifier 'foo' has already been declared (1:28)", {ecmaVersion: 6})
+
testFail("let foo = 1; var foo = 1;", "Identifier 'foo' has already been declared (1:17)", {ecmaVersion: 6})
+testFail("let bar; let foo = 1; var foo = 1;", "Identifier 'foo' has already been declared (1:26)", {ecmaVersion: 6})
+
+testFail("{ let bar; let foo = 1; var foo = 1; }", "Identifier 'foo' has already been declared (1:28)", {ecmaVersion: 6})
+
testFail("let foo = 1; let foo = 1;", "Identifier 'foo' has already been declared (1:17)", {ecmaVersion: 6})
testFail("var foo = 1; const foo = 1;", "Identifier 'foo' has already been declared (1:19)", {ecmaVersion: 6})
@@ -16058,6 +16352,8 @@ test("for (var {a} of /b/) {}", {}, {ecmaVersion: 6})
test("for (let {a} of /b/) {}", {}, {ecmaVersion: 6})
+test("for (const {a} of /b/) {}", {}, {ecmaVersion: 6})
+
test("function* bar() { yield /re/ }", {}, {ecmaVersion: 6})
test("function* bar() { yield class {} }", {}, {ecmaVersion: 6})
@@ -16070,6 +16366,22 @@ testFail("(x) => {} + 2", "Unexpected token (1:10)", {ecmaVersion: 6})
test("function *f1() { function g() { return yield / 1 } }", {}, {ecmaVersion: 6})
+test("function f() {} function f() {}", {}, {ecmaVersion: 6})
+
+test("function *f() {} function *f() {}", {}, {ecmaVersion: 6})
+
+// Annex B allows function redeclaration for plain functions in sloppy mode
+test("{ function f() {} function f() {} }", {}, {ecmaVersion: 6})
+
+testFail("'use strict'; { function f() {} function f() {} }",
+ "Identifier 'f' has already been declared (1:41)", {ecmaVersion: 6})
+
+testFail("{ function f() {} function* f() {} }",
+ "Identifier 'f' has already been declared (1:28)", {ecmaVersion: 6})
+
+testFail("{ function* f() {} function f() {} }",
+ "Identifier 'f' has already been declared (1:28)", {ecmaVersion: 6})
+
test("class Foo {} /regexp/", {}, {ecmaVersion: 6})
test("(class Foo {} / 2)", {}, {ecmaVersion: 6})
@@ -16091,7 +16403,7 @@ testFail("class A extends B { constructor() { (super)() } }", "Unexpected token
testFail("class A extends B { foo() { (super).foo } }", "Unexpected token (1:34)", { ecmaVersion: 6 })
test("({super: 1})", {}, { ecmaVersion: 6 })
test("import {super as a} from 'a'", {}, { ecmaVersion: 6, sourceType: "module" })
-test("export {a as super}", {}, { ecmaVersion: 6, sourceType: "module" })
+test("function a() {} export {a as super}", {}, { ecmaVersion: 6, sourceType: "module" })
test("let instanceof Foo", {
"type": "Program",
"start": 0,
diff --git a/test/tests-regexp-2018.js b/test/tests-regexp-2018.js
index 0a48fab..1e0f3db 100644
--- a/test/tests-regexp-2018.js
+++ b/test/tests-regexp-2018.js
@@ -96,7 +96,7 @@ testFail("/\\p{General_Category/u", "Invalid regular expression: /\\p{General_Ca
testFail("/\\p{General_Category=/u", "Invalid regular expression: /\\p{General_Category=/: Invalid property name (1:1)", { ecmaVersion: 2018 })
testFail("/\\p{General_Category=Letter/u", "Invalid regular expression: /\\p{General_Category=Letter/: Invalid property name (1:1)", { ecmaVersion: 2018 })
test("/\\p{General_Category=Letter}/u", {}, { ecmaVersion: 2018 })
-testFail("/\\p{General_Category=Hiragana}/u", "Invalid regular expression: /\\p{General_Category=Hiragana}/: Invalid property name (1:1)", { ecmaVersion: 2018 })
+testFail("/\\p{General_Category=Hiragana}/u", "Invalid regular expression: /\\p{General_Category=Hiragana}/: Invalid property value (1:1)", { ecmaVersion: 2018 })
test("/\\p{Script=Hiragana}/u", {}, { ecmaVersion: 2018 })
testFail("/[\\p{Script=Hiragana}-\\p{Script=Katakana}]/u", "Invalid regular expression: /[\\p{Script=Hiragana}-\\p{Script=Katakana}]/: Invalid character class (1:1)", { ecmaVersion: 2018 })
test("/[\\p{Script=Hiragana}\\-\\p{Script=Katakana}]/u", {}, { ecmaVersion: 2018 })
diff --git a/test/tests.js b/test/tests.js
deleted file mode 100644
index 633708e..0000000
--- a/test/tests.js
+++ /dev/null
@@ -1,29316 +0,0 @@
-// Tests largely based on those of Esprima
-// (http://esprima.org/test/)
-
-if (typeof exports != "undefined") {
- var driver = require("./driver.js");
- var test = driver.test, testFail = driver.testFail, testAssert = driver.testAssert, misMatch = driver.misMatch;
- var acorn = require("../acorn");
-}
-
-test("this\n", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "ThisExpression",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 0
- }
- }
-});
-
-test("null\n", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: null,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 0
- }
- }
-});
-
-test("\n 42\n\n", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 2,
- column: 4
- },
- end: {
- line: 2,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 2,
- column: 4
- },
- end: {
- line: 2,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 4,
- column: 0
- }
- }
-});
-
-test("/foobar/", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: /foobar/,
- regex: {
- pattern: "foobar",
- flags: ""
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- }
- }
- ]
-});
-
-test("/[a-z]/g", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: /[a-z]/g,
- regex: {
- pattern: "[a-z]",
- flags: "g"
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- }
- }
- ]
-});
-
-test("(1 + 2 ) * 3", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "BinaryExpression",
- left: {
- type: "Literal",
- value: 1,
- loc: {
- start: {
- line: 1,
- column: 1
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- operator: "+",
- right: {
- type: "Literal",
- value: 2,
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 1
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- operator: "*",
- right: {
- type: "Literal",
- value: 3,
- loc: {
- start: {
- line: 1,
- column: 11
- },
- end: {
- line: 1,
- column: 12
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 12
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 12
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 12
- }
- }
-});
-
-test("(1 + 2 ) * 3", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "ParenthesizedExpression",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Literal",
- value: 1,
- loc: {
- start: {
- line: 1,
- column: 1
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- operator: "+",
- right: {
- type: "Literal",
- value: 2,
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 1
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- operator: "*",
- right: {
- type: "Literal",
- value: 3,
- loc: {
- start: {
- line: 1,
- column: 11
- },
- end: {
- line: 1,
- column: 12
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 12
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 12
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 12
- }
- }
-}, {
- locations: true,
- preserveParens: true
-});
-
-test("(x = 23)", {
- body: [
- {
- expression: {
- type: "ParenthesizedExpression",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- name: "x",
- type: "Identifier",
- },
- right: {
- value: 23,
- raw: "23",
- type: "Literal",
- },
- },
- },
- type: "ExpressionStatement",
- }
- ],
- type: "Program",
-}, {preserveParens: true});
-
-test("x = []", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ArrayExpression",
- elements: [],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
-});
-
-test("x = [ ]", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ArrayExpression",
- elements: [],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
-});
-
-test("x = [ 42 ]", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ArrayExpression",
- elements: [
- {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 8
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 10
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 10
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 10
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 10
- }
- }
-});
-
-test("x = [ 42, ]", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ArrayExpression",
- elements: [
- {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 8
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
-});
-
-test("x = [ ,, 42 ]", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ArrayExpression",
- elements: [
- null,
- null,
- {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 11
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 13
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
-});
-
-test("x = [ 1, 2, 3, ]", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ArrayExpression",
- elements: [
- {
- type: "Literal",
- value: 1,
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- {
- type: "Literal",
- value: 2,
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 10
- }
- }
- },
- {
- type: "Literal",
- value: 3,
- loc: {
- start: {
- line: 1,
- column: 12
- },
- end: {
- line: 1,
- column: 13
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
-});
-
-test("x = [ 1, 2,, 3, ]", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ArrayExpression",
- elements: [
- {
- type: "Literal",
- value: 1,
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- {
- type: "Literal",
- value: 2,
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 10
- }
- }
- },
- null,
- {
- type: "Literal",
- value: 3,
- loc: {
- start: {
- line: 1,
- column: 13
- },
- end: {
- line: 1,
- column: 14
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 17
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 17
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 17
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 17
- }
- }
-});
-
-test("日本語 = []", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "日本語",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
- },
- right: {
- type: "ArrayExpression",
- elements: [],
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
-});
-
-test("T‿ = []", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "T‿",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- right: {
- type: "ArrayExpression",
- elements: [],
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
-});
-
-test("T‌ = []", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "T‌",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- right: {
- type: "ArrayExpression",
- elements: [],
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
-});
-
-test("T‍ = []", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "T‍",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- right: {
- type: "ArrayExpression",
- elements: [],
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
-});
-
-test("ⅣⅡ = []", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "ⅣⅡ",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- right: {
- type: "ArrayExpression",
- elements: [],
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
-});
-
-test("ⅣⅡ = []", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "ⅣⅡ",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- right: {
- type: "ArrayExpression",
- elements: [],
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
-});
-
-test("x = {}", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
-});
-
-test("x = { }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
-});
-
-test("x = { answer: 42 }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "answer",
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 12
- }
- }
- },
- value: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 14
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- kind: "init"
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 18
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 18
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 18
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 18
- }
- }
-});
-
-test("x = { if: 42 }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "if",
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- value: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 12
- }
- }
- },
- kind: "init"
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
-});
-
-test("x = { true: 42 }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "true",
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 10
- }
- }
- },
- value: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 12
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- kind: "init"
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
-});
-
-test("x = { false: 42 }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "false",
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- value: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 13
- },
- end: {
- line: 1,
- column: 15
- }
- }
- },
- kind: "init"
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 17
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 17
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 17
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 17
- }
- }
-});
-
-test("x = { null: 42 }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "null",
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 10
- }
- }
- },
- value: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 12
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- kind: "init"
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
-});
-
-test("x = { \"answer\": 42 }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Literal",
- value: "answer",
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- value: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 16
- },
- end: {
- line: 1,
- column: 18
- }
- }
- },
- kind: "init"
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 20
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 20
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 20
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 20
- }
- }
-});
-
-test("x = { x: 1, x: 2 }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- value: {
- type: "Literal",
- value: 1,
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 10
- }
- }
- },
- kind: "init"
- },
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 12
- },
- end: {
- line: 1,
- column: 13
- }
- }
- },
- value: {
- type: "Literal",
- value: 2,
- loc: {
- start: {
- line: 1,
- column: 15
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- kind: "init"
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 18
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 18
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 18
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 18
- }
- }
-});
-
-test("x = { get width() { return m_width } }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "width",
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 15
- }
- }
- },
- kind: "get",
- value: {
- type: "FunctionExpression",
- id: null,
- params: [],
- body: {
- type: "BlockStatement",
- body: [
- {
- type: "ReturnStatement",
- argument: {
- type: "Identifier",
- name: "m_width",
- loc: {
- start: {
- line: 1,
- column: 27
- },
- end: {
- line: 1,
- column: 34
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 20
- },
- end: {
- line: 1,
- column: 34
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 18
- },
- end: {
- line: 1,
- column: 36
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 15
- },
- end: {
- line: 1,
- column: 36
- }
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 38
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 38
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 38
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 38
- }
- }
-});
-
-test("x = { get undef() {} }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "undef",
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 15
- }
- }
- },
- kind: "get",
- value: {
- type: "FunctionExpression",
- id: null,
- params: [],
- body: {
- type: "BlockStatement",
- body: [],
- loc: {
- start: {
- line: 1,
- column: 18
- },
- end: {
- line: 1,
- column: 20
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 15
- },
- end: {
- line: 1,
- column: 20
- }
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 22
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 22
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 22
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 22
- }
- }
-});
-
-test("x = { get if() {} }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "if",
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 12
- }
- }
- },
- kind: "get",
- value: {
- type: "FunctionExpression",
- id: null,
- params: [],
- body: {
- type: "BlockStatement",
- body: [],
- loc: {
- start: {
- line: 1,
- column: 15
- },
- end: {
- line: 1,
- column: 17
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 12
- },
- end: {
- line: 1,
- column: 17
- }
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 19
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 19
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 19
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 19
- }
- }
-});
-
-test("x = { get true() {} }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "true",
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- kind: "get",
- value: {
- type: "FunctionExpression",
- id: null,
- params: [],
- body: {
- type: "BlockStatement",
- body: [],
- loc: {
- start: {
- line: 1,
- column: 17
- },
- end: {
- line: 1,
- column: 19
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 14
- },
- end: {
- line: 1,
- column: 19
- }
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 21
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 21
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 21
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 21
- }
- }
-});
-
-test("x = { get false() {} }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "false",
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 15
- }
- }
- },
- kind: "get",
- value: {
- type: "FunctionExpression",
- id: null,
- params: [],
- body: {
- type: "BlockStatement",
- body: [],
- loc: {
- start: {
- line: 1,
- column: 18
- },
- end: {
- line: 1,
- column: 20
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 15
- },
- end: {
- line: 1,
- column: 20
- }
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 22
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 22
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 22
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 22
- }
- }
-});
-
-test("x = { get null() {} }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "null",
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- kind: "get",
- value: {
- type: "FunctionExpression",
- id: null,
- params: [],
- body: {
- type: "BlockStatement",
- body: [],
- loc: {
- start: {
- line: 1,
- column: 17
- },
- end: {
- line: 1,
- column: 19
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 14
- },
- end: {
- line: 1,
- column: 19
- }
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 21
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 21
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 21
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 21
- }
- }
-});
-
-test("x = { get \"undef\"() {} }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Literal",
- value: "undef",
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 17
- }
- }
- },
- kind: "get",
- value: {
- type: "FunctionExpression",
- id: null,
- params: [],
- body: {
- type: "BlockStatement",
- body: [],
- loc: {
- start: {
- line: 1,
- column: 20
- },
- end: {
- line: 1,
- column: 22
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 17
- },
- end: {
- line: 1,
- column: 22
- }
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 24
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 24
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 24
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 24
- }
- }
-});
-
-test("x = { get 10() {} }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Literal",
- value: 10,
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 12
- }
- }
- },
- kind: "get",
- value: {
- type: "FunctionExpression",
- id: null,
- params: [],
- body: {
- type: "BlockStatement",
- body: [],
- loc: {
- start: {
- line: 1,
- column: 15
- },
- end: {
- line: 1,
- column: 17
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 12
- },
- end: {
- line: 1,
- column: 17
- }
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 19
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 19
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 19
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 19
- }
- }
-});
-
-test("x = { set width(w) { m_width = w } }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "width",
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 15
- }
- }
- },
- kind: "set",
- value: {
- type: "FunctionExpression",
- id: null,
- params: [
- {
- type: "Identifier",
- name: "w",
- loc: {
- start: {
- line: 1,
- column: 16
- },
- end: {
- line: 1,
- column: 17
- }
- }
- }
- ],
- body: {
- type: "BlockStatement",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "m_width",
- loc: {
- start: {
- line: 1,
- column: 21
- },
- end: {
- line: 1,
- column: 28
- }
- }
- },
- right: {
- type: "Identifier",
- name: "w",
- loc: {
- start: {
- line: 1,
- column: 31
- },
- end: {
- line: 1,
- column: 32
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 21
- },
- end: {
- line: 1,
- column: 32
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 21
- },
- end: {
- line: 1,
- column: 32
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 19
- },
- end: {
- line: 1,
- column: 34
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 15
- },
- end: {
- line: 1,
- column: 34
- }
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 36
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 36
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 36
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 36
- }
- }
-});
-
-test("x = { set if(w) { m_if = w } }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "if",
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 12
- }
- }
- },
- kind: "set",
- value: {
- type: "FunctionExpression",
- id: null,
- params: [
- {
- type: "Identifier",
- name: "w",
- loc: {
- start: {
- line: 1,
- column: 13
- },
- end: {
- line: 1,
- column: 14
- }
- }
- }
- ],
- body: {
- type: "BlockStatement",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "m_if",
- loc: {
- start: {
- line: 1,
- column: 18
- },
- end: {
- line: 1,
- column: 22
- }
- }
- },
- right: {
- type: "Identifier",
- name: "w",
- loc: {
- start: {
- line: 1,
- column: 25
- },
- end: {
- line: 1,
- column: 26
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 18
- },
- end: {
- line: 1,
- column: 26
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 18
- },
- end: {
- line: 1,
- column: 26
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 16
- },
- end: {
- line: 1,
- column: 28
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 12
- },
- end: {
- line: 1,
- column: 28
- }
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 30
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 30
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 30
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 30
- }
- }
-});
-
-test("x = { set true(w) { m_true = w } }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "true",
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- kind: "set",
- value: {
- type: "FunctionExpression",
- id: null,
- params: [
- {
- type: "Identifier",
- name: "w",
- loc: {
- start: {
- line: 1,
- column: 15
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- body: {
- type: "BlockStatement",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "m_true",
- loc: {
- start: {
- line: 1,
- column: 20
- },
- end: {
- line: 1,
- column: 26
- }
- }
- },
- right: {
- type: "Identifier",
- name: "w",
- loc: {
- start: {
- line: 1,
- column: 29
- },
- end: {
- line: 1,
- column: 30
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 20
- },
- end: {
- line: 1,
- column: 30
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 20
- },
- end: {
- line: 1,
- column: 30
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 18
- },
- end: {
- line: 1,
- column: 32
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 14
- },
- end: {
- line: 1,
- column: 32
- }
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 34
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 34
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 34
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 34
- }
- }
-});
-
-test("x = { set false(w) { m_false = w } }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "false",
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 15
- }
- }
- },
- kind: "set",
- value: {
- type: "FunctionExpression",
- id: null,
- params: [
- {
- type: "Identifier",
- name: "w",
- loc: {
- start: {
- line: 1,
- column: 16
- },
- end: {
- line: 1,
- column: 17
- }
- }
- }
- ],
- body: {
- type: "BlockStatement",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "m_false",
- loc: {
- start: {
- line: 1,
- column: 21
- },
- end: {
- line: 1,
- column: 28
- }
- }
- },
- right: {
- type: "Identifier",
- name: "w",
- loc: {
- start: {
- line: 1,
- column: 31
- },
- end: {
- line: 1,
- column: 32
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 21
- },
- end: {
- line: 1,
- column: 32
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 21
- },
- end: {
- line: 1,
- column: 32
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 19
- },
- end: {
- line: 1,
- column: 34
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 15
- },
- end: {
- line: 1,
- column: 34
- }
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 36
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 36
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 36
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 36
- }
- }
-});
-
-test("x = { set null(w) { m_null = w } }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "null",
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- kind: "set",
- value: {
- type: "FunctionExpression",
- id: null,
- params: [
- {
- type: "Identifier",
- name: "w",
- loc: {
- start: {
- line: 1,
- column: 15
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- body: {
- type: "BlockStatement",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "m_null",
- loc: {
- start: {
- line: 1,
- column: 20
- },
- end: {
- line: 1,
- column: 26
- }
- }
- },
- right: {
- type: "Identifier",
- name: "w",
- loc: {
- start: {
- line: 1,
- column: 29
- },
- end: {
- line: 1,
- column: 30
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 20
- },
- end: {
- line: 1,
- column: 30
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 20
- },
- end: {
- line: 1,
- column: 30
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 18
- },
- end: {
- line: 1,
- column: 32
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 14
- },
- end: {
- line: 1,
- column: 32
- }
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 34
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 34
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 34
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 34
- }
- }
-});
-
-test("x = { set \"null\"(w) { m_null = w } }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Literal",
- value: "null",
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- kind: "set",
- value: {
- type: "FunctionExpression",
- id: null,
- params: [
- {
- type: "Identifier",
- name: "w",
- loc: {
- start: {
- line: 1,
- column: 17
- },
- end: {
- line: 1,
- column: 18
- }
- }
- }
- ],
- body: {
- type: "BlockStatement",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "m_null",
- loc: {
- start: {
- line: 1,
- column: 22
- },
- end: {
- line: 1,
- column: 28
- }
- }
- },
- right: {
- type: "Identifier",
- name: "w",
- loc: {
- start: {
- line: 1,
- column: 31
- },
- end: {
- line: 1,
- column: 32
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 22
- },
- end: {
- line: 1,
- column: 32
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 22
- },
- end: {
- line: 1,
- column: 32
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 20
- },
- end: {
- line: 1,
- column: 34
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 16
- },
- end: {
- line: 1,
- column: 34
- }
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 36
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 36
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 36
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 36
- }
- }
-});
-
-test("x = { set 10(w) { m_null = w } }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Literal",
- value: 10,
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 12
- }
- }
- },
- kind: "set",
- value: {
- type: "FunctionExpression",
- id: null,
- params: [
- {
- type: "Identifier",
- name: "w",
- loc: {
- start: {
- line: 1,
- column: 13
- },
- end: {
- line: 1,
- column: 14
- }
- }
- }
- ],
- body: {
- type: "BlockStatement",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "m_null",
- loc: {
- start: {
- line: 1,
- column: 18
- },
- end: {
- line: 1,
- column: 24
- }
- }
- },
- right: {
- type: "Identifier",
- name: "w",
- loc: {
- start: {
- line: 1,
- column: 27
- },
- end: {
- line: 1,
- column: 28
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 18
- },
- end: {
- line: 1,
- column: 28
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 18
- },
- end: {
- line: 1,
- column: 28
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 16
- },
- end: {
- line: 1,
- column: 30
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 12
- },
- end: {
- line: 1,
- column: 30
- }
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 32
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 32
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 32
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 32
- }
- }
-});
-
-test("x = { get: 42 }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "get",
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- value: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 11
- },
- end: {
- line: 1,
- column: 13
- }
- }
- },
- kind: "init"
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 15
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 15
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 15
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 15
- }
- }
-});
-
-test("x = { set: 43 }", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "AssignmentExpression",
- operator: "=",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- right: {
- type: "ObjectExpression",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "set",
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- value: {
- type: "Literal",
- value: 43,
- loc: {
- start: {
- line: 1,
- column: 11
- },
- end: {
- line: 1,
- column: 13
- }
- }
- },
- kind: "init"
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 15
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 15
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 15
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 15
- }
- }
-});
-
-test("/* block comment */ 42", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 20
- },
- end: {
- line: 1,
- column: 22
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 20
- },
- end: {
- line: 1,
- column: 22
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 22
- }
- }
-});
-
-test("42 /*The*/ /*Answer*/", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 21
- }
- }
-});
-
-test("42 /*the*/ /*answer*/", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 21
- }
- }
-});
-
-test("/* multiline\ncomment\nshould\nbe\nignored */ 42", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 5,
- column: 11
- },
- end: {
- line: 5,
- column: 13
- }
- }
- },
- loc: {
- start: {
- line: 5,
- column: 11
- },
- end: {
- line: 5,
- column: 13
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 5,
- column: 13
- }
- }
-});
-
-test("/*a\r\nb*/ 42", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 2,
- column: 4
- },
- end: {
- line: 2,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 2,
- column: 4
- },
- end: {
- line: 2,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 6
- }
- }
-});
-
-test("/*a\rb*/ 42", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 2,
- column: 4
- },
- end: {
- line: 2,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 2,
- column: 4
- },
- end: {
- line: 2,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 6
- }
- }
-});
-
-test("/*a\nb*/ 42", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 2,
- column: 4
- },
- end: {
- line: 2,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 2,
- column: 4
- },
- end: {
- line: 2,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 6
- }
- }
-});
-
-test("/*a\nc*/ 42", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 2,
- column: 4
- },
- end: {
- line: 2,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 2,
- column: 4
- },
- end: {
- line: 2,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 6
- }
- }
-});
-
-test("// line comment\n42", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 2,
- column: 0
- },
- end: {
- line: 2,
- column: 2
- }
- }
- },
- loc: {
- start: {
- line: 2,
- column: 0
- },
- end: {
- line: 2,
- column: 2
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 2
- }
- }
-});
-
-test("42 // line comment", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 18
- }
- }
-});
-
-test("// Hello, world!\n42", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 2,
- column: 0
- },
- end: {
- line: 2,
- column: 2
- }
- }
- },
- loc: {
- start: {
- line: 2,
- column: 0
- },
- end: {
- line: 2,
- column: 2
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 2
- }
- }
-});
-
-test("// Hello, world!\n", {
- type: "Program",
- body: [],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 0
- }
- }
-});
-
-test("// Hallo, world!\n", {
- type: "Program",
- body: [],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 0
- }
- }
-});
-
-test("//\n42", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 2,
- column: 0
- },
- end: {
- line: 2,
- column: 2
- }
- }
- },
- loc: {
- start: {
- line: 2,
- column: 0
- },
- end: {
- line: 2,
- column: 2
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 2
- }
- }
-});
-
-test("//", {
- type: "Program",
- body: [],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
-});
-
-test("// ", {
- type: "Program",
- body: [],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
-});
-
-test("/**/42", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
-});
-
-test("// Hello, world!\n\n// Another hello\n42", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 4,
- column: 0
- },
- end: {
- line: 4,
- column: 2
- }
- }
- },
- loc: {
- start: {
- line: 4,
- column: 0
- },
- end: {
- line: 4,
- column: 2
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 4,
- column: 2
- }
- }
-});
-
-test("if (x) { // Some comment\ndoThat(); }", {
- type: "Program",
- body: [
- {
- type: "IfStatement",
- test: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- consequent: {
- type: "BlockStatement",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "CallExpression",
- callee: {
- type: "Identifier",
- name: "doThat",
- loc: {
- start: {
- line: 2,
- column: 0
- },
- end: {
- line: 2,
- column: 6
- }
- }
- },
- arguments: [],
- loc: {
- start: {
- line: 2,
- column: 0
- },
- end: {
- line: 2,
- column: 8
- }
- }
- },
- loc: {
- start: {
- line: 2,
- column: 0
- },
- end: {
- line: 2,
- column: 9
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 7
- },
- end: {
- line: 2,
- column: 11
- }
- }
- },
- alternate: null,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 11
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 11
- }
- }
-});
-
-test("switch (answer) { case 42: /* perfect */ bingo() }", {
- type: "Program",
- body: [
- {
- type: "SwitchStatement",
- discriminant: {
- type: "Identifier",
- name: "answer",
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- cases: [
- {
- type: "SwitchCase",
- consequent: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "CallExpression",
- callee: {
- type: "Identifier",
- name: "bingo",
- loc: {
- start: {
- line: 1,
- column: 41
- },
- end: {
- line: 1,
- column: 46
- }
- }
- },
- arguments: [],
- loc: {
- start: {
- line: 1,
- column: 41
- },
- end: {
- line: 1,
- column: 48
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 41
- },
- end: {
- line: 1,
- column: 48
- }
- }
- }
- ],
- test: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 23
- },
- end: {
- line: 1,
- column: 25
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 18
- },
- end: {
- line: 1,
- column: 48
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 50
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 50
- }
- }
-});
-
-test("0", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 0,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
-});
-
-test("3", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 3,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
-});
-
-test("5", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 5,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
-});
-
-test("42", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
-});
-
-test(".14", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 0.14,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
-});
-
-test("3.14159", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 3.14159,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
-});
-
-test("6.02214179e+23", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 6.02214179e+23,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
-});
-
-test("1.492417830e-10", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 1.49241783e-10,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 15
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 15
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 15
- }
- }
-});
-
-test("0x0", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 0,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
-});
-
-test("0e+100", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 0,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
-});
-
-test("0xabc", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 2748,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
-});
-
-test("0xdef", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 3567,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
-});
-
-test("0X1A", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 26,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
-});
-
-test("0x10", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 16,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
-});
-
-test("0x100", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 256,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
-});
-
-test("0X04", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 4,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
-});
-
-test("02", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 2,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
-});
-
-test("012", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 10,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
-});
-
-test("0012", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: 10,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
-});
-
-test("\"Hello\"", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: "Hello",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
-});
-
-test("\"\\n\\r\\t\\v\\b\\f\\\\\\'\\\"\\0\"", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: "\n\r\t\u000b\b\f\\'\"\u0000",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 22
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 22
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 22
- }
- }
-});
-
-test("\"\\u0061\"", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: "a",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
-});
-
-test("\"\\x61\"", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: "a",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
-});
-
-test("\"Hello\\nworld\"", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: "Hello\nworld",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
-});
-
-test("\"Hello\\\nworld\"", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: "Helloworld",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 6
- }
- }
-});
-
-test("\"Hello\\02World\"", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: "Hello\u0002World",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 15
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 15
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 15
- }
- }
-});
-
-test("\"Hello\\012World\"", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: "Hello\nWorld",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
-});
-
-test("\"Hello\\122World\"", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: "HelloRWorld",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
-});
-
-test("\"Hello\\0122World\"", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: "Hello\n2World",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 17
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 17
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 17
- }
- }
-});
-
-test("\"Hello\\312World\"", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: "HelloÊWorld",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
-});
-
-test("\"Hello\\412World\"", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: "Hello!2World",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
-});
-
-test("\"Hello\\812World\"", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: "Hello812World",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
-});
-
-test("\"Hello\\712World\"", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: "Hello92World",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
-});
-
-test("\"Hello\\0World\"", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: "Hello\u0000World",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
-});
-
-test("\"Hello\\\r\nworld\"", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: "Helloworld",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 2,
- column: 6
- }
- }
-});
-
-test("\"Hello\\1World\"", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "Literal",
- value: "Hello\u0001World",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
-});
-
-test("var x = /[a-z]/i", {
- type: "Program",
- body: [
- {
- type: "VariableDeclaration",
- declarations: [
- {
- type: "VariableDeclarator",
- id: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- init: {
- type: "Literal",
- value: /[a-z]/i,
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- kind: "var",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
-});
-
-test("var x = /[x-z]/i", {
- type: "Program",
- body: [
- {
- type: "VariableDeclaration",
- declarations: [
- {
- type: "VariableDeclarator",
- id: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- init: {
- type: "Literal",
- value: /[x-z]/i,
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- kind: "var",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
-});
-
-test("var x = /[a-c]/i", {
- type: "Program",
- body: [
- {
- type: "VariableDeclaration",
- declarations: [
- {
- type: "VariableDeclarator",
- id: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- init: {
- type: "Literal",
- value: /[a-c]/i,
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- kind: "var",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
-});
-
-test("var x = /[P QR]/i", {
- type: "Program",
- body: [
- {
- type: "VariableDeclaration",
- declarations: [
- {
- type: "VariableDeclarator",
- id: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- init: {
- type: "Literal",
- value: /[P QR]/i,
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 17
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 17
- }
- }
- }
- ],
- kind: "var",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 17
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 17
- }
- }
-});
-
-test("var x = /foo\\/bar/", {
- type: "Program",
- body: [
- {
- type: "VariableDeclaration",
- declarations: [
- {
- type: "VariableDeclarator",
- id: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- init: {
- type: "Literal",
- value: /foo\/bar/,
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 18
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 18
- }
- }
- }
- ],
- kind: "var",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 18
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 18
- }
- }
-});
-
-test("var x = /=([^=\\s])+/g", {
- type: "Program",
- body: [
- {
- type: "VariableDeclaration",
- declarations: [
- {
- type: "VariableDeclarator",
- id: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- init: {
- type: "Literal",
- value: /=([^=\s])+/g,
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 21
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 21
- }
- }
- }
- ],
- kind: "var",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 21
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 21
- }
- }
-});
-
-testFail("var x = /[P QR]/\\u0067", "Unexpected token (1:16)");
-
-test("new Button", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "NewExpression",
- callee: {
- type: "Identifier",
- name: "Button",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 10
- }
- }
- },
- arguments: [],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 10
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 10
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 10
- }
- }
-});
-
-test("new Button()", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "NewExpression",
- callee: {
- type: "Identifier",
- name: "Button",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 10
- }
- }
- },
- arguments: [],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 12
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 12
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 12
- }
- }
-});
-
-test("new new foo", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "NewExpression",
- callee: {
- type: "NewExpression",
- callee: {
- type: "Identifier",
- name: "foo",
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- arguments: [],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- arguments: [],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
-});
-
-test("new new foo()", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "NewExpression",
- callee: {
- type: "NewExpression",
- callee: {
- type: "Identifier",
- name: "foo",
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- arguments: [],
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 13
- }
- }
- },
- arguments: [],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
-});
-
-test("new foo().bar()", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "CallExpression",
- callee: {
- type: "MemberExpression",
- object: {
- type: "NewExpression",
- callee: {
- type: "Identifier",
- name: "foo",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- arguments: [],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- property: {
- type: "Identifier",
- name: "bar",
- loc: {
- start: {
- line: 1,
- column: 10
- },
- end: {
- line: 1,
- column: 13
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
- },
- arguments: [],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 15
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 15
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 15
- }
- }
-});
-
-test("new foo[bar]", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "NewExpression",
- callee: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: "foo",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- property: {
- type: "Identifier",
- name: "bar",
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- computed: true,
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 12
- }
- }
- },
- arguments: [],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 12
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 12
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 12
- }
- }
-});
-
-test("new foo.bar()", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "NewExpression",
- callee: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: "foo",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- property: {
- type: "Identifier",
- name: "bar",
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- arguments: [],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
-});
-
-test("( new foo).bar()", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "CallExpression",
- callee: {
- type: "MemberExpression",
- object: {
- type: "NewExpression",
- callee: {
- type: "Identifier",
- name: "foo",
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- arguments: [],
- loc: {
- start: {
- line: 1,
- column: 2
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- property: {
- type: "Identifier",
- name: "bar",
- loc: {
- start: {
- line: 1,
- column: 11
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- arguments: [],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 16
- }
- }
-});
-
-test("foo(bar, baz)", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "CallExpression",
- callee: {
- type: "Identifier",
- name: "foo",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
- },
- arguments: [
- {
- type: "Identifier",
- name: "bar",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- {
- type: "Identifier",
- name: "baz",
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 12
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
-});
-
-test("( foo )()", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "CallExpression",
- callee: {
- type: "Identifier",
- name: "foo",
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- arguments: [],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
-});
-
-test("universe.milkyway", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: "universe",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- property: {
- type: "Identifier",
- name: "milkyway",
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 17
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 17
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 17
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 17
- }
- }
-});
-
-test("universe.milkyway.solarsystem", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "MemberExpression",
- object: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: "universe",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- property: {
- type: "Identifier",
- name: "milkyway",
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 17
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 17
- }
- }
- },
- property: {
- type: "Identifier",
- name: "solarsystem",
- loc: {
- start: {
- line: 1,
- column: 18
- },
- end: {
- line: 1,
- column: 29
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 29
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 29
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 29
- }
- }
-});
-
-test("universe.milkyway.solarsystem.Earth", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "MemberExpression",
- object: {
- type: "MemberExpression",
- object: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: "universe",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- property: {
- type: "Identifier",
- name: "milkyway",
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 17
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 17
- }
- }
- },
- property: {
- type: "Identifier",
- name: "solarsystem",
- loc: {
- start: {
- line: 1,
- column: 18
- },
- end: {
- line: 1,
- column: 29
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 29
- }
- }
- },
- property: {
- type: "Identifier",
- name: "Earth",
- loc: {
- start: {
- line: 1,
- column: 30
- },
- end: {
- line: 1,
- column: 35
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 35
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 35
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 35
- }
- }
-});
-
-test("universe[galaxyName, otherUselessName]", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: "universe",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- property: {
- type: "SequenceExpression",
- expressions: [
- {
- type: "Identifier",
- name: "galaxyName",
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 19
- }
- }
- },
- {
- type: "Identifier",
- name: "otherUselessName",
- loc: {
- start: {
- line: 1,
- column: 21
- },
- end: {
- line: 1,
- column: 37
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 37
- }
- }
- },
- computed: true,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 38
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 38
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 38
- }
- }
-});
-
-test("universe[galaxyName]", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: "universe",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- property: {
- type: "Identifier",
- name: "galaxyName",
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 19
- }
- }
- },
- computed: true,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 20
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 20
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 20
- }
- }
-});
-
-test("universe[42].galaxies", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "MemberExpression",
- object: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: "universe",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- property: {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- computed: true,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 12
- }
- }
- },
- property: {
- type: "Identifier",
- name: "galaxies",
- loc: {
- start: {
- line: 1,
- column: 13
- },
- end: {
- line: 1,
- column: 21
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 21
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 21
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 21
- }
- }
-});
-
-test("universe(42).galaxies", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "MemberExpression",
- object: {
- type: "CallExpression",
- callee: {
- type: "Identifier",
- name: "universe",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- arguments: [
- {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 11
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 12
- }
- }
- },
- property: {
- type: "Identifier",
- name: "galaxies",
- loc: {
- start: {
- line: 1,
- column: 13
- },
- end: {
- line: 1,
- column: 21
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 21
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 21
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 21
- }
- }
-});
-
-test("universe(42).galaxies(14, 3, 77).milkyway", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "MemberExpression",
- object: {
- type: "CallExpression",
- callee: {
- type: "MemberExpression",
- object: {
- type: "CallExpression",
- callee: {
- type: "Identifier",
- name: "universe",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- arguments: [
- {
- type: "Literal",
- value: 42,
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 11
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 12
- }
- }
- },
- property: {
- type: "Identifier",
- name: "galaxies",
- loc: {
- start: {
- line: 1,
- column: 13
- },
- end: {
- line: 1,
- column: 21
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 21
- }
- }
- },
- arguments: [
- {
- type: "Literal",
- value: 14,
- loc: {
- start: {
- line: 1,
- column: 22
- },
- end: {
- line: 1,
- column: 24
- }
- }
- },
- {
- type: "Literal",
- value: 3,
- loc: {
- start: {
- line: 1,
- column: 26
- },
- end: {
- line: 1,
- column: 27
- }
- }
- },
- {
- type: "Literal",
- value: 77,
- loc: {
- start: {
- line: 1,
- column: 29
- },
- end: {
- line: 1,
- column: 31
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 32
- }
- }
- },
- property: {
- type: "Identifier",
- name: "milkyway",
- loc: {
- start: {
- line: 1,
- column: 33
- },
- end: {
- line: 1,
- column: 41
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 41
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 41
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 41
- }
- }
-});
-
-test("earth.asia.Indonesia.prepareForElection(2014)", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "CallExpression",
- callee: {
- type: "MemberExpression",
- object: {
- type: "MemberExpression",
- object: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: "earth",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- property: {
- type: "Identifier",
- name: "asia",
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 10
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 10
- }
- }
- },
- property: {
- type: "Identifier",
- name: "Indonesia",
- loc: {
- start: {
- line: 1,
- column: 11
- },
- end: {
- line: 1,
- column: 20
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 20
- }
- }
- },
- property: {
- type: "Identifier",
- name: "prepareForElection",
- loc: {
- start: {
- line: 1,
- column: 21
- },
- end: {
- line: 1,
- column: 39
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 39
- }
- }
- },
- arguments: [
- {
- type: "Literal",
- value: 2014,
- loc: {
- start: {
- line: 1,
- column: 40
- },
- end: {
- line: 1,
- column: 44
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 45
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 45
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 45
- }
- }
-});
-
-test("universe.if", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: "universe",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- property: {
- type: "Identifier",
- name: "if",
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
-});
-
-test("universe.true", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: "universe",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- property: {
- type: "Identifier",
- name: "true",
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 13
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
-});
-
-test("universe.false", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: "universe",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- property: {
- type: "Identifier",
- name: "false",
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
-});
-
-test("universe.null", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: "universe",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- property: {
- type: "Identifier",
- name: "null",
- loc: {
- start: {
- line: 1,
- column: 9
- },
- end: {
- line: 1,
- column: 13
- }
- }
- },
- computed: false,
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 13
- }
- }
-});
-
-test("x++", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UpdateExpression",
- operator: "++",
- prefix: false,
- argument: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
-});
-
-test("x--", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UpdateExpression",
- operator: "--",
- prefix: false,
- argument: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
-});
-
-test("eval++", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UpdateExpression",
- operator: "++",
- prefix: false,
- argument: {
- type: "Identifier",
- name: "eval",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
-});
-
-test("eval--", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UpdateExpression",
- operator: "--",
- prefix: false,
- argument: {
- type: "Identifier",
- name: "eval",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 4
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
-});
-
-test("arguments++", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UpdateExpression",
- operator: "++",
- prefix: false,
- argument: {
- type: "Identifier",
- name: "arguments",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
-});
-
-test("arguments--", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UpdateExpression",
- operator: "--",
- prefix: false,
- argument: {
- type: "Identifier",
- name: "arguments",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
-});
-
-test("++x", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UpdateExpression",
- operator: "++",
- prefix: true,
- argument: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 2
- },
- end: {
- line: 1,
- column: 3
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
-});
-
-test("--x", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UpdateExpression",
- operator: "--",
- prefix: true,
- argument: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 2
- },
- end: {
- line: 1,
- column: 3
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 3
- }
- }
-});
-
-test("++eval", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UpdateExpression",
- operator: "++",
- prefix: true,
- argument: {
- type: "Identifier",
- name: "eval",
- loc: {
- start: {
- line: 1,
- column: 2
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
-});
-
-test("--eval", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UpdateExpression",
- operator: "--",
- prefix: true,
- argument: {
- type: "Identifier",
- name: "eval",
- loc: {
- start: {
- line: 1,
- column: 2
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
-});
-
-test("++arguments", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UpdateExpression",
- operator: "++",
- prefix: true,
- argument: {
- type: "Identifier",
- name: "arguments",
- loc: {
- start: {
- line: 1,
- column: 2
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
-});
-
-test("--arguments", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UpdateExpression",
- operator: "--",
- prefix: true,
- argument: {
- type: "Identifier",
- name: "arguments",
- loc: {
- start: {
- line: 1,
- column: 2
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 11
- }
- }
-});
-
-test("+x", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UnaryExpression",
- operator: "+",
- prefix: true,
- argument: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 1
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
-});
-
-test("-x", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UnaryExpression",
- operator: "-",
- prefix: true,
- argument: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 1
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
-});
-
-test("~x", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UnaryExpression",
- operator: "~",
- prefix: true,
- argument: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 1
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
-});
-
-test("!x", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UnaryExpression",
- operator: "!",
- prefix: true,
- argument: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 1
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 2
- }
- }
-});
-
-test("void x", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UnaryExpression",
- operator: "void",
- prefix: true,
- argument: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
-});
-
-test("delete x", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UnaryExpression",
- operator: "delete",
- prefix: true,
- argument: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 7
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
-});
-
-test("typeof x", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "UnaryExpression",
- operator: "typeof",
- prefix: true,
- argument: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 7
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 8
- }
- }
-});
-
-test("x * y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "*",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
-});
-
-test("x / y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "/",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
-});
-
-test("x % y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "%",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
-});
-
-test("x + y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "+",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
-});
-
-test("x - y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "-",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
-});
-
-test("x << y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "<<",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
-});
-
-test("x >> y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: ">>",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
-});
-
-test("x >>> y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: ">>>",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
-});
-
-test("x < y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "<",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
-});
-
-test("x > y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: ">",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
-});
-
-test("x <= y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "<=",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
-});
-
-test("x >= y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: ">=",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
-});
-
-test("x in y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "in",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
-});
-
-test("x instanceof y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "instanceof",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 13
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 14
- }
- }
-});
-
-test("x < y < z", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "<",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- operator: "<",
- right: {
- type: "Identifier",
- name: "z",
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
-});
-
-test("x == y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "==",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
-});
-
-test("x != y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "!=",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 5
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 6
- }
- }
-});
-
-test("x === y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "===",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
-});
-
-test("x !== y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "!==",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 6
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 7
- }
- }
-});
-
-test("x & y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "&",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
-});
-
-test("x ^ y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "^",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
-});
-
-test("x | y", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "|",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
-});
-
-test("x + y + z", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "+",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- operator: "+",
- right: {
- type: "Identifier",
- name: "z",
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
-});
-
-test("x - y + z", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "-",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- operator: "+",
- right: {
- type: "Identifier",
- name: "z",
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
-});
-
-test("x + y - z", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "+",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- operator: "-",
- right: {
- type: "Identifier",
- name: "z",
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
-});
-
-test("x - y - z", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "-",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- operator: "-",
- right: {
- type: "Identifier",
- name: "z",
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
-});
-
-test("x + y * z", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "+",
- right: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- operator: "*",
- right: {
- type: "Identifier",
- name: "z",
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
-});
-
-test("x + y / z", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "+",
- right: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- operator: "/",
- right: {
- type: "Identifier",
- name: "z",
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
-});
-
-test("x - y % z", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "-",
- right: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- operator: "%",
- right: {
- type: "Identifier",
- name: "z",
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
-});
-
-test("x * y * z", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "*",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- operator: "*",
- right: {
- type: "Identifier",
- name: "z",
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
-});
-
-test("x * y / z", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "*",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- operator: "/",
- right: {
- type: "Identifier",
- name: "z",
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
-});
-
-test("x * y % z", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 1
- }
- }
- },
- operator: "*",
- right: {
- type: "Identifier",
- name: "y",
- loc: {
- start: {
- line: 1,
- column: 4
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 5
- }
- }
- },
- operator: "%",
- right: {
- type: "Identifier",
- name: "z",
- loc: {
- start: {
- line: 1,
- column: 8
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- },
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
- }
- ],
- loc: {
- start: {
- line: 1,
- column: 0
- },
- end: {
- line: 1,
- column: 9
- }
- }
-});
-
-test("x % y * z", {
- type: "Program",
- body: [
- {
- type: "ExpressionStatement",
- expression: {
- type: "BinaryExpression",
- left: {
- type: "BinaryExpression",
- left: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {
- line: 1,
-