diff --git a/src/parser/expression.js b/src/parser/expression.js index 0da687798e..29d77ebf22 100644 --- a/src/parser/expression.js +++ b/src/parser/expression.js @@ -804,7 +804,21 @@ pp.parseObjPropValue = function (prop, startPos, startLoc, isGenerator, isAsync, } if (this.eat(tt.colon)) { - prop.value = isPattern ? this.parseMaybeDefault(this.state.start, this.state.startLoc) : this.parseMaybeAssign(false, refShorthandDefaultPos); + if (isPattern) { + prop.value = this.parseMaybeDefault(this.state.start, this.state.startLoc); + if (prop.value.type === "Identifier") { + let name = prop.value.name; + if (this.isReservedWord(name)) { + this.raise(prop.value.start, "Binding reserved word " + name); + } + + if (this.state.strict && (reservedWords.strictBind(name) || reservedWords.strict(name))) { + this.raise(prop.value.start, "Binding " + name + " in strict mode"); + } + } + } else { + prop.value = this.parseMaybeAssign(false, refShorthandDefaultPos); + } return this.finishNode(prop, "ObjectProperty"); } @@ -827,13 +841,19 @@ pp.parseObjPropValue = function (prop, startPos, startLoc, isGenerator, isAsync, if (!prop.computed && prop.key.type === "Identifier") { if (isPattern) { - let illegalBinding = this.isKeyword(prop.key.name); - if (!illegalBinding && this.state.strict) { - illegalBinding = reservedWords.strictBind(prop.key.name) || reservedWords.strict(prop.key.name); + let name = prop.key.name; + if (this.isKeyword(name)) { + this.raise(prop.key.start, "Binding keyword " + name); + } + + if (this.isReservedWord(name)) { + this.raise(prop.key.start, "Binding reserved word " + name); } - if (illegalBinding) { - this.raise(prop.key.start, "Binding " + prop.key.name); + + if (this.state.strict && (reservedWords.strictBind(name) || reservedWords.strict(name))) { + this.raise(prop.key.start, "Binding " + name + " in strict mode"); } + prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key.__clone()); } else if (this.match(tt.eq) && refShorthandDefaultPos) { if (!refShorthandDefaultPos.start) { @@ -843,6 +863,7 @@ pp.parseObjPropValue = function (prop, startPos, startLoc, isGenerator, isAsync, } else { prop.value = prop.key.__clone(); } + prop.shorthand = true; return this.finishNode(prop, "ObjectProperty"); } @@ -999,13 +1020,12 @@ pp.parseIdentifier = function (liberal) { if (this.match(tt.name)) { if (!liberal) { - if (this.state.strict && reservedWords.strict(this.state.value)) { - this.raise(this.state.start, "The keyword '" + this.state.value + "' is reserved"); + if (this.isReservedWord(this.state.value)) { + this.raise(this.state.start, this.state.value + " is a reserved word"); } - if (this.inModule && reservedWords[6](this.state.value)) { - this.raise(this.state.start, "The keyword '" + this.state.value + - "' is reserved when source type is module"); + if (this.state.strict && reservedWords.strict(this.state.value)) { + this.raise(this.state.start, "The keyword '" + this.state.value + "' is reserved"); } } diff --git a/src/parser/index.js b/src/parser/index.js index 8b3353bed0..7986101e1e 100644 --- a/src/parser/index.js +++ b/src/parser/index.js @@ -11,7 +11,6 @@ export default class Parser extends Tokenizer { this.options = options; this.inModule = this.options.sourceType === "module"; - this.isReservedWord = reservedWords[6]; this.input = input; this.plugins = this.loadPlugins(this.options.plugins); this.filename = options.sourceFilename; @@ -22,6 +21,14 @@ export default class Parser extends Tokenizer { } } + isReservedWord(word: string): boolean { + if (word === "await") { + return this.inModule; + } else { + return reservedWords[6](word); + } + } + hasPlugin(name: string): boolean { return !!(this.plugins["*"] || this.plugins[name]); } diff --git a/src/parser/lval.js b/src/parser/lval.js index c7d0357ffd..c95cec07df 100644 --- a/src/parser/lval.js +++ b/src/parser/lval.js @@ -205,12 +205,13 @@ pp.checkLVal = function (expr, isBinding, checkClashes, contextDescription) { switch (expr.type) { case "Identifier": let errBegin = isBinding ? "Binding " : "Assigning to "; - if (this.state.strict && (reservedWords.strictBind(expr.name) || reservedWords.strict(expr.name))) { - this.raise(expr.start, errBegin + expr.name + " in strict mode"); + + if (this.isReservedWord(expr.name)) { + this.raise(expr.start, errBegin + "reserved word " + expr.name); } - if (this.inModule && reservedWords[6](expr.name)) { - this.raise(expr.start, errBegin + expr.name + " is invalid when source type is module"); + if (this.state.strict && (reservedWords.strictBind(expr.name) || reservedWords.strict(expr.name))) { + this.raise(expr.start, errBegin + expr.name + " in strict mode"); } if (checkClashes) { diff --git a/test/fixtures/core/uncategorised/544/actual.js b/test/fixtures/core/uncategorised/544/actual.js new file mode 100644 index 0000000000..10717a9104 --- /dev/null +++ b/test/fixtures/core/uncategorised/544/actual.js @@ -0,0 +1,2 @@ +"use strict"; +const { public } = foo(); diff --git a/test/fixtures/core/uncategorised/544/options.json b/test/fixtures/core/uncategorised/544/options.json new file mode 100644 index 0000000000..0afa4c39b0 --- /dev/null +++ b/test/fixtures/core/uncategorised/544/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Binding public in strict mode (2:8)" +} diff --git a/test/fixtures/core/uncategorised/545/actual.js b/test/fixtures/core/uncategorised/545/actual.js new file mode 100644 index 0000000000..6d24f5bb05 --- /dev/null +++ b/test/fixtures/core/uncategorised/545/actual.js @@ -0,0 +1 @@ +const { public } = foo(); diff --git a/test/fixtures/core/uncategorised/545/options.json b/test/fixtures/core/uncategorised/545/options.json new file mode 100644 index 0000000000..af6375620e --- /dev/null +++ b/test/fixtures/core/uncategorised/545/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "throws": "Binding public in strict mode (1:8)" +} diff --git a/test/fixtures/core/uncategorised/546/actual.js b/test/fixtures/core/uncategorised/546/actual.js new file mode 100644 index 0000000000..6d24f5bb05 --- /dev/null +++ b/test/fixtures/core/uncategorised/546/actual.js @@ -0,0 +1 @@ +const { public } = foo(); diff --git a/test/fixtures/es2015/uncategorised/372/expected.json b/test/fixtures/core/uncategorised/546/expected.json similarity index 80% rename from test/fixtures/es2015/uncategorised/372/expected.json rename to test/fixtures/core/uncategorised/546/expected.json index 707e6d760e..9f7364ea93 100644 --- a/test/fixtures/es2015/uncategorised/372/expected.json +++ b/test/fixtures/core/uncategorised/546/expected.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 23, + "end": 25, "loc": { "start": { "line": 1, @@ -9,13 +9,13 @@ }, "end": { "line": 1, - "column": 23 + "column": 25 } }, "program": { "type": "Program", "start": 0, - "end": 23, + "end": 25, "loc": { "start": { "line": 1, @@ -23,7 +23,7 @@ }, "end": { "line": 1, - "column": 23 + "column": 25 } }, "sourceType": "script", @@ -31,7 +31,7 @@ { "type": "VariableDeclaration", "start": 0, - "end": 23, + "end": 25, "loc": { "start": { "line": 1, @@ -39,14 +39,14 @@ }, "end": { "line": 1, - "column": 23 + "column": 25 } }, "declarations": [ { "type": "VariableDeclarator", "start": 6, - "end": 22, + "end": 24, "loc": { "start": { "line": 1, @@ -54,13 +54,13 @@ }, "end": { "line": 1, - "column": 22 + "column": 24 } }, "id": { "type": "ObjectPattern", "start": 6, - "end": 14, + "end": 16, "loc": { "start": { "line": 1, @@ -68,14 +68,14 @@ }, "end": { "line": 1, - "column": 14 + "column": 16 } }, "properties": [ { "type": "ObjectProperty", "start": 8, - "end": 12, + "end": 14, "loc": { "start": { "line": 1, @@ -83,7 +83,7 @@ }, "end": { "line": 1, - "column": 12 + "column": 14 } }, "method": false, @@ -92,7 +92,7 @@ "key": { "type": "Identifier", "start": 8, - "end": 12, + "end": 14, "loc": { "start": { "line": 1, @@ -100,16 +100,16 @@ }, "end": { "line": 1, - "column": 12 + "column": 14 }, - "identifierName": "enum" + "identifierName": "public" }, - "name": "enum" + "name": "public" }, "value": { "type": "Identifier", "start": 8, - "end": 12, + "end": 14, "loc": { "start": { "line": 1, @@ -117,11 +117,11 @@ }, "end": { "line": 1, - "column": 12 + "column": 14 }, - "identifierName": "enum" + "identifierName": "public" }, - "name": "enum" + "name": "public" }, "extra": { "shorthand": true @@ -131,30 +131,30 @@ }, "init": { "type": "CallExpression", - "start": 17, - "end": 22, + "start": 19, + "end": 24, "loc": { "start": { "line": 1, - "column": 17 + "column": 19 }, "end": { "line": 1, - "column": 22 + "column": 24 } }, "callee": { "type": "Identifier", - "start": 17, - "end": 20, + "start": 19, + "end": 22, "loc": { "start": { "line": 1, - "column": 17 + "column": 19 }, "end": { "line": 1, - "column": 20 + "column": 22 }, "identifierName": "foo" }, diff --git a/test/fixtures/core/uncategorised/546/options.json b/test/fixtures/core/uncategorised/546/options.json new file mode 100644 index 0000000000..b412ffe671 --- /dev/null +++ b/test/fixtures/core/uncategorised/546/options.json @@ -0,0 +1,3 @@ +{ + "sourceType": "script" +} diff --git a/test/fixtures/es2015/destructuring/binding-this/options.json b/test/fixtures/es2015/destructuring/binding-this/options.json index 751e3a83c2..84aaf95570 100644 --- a/test/fixtures/es2015/destructuring/binding-this/options.json +++ b/test/fixtures/es2015/destructuring/binding-this/options.json @@ -1,3 +1,3 @@ { - "throws": "Binding this (1:6)" + "throws": "Binding keyword this (1:6)" } diff --git a/test/fixtures/es2015/uncategorised/357/options.json b/test/fixtures/es2015/uncategorised/357/options.json index e35fe39227..d295c5a3a3 100644 --- a/test/fixtures/es2015/uncategorised/357/options.json +++ b/test/fixtures/es2015/uncategorised/357/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "The keyword 'await' is reserved when source type is module (1:0)" + "throws": "await is a reserved word (1:0)" } diff --git a/test/fixtures/es2015/uncategorised/359/options.json b/test/fixtures/es2015/uncategorised/359/options.json index 579bcedf11..93c27517d8 100644 --- a/test/fixtures/es2015/uncategorised/359/options.json +++ b/test/fixtures/es2015/uncategorised/359/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "Binding await is invalid when source type is module (1:6)" + "throws": "Binding reserved word await (1:6)" } diff --git a/test/fixtures/es2015/uncategorised/361/options.json b/test/fixtures/es2015/uncategorised/361/options.json index 4b817e708e..8ae2faa529 100644 --- a/test/fixtures/es2015/uncategorised/361/options.json +++ b/test/fixtures/es2015/uncategorised/361/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "Binding await is invalid when source type is module (1:8)" + "throws": "Binding reserved word await (1:8)" } diff --git a/test/fixtures/es2015/uncategorised/363/options.json b/test/fixtures/es2015/uncategorised/363/options.json index 5474baee78..2dbaa53d99 100644 --- a/test/fixtures/es2015/uncategorised/363/options.json +++ b/test/fixtures/es2015/uncategorised/363/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "Binding await is invalid when source type is module (1:15)" + "throws": "Binding reserved word await (1:15)" } diff --git a/test/fixtures/es2015/uncategorised/365/options.json b/test/fixtures/es2015/uncategorised/365/options.json index e045e7b9f6..e703907857 100644 --- a/test/fixtures/es2015/uncategorised/365/options.json +++ b/test/fixtures/es2015/uncategorised/365/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "The keyword 'await' is reserved when source type is module (1:9)" + "throws": "await is a reserved word (1:9)" } diff --git a/test/fixtures/es2015/uncategorised/367/options.json b/test/fixtures/es2015/uncategorised/367/options.json index 9b70fc0469..dfa11a2d85 100644 --- a/test/fixtures/es2015/uncategorised/367/options.json +++ b/test/fixtures/es2015/uncategorised/367/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "The keyword 'await' is reserved when source type is module (1:6)" + "throws": "await is a reserved word (1:6)" } diff --git a/test/fixtures/es2015/uncategorised/368/expected.json b/test/fixtures/es2015/uncategorised/368/expected.json deleted file mode 100644 index badf40e665..0000000000 --- a/test/fixtures/es2015/uncategorised/368/expected.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "operator": "=", - "left": { - "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "enum" - }, - "name": "enum" - }, - "right": { - "type": "CallExpression", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "callee": { - "type": "Identifier", - "start": 7, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "foo" - }, - "name": "foo" - }, - "arguments": [] - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/368/options.json b/test/fixtures/es2015/uncategorised/368/options.json index b412ffe671..be7cb5854a 100644 --- a/test/fixtures/es2015/uncategorised/368/options.json +++ b/test/fixtures/es2015/uncategorised/368/options.json @@ -1,3 +1,4 @@ { - "sourceType": "script" + "sourceType": "script", + "throws": "enum is a reserved word (1:0)" } diff --git a/test/fixtures/es2015/uncategorised/369/options.json b/test/fixtures/es2015/uncategorised/369/options.json index 91fdf601b8..471868697d 100644 --- a/test/fixtures/es2015/uncategorised/369/options.json +++ b/test/fixtures/es2015/uncategorised/369/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "The keyword 'enum' is reserved when source type is module (1:0)" + "throws": "enum is a reserved word (1:0)" } diff --git a/test/fixtures/es2015/uncategorised/370/expected.json b/test/fixtures/es2015/uncategorised/370/expected.json deleted file mode 100644 index 795cc2f412..0000000000 --- a/test/fixtures/es2015/uncategorised/370/expected.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "sourceType": "script", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 6, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "id": { - "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "enum" - }, - "name": "enum" - }, - "init": { - "type": "CallExpression", - "start": 13, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "callee": { - "type": "Identifier", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "foo" - }, - "name": "foo" - }, - "arguments": [] - } - } - ], - "kind": "const" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/370/options.json b/test/fixtures/es2015/uncategorised/370/options.json index b412ffe671..f8fa38af02 100644 --- a/test/fixtures/es2015/uncategorised/370/options.json +++ b/test/fixtures/es2015/uncategorised/370/options.json @@ -1,3 +1,4 @@ { - "sourceType": "script" + "sourceType": "script", + "throws": "Binding reserved word enum (1:6)" } diff --git a/test/fixtures/es2015/uncategorised/371/options.json b/test/fixtures/es2015/uncategorised/371/options.json index d3fff9a5d9..016c8ec756 100644 --- a/test/fixtures/es2015/uncategorised/371/options.json +++ b/test/fixtures/es2015/uncategorised/371/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "Binding enum is invalid when source type is module (1:6)" + "throws": "Binding reserved word enum (1:6)" } diff --git a/test/fixtures/es2015/uncategorised/372/options.json b/test/fixtures/es2015/uncategorised/372/options.json index b412ffe671..dd3904d13f 100644 --- a/test/fixtures/es2015/uncategorised/372/options.json +++ b/test/fixtures/es2015/uncategorised/372/options.json @@ -1,3 +1,4 @@ { - "sourceType": "script" + "sourceType": "script", + "throws": "Binding reserved word enum (1:8)" } diff --git a/test/fixtures/es2015/uncategorised/373/options.json b/test/fixtures/es2015/uncategorised/373/options.json index 8e35e09826..98ea4c3cf8 100644 --- a/test/fixtures/es2015/uncategorised/373/options.json +++ b/test/fixtures/es2015/uncategorised/373/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "Binding enum is invalid when source type is module (1:8)" + "throws": "Binding reserved word enum (1:8)" } diff --git a/test/fixtures/es2015/uncategorised/374/options.json b/test/fixtures/es2015/uncategorised/374/options.json index b412ffe671..4ea66f4995 100644 --- a/test/fixtures/es2015/uncategorised/374/options.json +++ b/test/fixtures/es2015/uncategorised/374/options.json @@ -1,3 +1,4 @@ { - "sourceType": "script" + "sourceType": "script", + "throws": "Binding reserved word enum (1:15)" } diff --git a/test/fixtures/es2015/uncategorised/375/options.json b/test/fixtures/es2015/uncategorised/375/options.json index 804874970b..86c2367e5c 100644 --- a/test/fixtures/es2015/uncategorised/375/options.json +++ b/test/fixtures/es2015/uncategorised/375/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "Binding enum is invalid when source type is module (1:15)" + "throws": "Binding reserved word enum (1:15)" } diff --git a/test/fixtures/es2015/uncategorised/376/expected.json b/test/fixtures/es2015/uncategorised/376/expected.json deleted file mode 100644 index e401a60662..0000000000 --- a/test/fixtures/es2015/uncategorised/376/expected.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "sourceType": "script", - "body": [ - { - "type": "FunctionDeclaration", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "id": { - "type": "Identifier", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "enum" - }, - "name": "enum" - }, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "start": 16, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "body": [], - "directives": [] - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/376/options.json b/test/fixtures/es2015/uncategorised/376/options.json index b412ffe671..8d226ef8ec 100644 --- a/test/fixtures/es2015/uncategorised/376/options.json +++ b/test/fixtures/es2015/uncategorised/376/options.json @@ -1,3 +1,4 @@ { - "sourceType": "script" + "sourceType": "script", + "throws": "enum is a reserved word (1:9)" } diff --git a/test/fixtures/es2015/uncategorised/377/options.json b/test/fixtures/es2015/uncategorised/377/options.json index 8c06f6055d..cdfa39cc09 100644 --- a/test/fixtures/es2015/uncategorised/377/options.json +++ b/test/fixtures/es2015/uncategorised/377/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "The keyword 'enum' is reserved when source type is module (1:9)" + "throws": "enum is a reserved word (1:9)" } diff --git a/test/fixtures/es2015/uncategorised/378/expected.json b/test/fixtures/es2015/uncategorised/378/expected.json deleted file mode 100644 index b224675384..0000000000 --- a/test/fixtures/es2015/uncategorised/378/expected.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ClassDeclaration", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "id": { - "type": "Identifier", - "start": 6, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "enum" - }, - "name": "enum" - }, - "superClass": null, - "body": { - "type": "ClassBody", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "body": [] - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/378/options.json b/test/fixtures/es2015/uncategorised/378/options.json index b412ffe671..b792a5158d 100644 --- a/test/fixtures/es2015/uncategorised/378/options.json +++ b/test/fixtures/es2015/uncategorised/378/options.json @@ -1,3 +1,4 @@ { - "sourceType": "script" + "sourceType": "script", + "throws": "enum is a reserved word (1:6)" } diff --git a/test/fixtures/es2015/uncategorised/379/options.json b/test/fixtures/es2015/uncategorised/379/options.json index 031aae962f..4a7908c1fb 100644 --- a/test/fixtures/es2015/uncategorised/379/options.json +++ b/test/fixtures/es2015/uncategorised/379/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "The keyword 'enum' is reserved when source type is module (1:6)" + "throws": "enum is a reserved word (1:6)" } diff --git a/test/fixtures/es2015/uncategorised/381/options.json b/test/fixtures/es2015/uncategorised/381/options.json index d09d447716..45b5b34730 100644 --- a/test/fixtures/es2015/uncategorised/381/options.json +++ b/test/fixtures/es2015/uncategorised/381/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "Binding await is invalid when source type is module (1:13)" + "throws": "Binding reserved word await (1:13)" } diff --git a/test/fixtures/es2015/uncategorised/383/options.json b/test/fixtures/es2015/uncategorised/383/options.json index 7c463b9b8e..f22eda31bd 100644 --- a/test/fixtures/es2015/uncategorised/383/options.json +++ b/test/fixtures/es2015/uncategorised/383/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "Binding await is invalid when source type is module (1:20)" + "throws": "Binding reserved word await (1:20)" } diff --git a/test/fixtures/es2015/uncategorised/384/options.json b/test/fixtures/es2015/uncategorised/384/options.json index b412ffe671..5df7c1c53b 100644 --- a/test/fixtures/es2015/uncategorised/384/options.json +++ b/test/fixtures/es2015/uncategorised/384/options.json @@ -1,3 +1,4 @@ { - "sourceType": "script" + "sourceType": "script", + "throws": "Binding reserved word enum (1:13)" } diff --git a/test/fixtures/es2015/uncategorised/385/options.json b/test/fixtures/es2015/uncategorised/385/options.json index b03a313956..2f859ef9ab 100644 --- a/test/fixtures/es2015/uncategorised/385/options.json +++ b/test/fixtures/es2015/uncategorised/385/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "Binding enum is invalid when source type is module (1:13)" + "throws": "Binding reserved word enum (1:13)" } diff --git a/test/fixtures/es2015/uncategorised/386/options.json b/test/fixtures/es2015/uncategorised/386/options.json index b412ffe671..ccb471b7f5 100644 --- a/test/fixtures/es2015/uncategorised/386/options.json +++ b/test/fixtures/es2015/uncategorised/386/options.json @@ -1,3 +1,4 @@ { - "sourceType": "script" + "sourceType": "script", + "throws": "Binding reserved word enum (1:20)" } diff --git a/test/fixtures/es2015/uncategorised/387/options.json b/test/fixtures/es2015/uncategorised/387/options.json index 0465a8a8c5..e4bdd5ce91 100644 --- a/test/fixtures/es2015/uncategorised/387/options.json +++ b/test/fixtures/es2015/uncategorised/387/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "Binding enum is invalid when source type is module (1:20)" + "throws": "Binding reserved word enum (1:20)" } diff --git a/test/fixtures/es2015/uncategorised/388/actual.js b/test/fixtures/es2015/uncategorised/388/actual.js new file mode 100644 index 0000000000..95d8cb2830 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/388/actual.js @@ -0,0 +1 @@ +const { await: foo } = bar(); diff --git a/test/fixtures/es2015/uncategorised/388/expected.json b/test/fixtures/es2015/uncategorised/388/expected.json new file mode 100644 index 0000000000..863e84104b --- /dev/null +++ b/test/fixtures/es2015/uncategorised/388/expected.json @@ -0,0 +1,169 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": { + "type": "ObjectPattern", + "start": 6, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 8, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "await" + }, + "name": "await" + }, + "value": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + }, + "init": { + "type": "CallExpression", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "callee": { + "type": "Identifier", + "start": 23, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/388/options.json b/test/fixtures/es2015/uncategorised/388/options.json new file mode 100644 index 0000000000..b412ffe671 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/388/options.json @@ -0,0 +1,3 @@ +{ + "sourceType": "script" +} diff --git a/test/fixtures/es2015/uncategorised/389/actual.js b/test/fixtures/es2015/uncategorised/389/actual.js new file mode 100644 index 0000000000..95d8cb2830 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/389/actual.js @@ -0,0 +1 @@ +const { await: foo } = bar(); diff --git a/test/fixtures/es2015/uncategorised/389/expected.json b/test/fixtures/es2015/uncategorised/389/expected.json new file mode 100644 index 0000000000..34c8b7f009 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/389/expected.json @@ -0,0 +1,169 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "module", + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": { + "type": "ObjectPattern", + "start": 6, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 8, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "await" + }, + "name": "await" + }, + "value": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + }, + "init": { + "type": "CallExpression", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "callee": { + "type": "Identifier", + "start": 23, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/389/options.json b/test/fixtures/es2015/uncategorised/389/options.json new file mode 100644 index 0000000000..2104ca4328 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/389/options.json @@ -0,0 +1,3 @@ +{ + "sourceType": "module" +} diff --git a/test/fixtures/es2015/uncategorised/390/actual.js b/test/fixtures/es2015/uncategorised/390/actual.js new file mode 100644 index 0000000000..c9a3e0fb6c --- /dev/null +++ b/test/fixtures/es2015/uncategorised/390/actual.js @@ -0,0 +1 @@ +const { enum: foo } = bar(); diff --git a/test/fixtures/es2015/uncategorised/384/expected.json b/test/fixtures/es2015/uncategorised/390/expected.json similarity index 96% rename from test/fixtures/es2015/uncategorised/384/expected.json rename to test/fixtures/es2015/uncategorised/390/expected.json index 14a7c99cf4..680ea8c329 100644 --- a/test/fixtures/es2015/uncategorised/384/expected.json +++ b/test/fixtures/es2015/uncategorised/390/expected.json @@ -92,7 +92,7 @@ "key": { "type": "Identifier", "start": 8, - "end": 11, + "end": 12, "loc": { "start": { "line": 1, @@ -100,28 +100,28 @@ }, "end": { "line": 1, - "column": 11 + "column": 12 }, - "identifierName": "foo" + "identifierName": "enum" }, - "name": "foo" + "name": "enum" }, "value": { "type": "Identifier", - "start": 13, + "start": 14, "end": 17, "loc": { "start": { "line": 1, - "column": 13 + "column": 14 }, "end": { "line": 1, "column": 17 }, - "identifierName": "enum" + "identifierName": "foo" }, - "name": "enum" + "name": "foo" } } ] diff --git a/test/fixtures/es2015/uncategorised/390/options.json b/test/fixtures/es2015/uncategorised/390/options.json new file mode 100644 index 0000000000..b412ffe671 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/390/options.json @@ -0,0 +1,3 @@ +{ + "sourceType": "script" +} diff --git a/test/fixtures/es2015/uncategorised/391/actual.js b/test/fixtures/es2015/uncategorised/391/actual.js new file mode 100644 index 0000000000..c9a3e0fb6c --- /dev/null +++ b/test/fixtures/es2015/uncategorised/391/actual.js @@ -0,0 +1 @@ +const { enum: foo } = bar(); diff --git a/test/fixtures/es2015/uncategorised/391/expected.json b/test/fixtures/es2015/uncategorised/391/expected.json new file mode 100644 index 0000000000..0ee90b20b5 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/391/expected.json @@ -0,0 +1,169 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "module", + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "id": { + "type": "ObjectPattern", + "start": 6, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 8, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "value": { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + }, + "init": { + "type": "CallExpression", + "start": 22, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/391/options.json b/test/fixtures/es2015/uncategorised/391/options.json new file mode 100644 index 0000000000..2104ca4328 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/391/options.json @@ -0,0 +1,3 @@ +{ + "sourceType": "module" +} diff --git a/test/fixtures/es2015/uncategorised/392/actual.js b/test/fixtures/es2015/uncategorised/392/actual.js new file mode 100644 index 0000000000..570a821ec6 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/392/actual.js @@ -0,0 +1 @@ +function foo({ await: bar }) {} diff --git a/test/fixtures/es2015/uncategorised/392/expected.json b/test/fixtures/es2015/uncategorised/392/expected.json new file mode 100644 index 0000000000..a7fd6e1da4 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/392/expected.json @@ -0,0 +1,157 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "sourceType": "script", + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 13, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 15, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "await" + }, + "name": "await" + }, + "value": { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/392/options.json b/test/fixtures/es2015/uncategorised/392/options.json new file mode 100644 index 0000000000..b412ffe671 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/392/options.json @@ -0,0 +1,3 @@ +{ + "sourceType": "script" +} diff --git a/test/fixtures/es2015/uncategorised/393/actual.js b/test/fixtures/es2015/uncategorised/393/actual.js new file mode 100644 index 0000000000..570a821ec6 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/393/actual.js @@ -0,0 +1 @@ +function foo({ await: bar }) {} diff --git a/test/fixtures/es2015/uncategorised/393/expected.json b/test/fixtures/es2015/uncategorised/393/expected.json new file mode 100644 index 0000000000..ec95b18ea1 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/393/expected.json @@ -0,0 +1,157 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "sourceType": "module", + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 13, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 15, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "await" + }, + "name": "await" + }, + "value": { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/393/options.json b/test/fixtures/es2015/uncategorised/393/options.json new file mode 100644 index 0000000000..2104ca4328 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/393/options.json @@ -0,0 +1,3 @@ +{ + "sourceType": "module" +} diff --git a/test/fixtures/es2015/uncategorised/394/actual.js b/test/fixtures/es2015/uncategorised/394/actual.js new file mode 100644 index 0000000000..c093887ca6 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/394/actual.js @@ -0,0 +1 @@ +function foo({ enum: bar }) {} diff --git a/test/fixtures/es2015/uncategorised/386/expected.json b/test/fixtures/es2015/uncategorised/394/expected.json similarity index 96% rename from test/fixtures/es2015/uncategorised/386/expected.json rename to test/fixtures/es2015/uncategorised/394/expected.json index 36763f8fb2..556e024271 100644 --- a/test/fixtures/es2015/uncategorised/386/expected.json +++ b/test/fixtures/es2015/uncategorised/394/expected.json @@ -98,7 +98,7 @@ "key": { "type": "Identifier", "start": 15, - "end": 18, + "end": 19, "loc": { "start": { "line": 1, @@ -106,28 +106,28 @@ }, "end": { "line": 1, - "column": 18 + "column": 19 }, - "identifierName": "bar" + "identifierName": "enum" }, - "name": "bar" + "name": "enum" }, "value": { "type": "Identifier", - "start": 20, + "start": 21, "end": 24, "loc": { "start": { "line": 1, - "column": 20 + "column": 21 }, "end": { "line": 1, "column": 24 }, - "identifierName": "enum" + "identifierName": "bar" }, - "name": "enum" + "name": "bar" } } ] diff --git a/test/fixtures/es2015/uncategorised/394/options.json b/test/fixtures/es2015/uncategorised/394/options.json new file mode 100644 index 0000000000..b412ffe671 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/394/options.json @@ -0,0 +1,3 @@ +{ + "sourceType": "script" +} diff --git a/test/fixtures/es2015/uncategorised/395/actual.js b/test/fixtures/es2015/uncategorised/395/actual.js new file mode 100644 index 0000000000..c093887ca6 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/395/actual.js @@ -0,0 +1 @@ +function foo({ enum: bar }) {} diff --git a/test/fixtures/es2015/uncategorised/374/expected.json b/test/fixtures/es2015/uncategorised/395/expected.json similarity index 81% rename from test/fixtures/es2015/uncategorised/374/expected.json rename to test/fixtures/es2015/uncategorised/395/expected.json index e28fb22074..c8d4400a32 100644 --- a/test/fixtures/es2015/uncategorised/374/expected.json +++ b/test/fixtures/es2015/uncategorised/395/expected.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 25, + "end": 30, "loc": { "start": { "line": 1, @@ -9,13 +9,13 @@ }, "end": { "line": 1, - "column": 25 + "column": 30 } }, "program": { "type": "Program", "start": 0, - "end": 25, + "end": 30, "loc": { "start": { "line": 1, @@ -23,15 +23,15 @@ }, "end": { "line": 1, - "column": 25 + "column": 30 } }, - "sourceType": "script", + "sourceType": "module", "body": [ { "type": "FunctionDeclaration", "start": 0, - "end": 25, + "end": 30, "loc": { "start": { "line": 1, @@ -39,7 +39,7 @@ }, "end": { "line": 1, - "column": 25 + "column": 30 } }, "id": { @@ -66,7 +66,7 @@ { "type": "ObjectPattern", "start": 13, - "end": 21, + "end": 26, "loc": { "start": { "line": 1, @@ -74,14 +74,14 @@ }, "end": { "line": 1, - "column": 21 + "column": 26 } }, "properties": [ { "type": "ObjectProperty", "start": 15, - "end": 19, + "end": 24, "loc": { "start": { "line": 1, @@ -89,11 +89,11 @@ }, "end": { "line": 1, - "column": 19 + "column": 24 } }, "method": false, - "shorthand": true, + "shorthand": false, "computed": false, "key": { "type": "Identifier", @@ -114,23 +114,20 @@ }, "value": { "type": "Identifier", - "start": 15, - "end": 19, + "start": 21, + "end": 24, "loc": { "start": { "line": 1, - "column": 15 + "column": 21 }, "end": { "line": 1, - "column": 19 + "column": 24 }, - "identifierName": "enum" + "identifierName": "bar" }, - "name": "enum" - }, - "extra": { - "shorthand": true + "name": "bar" } } ] @@ -138,16 +135,16 @@ ], "body": { "type": "BlockStatement", - "start": 23, - "end": 25, + "start": 28, + "end": 30, "loc": { "start": { "line": 1, - "column": 23 + "column": 28 }, "end": { "line": 1, - "column": 25 + "column": 30 } }, "body": [], diff --git a/test/fixtures/es2015/uncategorised/395/options.json b/test/fixtures/es2015/uncategorised/395/options.json new file mode 100644 index 0000000000..2104ca4328 --- /dev/null +++ b/test/fixtures/es2015/uncategorised/395/options.json @@ -0,0 +1,3 @@ +{ + "sourceType": "module" +}