From a179f9a48b711bf1f3e63ac7e253fa253ca0e1ea Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Tue, 11 Aug 2015 16:58:20 +0100 Subject: [PATCH] fix various bugs surfaced by the esprima test suite, remove some incorrect tests --- packages/babylon/src/parser/expression.js | 29 +- packages/babylon/src/parser/index.js | 9 +- packages/babylon/src/parser/lval.js | 6 +- packages/babylon/src/parser/statement.js | 39 +-- packages/babylon/src/parser/util.js | 23 +- packages/babylon/src/plugins/flow.js | 2 +- packages/babylon/src/tokenizer/index.js | 31 +- packages/babylon/src/tokenizer/state.js | 5 +- .../fixtures/core/uncategorised/248/actual.js | 1 - .../core/uncategorised/248/expected.json | 195 ------------ .../fixtures/core/uncategorised/249/actual.js | 1 - .../core/uncategorised/249/expected.json | 278 ------------------ .../core/uncategorised/504/options.json | 4 +- .../core/uncategorised/505/options.json | 4 +- .../core/uncategorised/506/options.json | 4 +- .../core/uncategorised/507/options.json | 4 +- .../core/uncategorised/508/options.json | 4 +- .../core/uncategorised/509/options.json | 4 +- .../core/uncategorised/510/options.json | 4 +- .../core/uncategorised/513/options.json | 2 +- .../dupe-param/options.json | 3 + .../actual.js | 0 .../expected.json | 0 .../options.json | 0 .../dupe-param-1/options.json | 3 + .../dupe-param-2/options.json | 3 + .../dupe-param-3/options.json | 3 + .../patterned-catch-dupe/options.json | 4 +- .../es2015-array-pattern/rest/options.json | 3 - .../invalid-var-init/options.json | 4 +- .../expected.json | 153 ++++++++++ .../invalid_super_access/options.json | 2 +- .../expected.json | 148 ++++++++++ .../invalid-syntax/migrated_0224/options.json | 4 +- .../invalid-syntax/migrated_0225/options.json | 4 +- .../invalid-syntax/migrated_0226/options.json | 4 +- .../invalid-syntax/migrated_0227/options.json | 4 +- .../invalid-syntax/migrated_0228/options.json | 4 +- .../invalid-syntax/migrated_0229/options.json | 4 +- .../invalid-syntax/migrated_0230/options.json | 4 +- .../invalid-syntax/migrated_0239/options.json | 4 +- .../harmony/uncategorised/334/expected.json | 128 ++++++++ .../harmony/uncategorised/335/expected.json | 152 ++++++++++ .../harmony/uncategorised/51/actual.js | 1 - .../harmony/uncategorised/51/expected.json | 119 -------- 45 files changed, 704 insertions(+), 703 deletions(-) delete mode 100644 packages/babylon/test/fixtures/core/uncategorised/248/actual.js delete mode 100644 packages/babylon/test/fixtures/core/uncategorised/248/expected.json delete mode 100644 packages/babylon/test/fixtures/core/uncategorised/249/actual.js delete mode 100644 packages/babylon/test/fixtures/core/uncategorised/249/expected.json create mode 100644 packages/babylon/test/fixtures/esprima/declaration-function/dupe-param/options.json rename packages/babylon/test/fixtures/esprima/es2015-array-binding-pattern/{invalid-elision-after-rest => .invalid-elision-after-rest}/actual.js (100%) rename packages/babylon/test/fixtures/esprima/es2015-array-binding-pattern/{invalid-elision-after-rest => .invalid-elision-after-rest}/expected.json (100%) rename packages/babylon/test/fixtures/esprima/es2015-array-binding-pattern/{invalid-elision-after-rest => .invalid-elision-after-rest}/options.json (100%) create mode 100644 packages/babylon/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/options.json create mode 100644 packages/babylon/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/options.json create mode 100644 packages/babylon/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/options.json delete mode 100644 packages/babylon/test/fixtures/esprima/es2015-array-pattern/rest/options.json create mode 100644 packages/babylon/test/fixtures/esprima/es2015-generator/generator-parameter-binding-property-reserved/expected.json create mode 100644 packages/babylon/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/expected.json create mode 100644 packages/babylon/test/fixtures/harmony/uncategorised/334/expected.json create mode 100644 packages/babylon/test/fixtures/harmony/uncategorised/335/expected.json delete mode 100644 packages/babylon/test/fixtures/harmony/uncategorised/51/actual.js delete mode 100644 packages/babylon/test/fixtures/harmony/uncategorised/51/expected.json diff --git a/packages/babylon/src/parser/expression.js b/packages/babylon/src/parser/expression.js index 3169de84e5..9bd456fd1a 100644 --- a/packages/babylon/src/parser/expression.js +++ b/packages/babylon/src/parser/expression.js @@ -186,7 +186,7 @@ pp.parseMaybeUnary = function (refShorthandDefaultPos) { if (refShorthandDefaultPos && refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start); if (update) { this.checkLVal(node.argument); - } else if (this.strict && node.operator === "delete" && node.argument.type === "Identifier") { + } else if (this.state.strict && node.operator === "delete" && node.argument.type === "Identifier") { this.raise(node.start, "Deleting local variable in strict mode"); } return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression"); @@ -335,10 +335,8 @@ pp.parseExprAtom = function (refShorthandDefaultPos) { return this.finishNode(node, "ThisExpression"); case tt._yield: - // NOTE: falls through to _let - if (!this.state.inGenerator && this.strict) this.unexpected(); + if (this.state.inGenerator) this.unexpected(); - case tt._let: case tt.name: node = this.startNode(); let id = this.parseIdentifier(true); @@ -363,7 +361,6 @@ pp.parseExprAtom = function (refShorthandDefaultPos) { return id; - case tt._do: if (this.options.features["es7.doExpressions"]) { let node = this.startNode(); @@ -683,7 +680,7 @@ pp.parseObjPropValue = function (prop, startPos, startLoc, isGenerator, isAsync, prop.kind = "init"; if (isPattern) { var illegalBinding = this.isKeyword(prop.key.name); - if (!illegalBinding && this.strict) { + if (!illegalBinding && this.state.strict) { illegalBinding = reservedWords.strictBind(prop.key.name) || reservedWords.strict(prop.key.name); } if (illegalBinding) { @@ -772,19 +769,29 @@ pp.parseFunctionBody = function (node, allowExpression) { // If this is a strict mode function, verify that argument names // are not repeated, and it does not try to bind the words `eval` // or `arguments`. - var checkLVal = this.strict; + var checkLVal = this.state.strict; + var checkLValStrict = false; + // arrow function if (allowExpression) checkLVal = true; + // normal function - if (!isExpression && node.body.body.length && this.isUseStrict(node.body.body[0])) checkLVal = true; + if (!isExpression && node.body.body.length && this.isUseStrict(node.body.body[0])) { + checkLVal = true; + checkLValStrict = true; + } + if (checkLVal) { let nameHash = Object.create(null); + let oldStrict = this.state.strict; + if (checkLValStrict) this.state.strict = true; if (node.id) { this.checkLVal(node.id, true); } for (let param of (node.params: Array)) { this.checkLVal(param, true, nameHash); } + this.state.strict = oldStrict; } }; @@ -828,8 +835,8 @@ pp.parseExprListItem = function (allowEmpty, refShorthandDefaultPos) { pp.parseIdentifier = function (liberal) { let node = this.startNode(); - if (this.isName()) { - if (!liberal && this.strict && reservedWords.strict(this.state.value)) { + if (this.match(tt.name)) { + if (!liberal && this.state.strict && reservedWords.strict(this.state.value)) { this.raise(this.state.start, "The keyword '" + this.state.value + "' is reserved"); } @@ -847,7 +854,7 @@ pp.parseIdentifier = function (liberal) { // Parses await expression inside async function. pp.parseAwait = function (node) { - if (this.eat(tt.semi) || this.canInsertSemicolon()) { + if (this.isLineTerminator()) { this.unexpected(); } node.all = this.eat(tt.star); diff --git a/packages/babylon/src/parser/index.js b/packages/babylon/src/parser/index.js index 4185c725d9..80db85a465 100644 --- a/packages/babylon/src/parser/index.js +++ b/packages/babylon/src/parser/index.js @@ -1,4 +1,4 @@ -import { reservedWords, isKeyword } from "../util/identifier"; +import { reservedWords } from "../util/identifier"; import { getOptions } from "../options"; import Tokenizer from "../tokenizer"; @@ -8,17 +8,16 @@ export const plugins = {}; export default class Parser extends Tokenizer { constructor(options, input) { - super(input); + options = getOptions(options); + super(options, input); - this.options = getOptions(options); - this.isKeyword = isKeyword; + this.options = options; this.isReservedWord = reservedWords[6]; this.input = input; this.loadPlugins(this.options.plugins); // Figure out if it's a module code. this.inModule = this.options.sourceType === "module"; - this.strict = this.options.strictMode === false ? false : this.inModule; // If enabled, skip leading hashbang line. if (this.state.pos === 0 && this.input[0] === "#" && this.input[1] === "!") { diff --git a/packages/babylon/src/parser/lval.js b/packages/babylon/src/parser/lval.js index 7ec54ae135..0d477fd10c 100644 --- a/packages/babylon/src/parser/lval.js +++ b/packages/babylon/src/parser/lval.js @@ -92,7 +92,7 @@ pp.parseSpread = function (refShorthandDefaultPos) { pp.parseRest = function () { let node = this.startNode(); this.next(); - if (this.isName() || this.match(tt.bracketL)) { + if (this.match(tt.name) || this.match(tt.bracketL)) { node.argument = this.parseBindingAtom(); } else { this.unexpected(); @@ -103,7 +103,7 @@ pp.parseRest = function () { // Parses lvalue (assignable) atom. pp.parseBindingAtom = function () { - if (this.isName()) { + if (this.match(tt.name)) { return this.parseIdentifier(true); } @@ -168,7 +168,7 @@ pp.parseMaybeDefault = function (startPos, startLoc, left) { pp.checkLVal = function (expr, isBinding, checkClashes) { switch (expr.type) { case "Identifier": - if (this.strict && (reservedWords.strictBind(expr.name) || reservedWords.strict(expr.name))) { + if (this.state.strict && (reservedWords.strictBind(expr.name) || reservedWords.strict(expr.name))) { this.raise(expr.start, (isBinding ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); } diff --git a/packages/babylon/src/parser/statement.js b/packages/babylon/src/parser/statement.js index 559ab8ebda..9f5457f9c4 100644 --- a/packages/babylon/src/parser/statement.js +++ b/packages/babylon/src/parser/statement.js @@ -74,19 +74,6 @@ pp.parseStatement = function (declaration, topLevel) { case tt._try: return this.parseTryStatement(node); case tt._let: - // NOTE: falls through to _const - if (!this.strict) { - let state = this.state.clone(); - this.next(); - - var isBindingAtomStart = this.isName() || this.match(tt.braceL) || this.match(tt.bracketL); - - // set back lookahead - this.state = state; - - if (!isBindingAtomStart) break; - } - case tt._const: if (!declaration) this.unexpected(); // NOTE: falls through to _var @@ -171,7 +158,7 @@ pp.parseBreakContinueStatement = function (node, keyword) { let isBreak = keyword === "break"; this.next(); - if (this.eat(tt.semi) || this.canInsertSemicolon()) { + if (this.isLineTerminator()) { node.label = null; } else if (!this.match(tt.name)) { this.unexpected(); @@ -232,9 +219,13 @@ pp.parseForStatement = function (node) { this.next(); this.parseVar(init, true, varKind); this.finishNode(init, "VariableDeclaration"); - if ((this.match(tt._in) || this.isContextual("of")) && init.declarations.length === 1 && - !(varKind !== tt._var && init.declarations[0].init)) - return this.parseForIn(node, init); + + if (this.match(tt._in) || this.isContextual("of")) { + if (init.declarations.length === 1 && !init.declarations[0].init) { + return this.parseForIn(node, init); + } + } + return this.parseFor(node, init); } @@ -274,7 +265,7 @@ pp.parseReturnStatement = function (node) { // optional arguments, we eagerly look for a semicolon or the // possibility to insert one. - if (this.eat(tt.semi) || this.canInsertSemicolon()) { + if (this.isLineTerminator()) { node.argument = null; } else { node.argument = this.parseExpression(); @@ -343,7 +334,7 @@ pp.parseTryStatement = function (node) { this.next(); this.expect(tt.parenL); clause.param = this.parseBindingAtom(); - this.checkLVal(clause.param, true); + this.checkLVal(clause.param, true, Object.create(null)); this.expect(tt.parenR); clause.body = this.parseBlock(); node.handler = this.finishNode(clause, "CatchClause"); @@ -376,7 +367,7 @@ pp.parseWhileStatement = function (node) { }; pp.parseWithStatement = function (node) { - if (this.strict) this.raise(this.state.start, "'with' in strict mode"); + if (this.state.strict) this.raise(this.state.start, "'with' in strict mode"); this.next(); node.object = this.parseParenExpression(); node.body = this.parseStatement(false); @@ -431,8 +422,8 @@ pp.parseBlock = function (allowStrict) { let stmt = this.parseStatement(true); node.body.push(stmt); if (first && allowStrict && this.isUseStrict(stmt)) { - oldStrict = this.strict; - this.setStrict(this.strict = true); + oldStrict = this.state.strict; + this.setStrict(this.state.strict = true); } first = false; } @@ -505,11 +496,11 @@ pp.parseFunction = function (node, isStatement, allowExpressionBody, isAsync, op this.initFunction(node, isAsync); node.generator = this.eat(tt.star); - if (isStatement && !optionalId && !this.isName()) { + if (isStatement && !optionalId && !this.match(tt.name)) { this.unexpected(); } - if (this.isName()) { + if (this.match(tt.name)) { node.id = this.parseIdentifier(); } diff --git a/packages/babylon/src/parser/util.js b/packages/babylon/src/parser/util.js index 53f1e4b27d..784daad310 100644 --- a/packages/babylon/src/parser/util.js +++ b/packages/babylon/src/parser/util.js @@ -28,23 +28,6 @@ pp.expectRelational = function (op) { } }; -// TODO - -pp.isName = function () { - if (this.match(tt.name)) { - return true; - } else if (!this.strict) { - var keyword = this.state.type.keyword; - if (keyword === "let") { - return true; - } else if (keyword === "yield") { - return !this.state.inGenerator; - } - } - - return false; -}; - // Tests whether parsed token is a contextual keyword. pp.isContextual = function (name) { @@ -71,6 +54,12 @@ pp.canInsertSemicolon = function () { lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start)); }; +// TODO + +pp.isLineTerminator = function () { + return this.eat(tt.semi) || this.canInsertSemicolon(); +}; + // Consume a semicolon, or, failing that, see if we are allowed to // pretend that there is a semicolon at this position. diff --git a/packages/babylon/src/plugins/flow.js b/packages/babylon/src/plugins/flow.js index 4bc211ccb1..58bdb63a25 100644 --- a/packages/babylon/src/plugins/flow.js +++ b/packages/babylon/src/plugins/flow.js @@ -609,7 +609,7 @@ export default function (instance) { instance.extend("parseStatement", function (inner) { return function (declaration, topLevel) { // strict mode handling of `interface` since it's a reserved word - if (this.strict && this.match(tt.name) && this.state.value === "interface") { + if (this.state.strict && this.match(tt.name) && this.state.value === "interface") { var node = this.startNode(); this.next(); return this.flowParseInterface(node); diff --git a/packages/babylon/src/tokenizer/index.js b/packages/babylon/src/tokenizer/index.js index 7bff031091..c2248cb4fb 100644 --- a/packages/babylon/src/tokenizer/index.js +++ b/packages/babylon/src/tokenizer/index.js @@ -1,4 +1,4 @@ -import { isIdentifierStart, isIdentifierChar } from "../util/identifier"; +import { isIdentifierStart, isIdentifierChar, isKeyword } from "../util/identifier"; import { types as tt, keywords as keywordTypes } from "./types"; import { types as ct } from "./context"; import { SourceLocation } from "../util/location"; @@ -48,9 +48,9 @@ function codePointToString(code) { } export default class Tokenizer { - constructor(input) { + constructor(options, input) { this.state = new State; - this.state.init(input); + this.state.init(options, input); } // Move to the next token @@ -84,6 +84,22 @@ export default class Tokenizer { // TODO + isKeyword(word) { + if (!this.state.strict) { + if (word === "yield" && !this.state.inGenerator) { + return false; + } + + if (word === "let") { + // check if next token is a name, braceL or bracketL, if so, it's a keyword! + } + } + + return isKeyword(word); + } + + // TODO + lookahead() { var old = this.state; this.state = old.clone(); @@ -97,7 +113,7 @@ export default class Tokenizer { // pedantic tests (`"use strict"; 010;` should fail). setStrict(strict) { - this.strict = strict; + this.state.strict = strict; if (!this.match(tt.num) && !this.match(tt.string)) return; this.state.pos = this.state.start; while (this.state.pos < this.state.lineStart) { @@ -589,7 +605,7 @@ export default class Tokenizer { val = parseFloat(str); } else if (!octal || str.length === 1) { val = parseInt(str, 10); - } else if (/[89]/.test(str) || this.strict) { + } else if (/[89]/.test(str) || this.state.strict) { this.raise(start, "Invalid number"); } else { val = parseInt(str, 8); @@ -705,7 +721,7 @@ export default class Tokenizer { octalStr = octalStr.slice(0, -1); octal = parseInt(octalStr, 8); } - if (octal > 0 && (this.strict || inTemplate)) { + if (octal > 0 && (this.state.strict || inTemplate)) { this.raise(this.state.pos - 2, "Octal literal in strict mode"); } this.state.pos += octalStr.length - 1; @@ -769,8 +785,9 @@ export default class Tokenizer { readWord() { let word = this.readWord1(); let type = tt.name; - if (!this.state.containsEsc && this.isKeyword(word)) + if (!this.state.containsEsc && this.isKeyword(word)) { type = keywordTypes[word]; + } return this.finishToken(type, word); } diff --git a/packages/babylon/src/tokenizer/state.js b/packages/babylon/src/tokenizer/state.js index e609504bb2..d5099ccaeb 100644 --- a/packages/babylon/src/tokenizer/state.js +++ b/packages/babylon/src/tokenizer/state.js @@ -3,7 +3,10 @@ import { types as ct } from "./context"; import { types as tt } from "./types"; export default class State { - init(input) { + init(options, input) { + // strict + this.strict = options.strictMode === false ? false : options.sourceType === "module"; + this.input = input; // Used to signify the start of a potential arrow function diff --git a/packages/babylon/test/fixtures/core/uncategorised/248/actual.js b/packages/babylon/test/fixtures/core/uncategorised/248/actual.js deleted file mode 100644 index b06fd22155..0000000000 --- a/packages/babylon/test/fixtures/core/uncategorised/248/actual.js +++ /dev/null @@ -1 +0,0 @@ -for (var x = 42 in list) process(x); \ No newline at end of file diff --git a/packages/babylon/test/fixtures/core/uncategorised/248/expected.json b/packages/babylon/test/fixtures/core/uncategorised/248/expected.json deleted file mode 100644 index 7b65e7a6c3..0000000000 --- a/packages/babylon/test/fixtures/core/uncategorised/248/expected.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ForInStatement", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "left": { - "type": "VariableDeclaration", - "start": 5, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 9, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "id": { - "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "x" - }, - "init": { - "type": "Literal", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "value": 42, - "rawValue": 42, - "raw": "42" - } - } - ], - "kind": "var" - }, - "right": { - "type": "Identifier", - "start": 19, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "name": "list" - }, - "body": { - "type": "ExpressionStatement", - "start": 25, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "expression": { - "type": "CallExpression", - "start": 25, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "callee": { - "type": "Identifier", - "start": 25, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "name": "process" - }, - "arguments": [ - { - "type": "Identifier", - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "name": "x" - } - ] - } - } - } - ] - } -} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/core/uncategorised/249/actual.js b/packages/babylon/test/fixtures/core/uncategorised/249/actual.js deleted file mode 100644 index d42823d7f5..0000000000 --- a/packages/babylon/test/fixtures/core/uncategorised/249/actual.js +++ /dev/null @@ -1 +0,0 @@ -for (var i = function() { return 10 in [] } in list) process(x); \ No newline at end of file diff --git a/packages/babylon/test/fixtures/core/uncategorised/249/expected.json b/packages/babylon/test/fixtures/core/uncategorised/249/expected.json deleted file mode 100644 index b0f5f0232d..0000000000 --- a/packages/babylon/test/fixtures/core/uncategorised/249/expected.json +++ /dev/null @@ -1,278 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 64 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 64 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ForInStatement", - "start": 0, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 64 - } - }, - "left": { - "type": "VariableDeclaration", - "start": 5, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 9, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "id": { - "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "i" - }, - "init": { - "type": "FunctionExpression", - "start": 13, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "id": null, - "generator": false, - "expression": false, - "params": [], - "body": { - "type": "BlockStatement", - "start": 24, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "body": [ - { - "type": "ReturnStatement", - "start": 26, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "argument": { - "type": "BinaryExpression", - "start": 33, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "left": { - "type": "Literal", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "value": 10, - "rawValue": 10, - "raw": "10" - }, - "operator": "in", - "right": { - "type": "ArrayExpression", - "start": 39, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "elements": [] - } - } - } - ] - } - } - } - ], - "kind": "var" - }, - "right": { - "type": "Identifier", - "start": 47, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 51 - } - }, - "name": "list" - }, - "body": { - "type": "ExpressionStatement", - "start": 53, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 64 - } - }, - "expression": { - "type": "CallExpression", - "start": 53, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 63 - } - }, - "callee": { - "type": "Identifier", - "start": 53, - "end": 60, - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 60 - } - }, - "name": "process" - }, - "arguments": [ - { - "type": "Identifier", - "start": 61, - "end": 62, - "loc": { - "start": { - "line": 1, - "column": 61 - }, - "end": { - "line": 1, - "column": 62 - } - }, - "name": "x" - } - ] - } - } - } - ] - } -} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/core/uncategorised/504/options.json b/packages/babylon/test/fixtures/core/uncategorised/504/options.json index a130c92268..570ca31728 100644 --- a/packages/babylon/test/fixtures/core/uncategorised/504/options.json +++ b/packages/babylon/test/fixtures/core/uncategorised/504/options.json @@ -1,3 +1,3 @@ { - "throws": "The keyword 'implements' is reserved (1:37)" -} \ No newline at end of file + "throws": "Binding implements in strict mode (1:37)" +} diff --git a/packages/babylon/test/fixtures/core/uncategorised/505/options.json b/packages/babylon/test/fixtures/core/uncategorised/505/options.json index c70c06968d..dfe4eddc2a 100644 --- a/packages/babylon/test/fixtures/core/uncategorised/505/options.json +++ b/packages/babylon/test/fixtures/core/uncategorised/505/options.json @@ -1,3 +1,3 @@ { - "throws": "The keyword 'interface' is reserved (1:37)" -} \ No newline at end of file + "throws": "Binding interface in strict mode (1:37)" +} diff --git a/packages/babylon/test/fixtures/core/uncategorised/506/options.json b/packages/babylon/test/fixtures/core/uncategorised/506/options.json index ac7ab9bdb7..766ddb41ca 100644 --- a/packages/babylon/test/fixtures/core/uncategorised/506/options.json +++ b/packages/babylon/test/fixtures/core/uncategorised/506/options.json @@ -1,3 +1,3 @@ { - "throws": "The keyword 'package' is reserved (1:37)" -} \ No newline at end of file + "throws": "Binding package in strict mode (1:37)" +} diff --git a/packages/babylon/test/fixtures/core/uncategorised/507/options.json b/packages/babylon/test/fixtures/core/uncategorised/507/options.json index 735d540526..9a7c12e0a6 100644 --- a/packages/babylon/test/fixtures/core/uncategorised/507/options.json +++ b/packages/babylon/test/fixtures/core/uncategorised/507/options.json @@ -1,3 +1,3 @@ { - "throws": "The keyword 'private' is reserved (1:37)" -} \ No newline at end of file + "throws": "Binding private in strict mode (1:37)" +} diff --git a/packages/babylon/test/fixtures/core/uncategorised/508/options.json b/packages/babylon/test/fixtures/core/uncategorised/508/options.json index a8145dcb6a..ba43694c8d 100644 --- a/packages/babylon/test/fixtures/core/uncategorised/508/options.json +++ b/packages/babylon/test/fixtures/core/uncategorised/508/options.json @@ -1,3 +1,3 @@ { - "throws": "The keyword 'protected' is reserved (1:37)" -} \ No newline at end of file + "throws": "Binding protected in strict mode (1:37)" +} diff --git a/packages/babylon/test/fixtures/core/uncategorised/509/options.json b/packages/babylon/test/fixtures/core/uncategorised/509/options.json index 232b3cba94..b1dbd863ed 100644 --- a/packages/babylon/test/fixtures/core/uncategorised/509/options.json +++ b/packages/babylon/test/fixtures/core/uncategorised/509/options.json @@ -1,3 +1,3 @@ { - "throws": "The keyword 'public' is reserved (1:37)" -} \ No newline at end of file + "throws": "Binding public in strict mode (1:37)" +} diff --git a/packages/babylon/test/fixtures/core/uncategorised/510/options.json b/packages/babylon/test/fixtures/core/uncategorised/510/options.json index 47fe5aafaf..75ad83ddbb 100644 --- a/packages/babylon/test/fixtures/core/uncategorised/510/options.json +++ b/packages/babylon/test/fixtures/core/uncategorised/510/options.json @@ -1,3 +1,3 @@ { - "throws": "The keyword 'static' is reserved (1:37)" -} \ No newline at end of file + "throws": "Binding static in strict mode (1:37)" +} diff --git a/packages/babylon/test/fixtures/core/uncategorised/513/options.json b/packages/babylon/test/fixtures/core/uncategorised/513/options.json index 07d74757d4..69a9237df8 100644 --- a/packages/babylon/test/fixtures/core/uncategorised/513/options.json +++ b/packages/babylon/test/fixtures/core/uncategorised/513/options.json @@ -1,3 +1,3 @@ { "throws": "The keyword 'static' is reserved (1:23)" -} \ No newline at end of file +} diff --git a/packages/babylon/test/fixtures/esprima/declaration-function/dupe-param/options.json b/packages/babylon/test/fixtures/esprima/declaration-function/dupe-param/options.json new file mode 100644 index 0000000000..e23388601b --- /dev/null +++ b/packages/babylon/test/fixtures/esprima/declaration-function/dupe-param/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Argument name clash in strict mode (1:14)" +} diff --git a/packages/babylon/test/fixtures/esprima/es2015-array-binding-pattern/invalid-elision-after-rest/actual.js b/packages/babylon/test/fixtures/esprima/es2015-array-binding-pattern/.invalid-elision-after-rest/actual.js similarity index 100% rename from packages/babylon/test/fixtures/esprima/es2015-array-binding-pattern/invalid-elision-after-rest/actual.js rename to packages/babylon/test/fixtures/esprima/es2015-array-binding-pattern/.invalid-elision-after-rest/actual.js diff --git a/packages/babylon/test/fixtures/esprima/es2015-array-binding-pattern/invalid-elision-after-rest/expected.json b/packages/babylon/test/fixtures/esprima/es2015-array-binding-pattern/.invalid-elision-after-rest/expected.json similarity index 100% rename from packages/babylon/test/fixtures/esprima/es2015-array-binding-pattern/invalid-elision-after-rest/expected.json rename to packages/babylon/test/fixtures/esprima/es2015-array-binding-pattern/.invalid-elision-after-rest/expected.json diff --git a/packages/babylon/test/fixtures/esprima/es2015-array-binding-pattern/invalid-elision-after-rest/options.json b/packages/babylon/test/fixtures/esprima/es2015-array-binding-pattern/.invalid-elision-after-rest/options.json similarity index 100% rename from packages/babylon/test/fixtures/esprima/es2015-array-binding-pattern/invalid-elision-after-rest/options.json rename to packages/babylon/test/fixtures/esprima/es2015-array-binding-pattern/.invalid-elision-after-rest/options.json diff --git a/packages/babylon/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/options.json b/packages/babylon/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/options.json new file mode 100644 index 0000000000..d498cd8bd0 --- /dev/null +++ b/packages/babylon/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Argument name clash in strict mode (2:14)" +} diff --git a/packages/babylon/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/options.json b/packages/babylon/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/options.json new file mode 100644 index 0000000000..e3176a8e57 --- /dev/null +++ b/packages/babylon/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Argument name clash in strict mode (2:17)" +} diff --git a/packages/babylon/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/options.json b/packages/babylon/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/options.json new file mode 100644 index 0000000000..2d74a95450 --- /dev/null +++ b/packages/babylon/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Argument name clash in strict mode (2:19)" +} diff --git a/packages/babylon/test/fixtures/esprima/es2015-array-pattern/patterned-catch-dupe/options.json b/packages/babylon/test/fixtures/esprima/es2015-array-pattern/patterned-catch-dupe/options.json index aca079ee39..7d5bec6e9b 100644 --- a/packages/babylon/test/fixtures/esprima/es2015-array-pattern/patterned-catch-dupe/options.json +++ b/packages/babylon/test/fixtures/esprima/es2015-array-pattern/patterned-catch-dupe/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:20)" -} \ No newline at end of file + "throws": "Argument name clash in strict mode (1:17)" +} diff --git a/packages/babylon/test/fixtures/esprima/es2015-array-pattern/rest/options.json b/packages/babylon/test/fixtures/esprima/es2015-array-pattern/rest/options.json deleted file mode 100644 index 328b1ddde8..0000000000 --- a/packages/babylon/test/fixtures/esprima/es2015-array-pattern/rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token (1:10)" -} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json b/packages/babylon/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json index 89e36d9013..98d7123790 100644 --- a/packages/babylon/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json +++ b/packages/babylon/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:16)" -} \ No newline at end of file + "throws": "Unexpected token (1:15)" +} diff --git a/packages/babylon/test/fixtures/esprima/es2015-generator/generator-parameter-binding-property-reserved/expected.json b/packages/babylon/test/fixtures/esprima/es2015-generator/generator-parameter-binding-property-reserved/expected.json new file mode 100644 index 0000000000..4b57db559b --- /dev/null +++ b/packages/babylon/test/fixtures/esprima/es2015-generator/generator-parameter-binding-property-reserved/expected.json @@ -0,0 +1,153 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": null, + "generator": true, + "expression": false, + "params": [ + { + "type": "ObjectPattern", + "start": 11, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "properties": [ + { + "type": "Property", + "start": 12, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "name": "yield" + }, + "kind": "init", + "value": { + "type": "Identifier", + "start": 12, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "name": "yield" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [] + }, + "parenthesizedExpression": true + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/esprima/es2015-super-property/invalid_super_access/options.json b/packages/babylon/test/fixtures/esprima/es2015-super-property/invalid_super_access/options.json index 18fe6d12a8..2c472e02d3 100644 --- a/packages/babylon/test/fixtures/esprima/es2015-super-property/invalid_super_access/options.json +++ b/packages/babylon/test/fixtures/esprima/es2015-super-property/invalid_super_access/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected super (3:9)" + "throws": "Unexpected super (3:14)" } diff --git a/packages/babylon/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/expected.json b/packages/babylon/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/expected.json new file mode 100644 index 0000000000..2bdc41583c --- /dev/null +++ b/packages/babylon/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/expected.json @@ -0,0 +1,148 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "Literal", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "rawValue": "use strict", + "raw": "\"use strict\"" + } + }, + { + "type": "FunctionDeclaration", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "name": "f" + }, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 29, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "expression": { + "type": "Identifier", + "start": 29, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "name": "yield" + } + } + ] + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0224/options.json b/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0224/options.json index a130c92268..570ca31728 100644 --- a/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0224/options.json +++ b/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0224/options.json @@ -1,3 +1,3 @@ { - "throws": "The keyword 'implements' is reserved (1:37)" -} \ No newline at end of file + "throws": "Binding implements in strict mode (1:37)" +} diff --git a/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0225/options.json b/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0225/options.json index c70c06968d..dfe4eddc2a 100644 --- a/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0225/options.json +++ b/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0225/options.json @@ -1,3 +1,3 @@ { - "throws": "The keyword 'interface' is reserved (1:37)" -} \ No newline at end of file + "throws": "Binding interface in strict mode (1:37)" +} diff --git a/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0226/options.json b/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0226/options.json index ac7ab9bdb7..766ddb41ca 100644 --- a/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0226/options.json +++ b/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0226/options.json @@ -1,3 +1,3 @@ { - "throws": "The keyword 'package' is reserved (1:37)" -} \ No newline at end of file + "throws": "Binding package in strict mode (1:37)" +} diff --git a/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0227/options.json b/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0227/options.json index 735d540526..9a7c12e0a6 100644 --- a/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0227/options.json +++ b/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0227/options.json @@ -1,3 +1,3 @@ { - "throws": "The keyword 'private' is reserved (1:37)" -} \ No newline at end of file + "throws": "Binding private in strict mode (1:37)" +} diff --git a/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0228/options.json b/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0228/options.json index a8145dcb6a..ba43694c8d 100644 --- a/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0228/options.json +++ b/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0228/options.json @@ -1,3 +1,3 @@ { - "throws": "The keyword 'protected' is reserved (1:37)" -} \ No newline at end of file + "throws": "Binding protected in strict mode (1:37)" +} diff --git a/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0229/options.json b/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0229/options.json index 232b3cba94..b1dbd863ed 100644 --- a/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0229/options.json +++ b/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0229/options.json @@ -1,3 +1,3 @@ { - "throws": "The keyword 'public' is reserved (1:37)" -} \ No newline at end of file + "throws": "Binding public in strict mode (1:37)" +} diff --git a/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0230/options.json b/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0230/options.json index 47fe5aafaf..75ad83ddbb 100644 --- a/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0230/options.json +++ b/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0230/options.json @@ -1,3 +1,3 @@ { - "throws": "The keyword 'static' is reserved (1:37)" -} \ No newline at end of file + "throws": "Binding static in strict mode (1:37)" +} diff --git a/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0239/options.json b/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0239/options.json index 07d74757d4..b3e95a5757 100644 --- a/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0239/options.json +++ b/packages/babylon/test/fixtures/esprima/invalid-syntax/migrated_0239/options.json @@ -1,3 +1,3 @@ { - "throws": "The keyword 'static' is reserved (1:23)" -} \ No newline at end of file + "throws": "Binding static in strict mode (1:23)" +} diff --git a/packages/babylon/test/fixtures/harmony/uncategorised/334/expected.json b/packages/babylon/test/fixtures/harmony/uncategorised/334/expected.json new file mode 100644 index 0000000000..7b7e0ac66d --- /dev/null +++ b/packages/babylon/test/fixtures/harmony/uncategorised/334/expected.json @@ -0,0 +1,128 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "module", + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "RestElement", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "argument": { + "type": "Identifier", + "start": 4, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "name": "eval" + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 12, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "name": "arr" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/harmony/uncategorised/335/expected.json b/packages/babylon/test/fixtures/harmony/uncategorised/335/expected.json new file mode 100644 index 0000000000..5e726736c7 --- /dev/null +++ b/packages/babylon/test/fixtures/harmony/uncategorised/335/expected.json @@ -0,0 +1,152 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": "y" + }, + "generator": true, + "expression": false, + "params": [ + { + "type": "ObjectPattern", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "properties": [ + { + "type": "Property", + "start": 13, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 13, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "name": "yield" + }, + "kind": "init", + "value": { + "type": "Identifier", + "start": 13, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "name": "yield" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "body": [] + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/harmony/uncategorised/51/actual.js b/packages/babylon/test/fixtures/harmony/uncategorised/51/actual.js deleted file mode 100644 index 1f226ec28d..0000000000 --- a/packages/babylon/test/fixtures/harmony/uncategorised/51/actual.js +++ /dev/null @@ -1 +0,0 @@ -(a, a) => 42 \ No newline at end of file diff --git a/packages/babylon/test/fixtures/harmony/uncategorised/51/expected.json b/packages/babylon/test/fixtures/harmony/uncategorised/51/expected.json deleted file mode 100644 index 0fe0e61786..0000000000 --- a/packages/babylon/test/fixtures/harmony/uncategorised/51/expected.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "id": null, - "generator": false, - "expression": true, - "params": [ - { - "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "name": "a" - }, - { - "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "a" - } - ], - "body": { - "type": "Literal", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "value": 42, - "rawValue": 42, - "raw": "42" - } - } - } - ] - }, - "comments": [] -} \ No newline at end of file