From b79bad926b8cf7533d6614952a10b46f4ffc1db7 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Mon, 29 Dec 2014 14:33:56 -0800 Subject: [PATCH] New: Implement generators (refs #10) --- README.md | 3 + espree.js | 347 ++++++++++++++---- lib/ast-node-factory.js | 38 +- lib/ast-node-types.js | 1 + lib/features.js | 3 + lib/messages.js | 1 + lib/syntax.js | 5 +- tests/fixtures/ast/API.json | 1 + tests/fixtures/ast/Invalid-syntax.json | 2 +- tests/fixtures/ast/Tolerant-parse.json | 143 -------- ...st.js => block-trailing-comment.result.js} | 2 +- ...js => surrounding-call-comments.result.js} | 2 +- ...> surrounding-debugger-comments.result.js} | 2 +- ... => surrounding-return-comments.result.js} | 2 +- ...s => surrounding-throw-comments.result.js} | 2 +- .../surrounding-while-loop-comments.ast.js | 286 --------------- .../surrounding-while-loop-comments.result.js | 286 +++++++++++++++ ...fallthrough-comment-in-function.result.js} | 2 +- ...s => switch-fallthrough-comment.result.js} | 2 +- ...-no-default-comment-in-function.result.js} | 2 +- ...ult-comment-in-nested-functions.result.js} | 2 +- ...js => switch-no-default-comment.result.js} | 2 +- .../for-of-with-const-and-no-braces.result.js | 2 +- .../for-of-with-let-and-no-braces.result.js | 2 +- .../generator-object-literal-method.config.js | 4 + .../generator-object-literal-method.result.js | 227 ++++++++++++ .../generator-object-literal-method.src.js | 1 + .../computed-method-property.result.js | 2 +- .../binaryLiterals/invalid.result.js | 11 +- .../binaryLiterals/lowercase.result.js | 2 +- .../binaryLiterals/uppercase.result.js | 2 +- .../blockBindings/const.result.js | 101 +++-- .../ecma-features/blockBindings/let.result.js | 3 +- ...for-of-with-function-initializer.result.js | 4 +- .../for-of-with-var-and-braces.result.js | 2 +- .../for-of-with-var-and-no-braces.result.js | 2 +- ...-for-of-with-const-and-no-braces.result.js | 11 +- ...id-for-of-with-let-and-no-braces.result.js | 11 +- .../generators/anonymous-generator.result.js | 131 +++++++ .../generators/anonymous-generator.src.js | 1 + .../generators/double-yield.result.js | 150 ++++++++ .../generators/double-yield.src.js | 1 + .../empty-generator-declaration.result.js | 94 +++++ .../empty-generator-declaration.src.js | 1 + .../generator-declaration.result.js | 148 ++++++++ .../generators/generator-declaration.src.js | 1 + .../generators/yield-delegation.result.js | 131 +++++++ .../generators/yield-delegation.src.js | 1 + .../jsx/embedded-comment.result.js | 2 +- .../jsx/embedded-conditional.result.js | 2 +- .../embedded-invalid-js-identifier.result.js | 2 +- .../ecma-features/jsx/embedded-tags.result.js | 2 +- .../jsx/empty-placeholder.result.js | 2 +- .../jsx/escape-patterns.result.js | 2 +- ...invalid-attribute-missing-equals.result.js | 2 +- .../jsx/invalid-attribute.result.js | 2 +- .../jsx/invalid-broken-tag.result.js | 2 +- .../invalid-computed-end-tag-name.result.js | 2 +- ...lid-computed-string-end-tag-name.result.js | 2 +- .../jsx/invalid-embedded-expression.result.js | 2 +- .../invalid-leading-dot-tag-name.result.js | 2 +- ...ching-placeholder-in-closing-tag.result.js | 2 +- .../invalid-mismatched-closing-tag.result.js | 2 +- .../invalid-mismatched-closing-tags.result.js | 2 +- .../invalid-mismatched-dot-tag-name.result.js | 2 +- ...invalid-mismatched-namespace-tag.result.js | 2 +- ...losing-tag-attribute-placeholder.result.js | 2 +- .../jsx/invalid-missing-closing-tag.result.js | 2 +- .../invalid-missing-namespace-name.result.js | 2 +- .../invalid-missing-namespace-value.result.js | 2 +- .../invalid-missing-spread-operator.result.js | 2 +- ...nvalid-namespace-name-with-docts.result.js | 2 +- ...nvalid-namespace-value-with-dots.result.js | 2 +- ...id-no-common-parent-with-comment.result.js | 2 +- .../jsx/invalid-no-common-parent.result.js | 2 +- .../jsx/invalid-no-tag-name.result.js | 2 +- ...valid-placeholder-in-closing-tag.result.js | 2 +- .../invalid-trailing-dot-tag-name.result.js | 2 +- .../jsx/invalid-unexpected-comma.result.js | 2 +- .../jsx/japanese-characters.result.js | 2 +- .../jsx/less-than-operator.result.js | 2 +- .../jsx/multiple-blank-spaces.result.js | 2 +- ...ced-attribute-and-value-inserted.result.js | 2 +- .../namespaced-name-and-attribute.result.js | 2 +- .../jsx/newslines-and-entities.result.js | 2 +- .../self-closing-tag-with-newline.result.js | 2 +- .../jsx/self-closing-tag.result.js | 2 +- ...-attribute-and-regular-attribute.result.js | 2 +- .../jsx/spread-operator-attributes.result.js | 2 +- .../jsx/tag-names-with-dots.result.js | 2 +- .../jsx/tag-names-with-multi-dots.result.js | 2 +- .../ecma-features/jsx/test-content.result.js | 2 +- ...ailing-spread-operator-attribute.result.js | 2 +- .../jsx/unknown-escape-pattern.result.js | 2 +- .../computed-addition-property.result.js | 2 +- .../computed-and-identifier.result.js | 2 +- .../computed-getter-and-setter.result.js | 2 +- .../computed-string-property.result.js | 2 +- .../computed-variable-property.result.js | 2 +- ...valid-computed-variable-property.result.js | 11 +- ...alone-computed-variable-property.result.js | 11 +- ...ndalone-expression-with-addition.result.js | 2 +- ...tandalone-expression-with-method.result.js | 2 +- .../standalone-expression.result.js | 2 +- .../invalid-method-no-braces.result.js | 11 +- .../method-property.result.js | 2 +- .../simple-method-named-get.result.js | 2 +- .../simple-method-named-set.result.js | 2 +- .../simple-method-with-argument.result.js | 2 +- .../simple-method-with-string-name.result.js | 2 +- .../simple-method.result.js | 2 +- .../string-name-method-property.result.js | 2 +- .../shorthand-properties.result.js | 2 +- .../octalLiterals/invalid.result.js | 11 +- .../octalLiterals/lowercase.result.js | 2 +- .../octalLiterals/uppercase.result.js | 2 +- .../regex-u-extended-escape.result.js | 132 ++++--- .../regex-u-invalid-extended-escape.result.js | 11 +- .../regexUFlag/regex-u-simple.result.js | 111 +++--- .../regexYFlag/regexp-y-simple.result.js | 111 +++--- tests/lib/attach-comments.js | 4 +- tools/create-test-example.js | 12 +- tools/update-tests.js | 128 +++++++ 123 files changed, 1994 insertions(+), 869 deletions(-) rename tests/fixtures/attach-comments/{block-trailing-comment.ast.js => block-trailing-comment.result.js} (99%) rename tests/fixtures/attach-comments/{surrounding-call-comments.ast.js => surrounding-call-comments.result.js} (99%) rename tests/fixtures/attach-comments/{surrounding-debugger-comments.ast.js => surrounding-debugger-comments.result.js} (99%) rename tests/fixtures/attach-comments/{surrounding-return-comments.ast.js => surrounding-return-comments.result.js} (99%) rename tests/fixtures/attach-comments/{surrounding-throw-comments.ast.js => surrounding-throw-comments.result.js} (99%) delete mode 100644 tests/fixtures/attach-comments/surrounding-while-loop-comments.ast.js create mode 100644 tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js rename tests/fixtures/attach-comments/{switch-fallthrough-comment-in-function.ast.js => switch-fallthrough-comment-in-function.result.js} (99%) rename tests/fixtures/attach-comments/{switch-fallthrough-comment.ast.js => switch-fallthrough-comment.result.js} (99%) rename tests/fixtures/attach-comments/{switch-no-default-comment-in-function.ast.js => switch-no-default-comment-in-function.result.js} (99%) rename tests/fixtures/attach-comments/{switch-no-default-comment-in-nested-functions.ast.js => switch-no-default-comment-in-nested-functions.result.js} (99%) rename tests/fixtures/attach-comments/{switch-no-default-comment.ast.js => switch-no-default-comment.result.js} (99%) create mode 100644 tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.config.js create mode 100644 tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.result.js create mode 100644 tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.src.js create mode 100644 tests/fixtures/ecma-features/generators/anonymous-generator.result.js create mode 100644 tests/fixtures/ecma-features/generators/anonymous-generator.src.js create mode 100644 tests/fixtures/ecma-features/generators/double-yield.result.js create mode 100644 tests/fixtures/ecma-features/generators/double-yield.src.js create mode 100644 tests/fixtures/ecma-features/generators/empty-generator-declaration.result.js create mode 100644 tests/fixtures/ecma-features/generators/empty-generator-declaration.src.js create mode 100644 tests/fixtures/ecma-features/generators/generator-declaration.result.js create mode 100644 tests/fixtures/ecma-features/generators/generator-declaration.src.js create mode 100644 tests/fixtures/ecma-features/generators/yield-delegation.result.js create mode 100644 tests/fixtures/ecma-features/generators/yield-delegation.src.js create mode 100644 tools/update-tests.js diff --git a/README.md b/README.md index e41b2f6c..1bf8ecc8 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,9 @@ var ast = espree.parse(code, { // enable parsing of shorthand object literal properties objectLiteralShorthandProperties: false, + // enable parsing of generators/yield + generators: false, + // React JSX parsing jsx: false } diff --git a/espree.js b/espree.js index 117072ba..1767a38f 100644 --- a/espree.js +++ b/espree.js @@ -349,7 +349,7 @@ function scanIdentifier() { // Thus, it must be an identifier. if (id.length === 1) { type = Token.Identifier; - } else if (syntax.isKeyword(id, strict)) { + } else if (syntax.isKeyword(id, strict, extra.ecmaFeatures)) { type = Token.Keyword; } else if (id === "null") { type = Token.NullLiteral; @@ -2165,28 +2165,45 @@ function parseArrayInitialiser() { // 11.1.5 Object Initialiser -function parsePropertyFunction(params, first) { +function parsePropertyFunction(options) { var previousStrict = strict, - marker = markerCreate(), - body; + previousYieldAllowed = state.yieldAllowed, + params = options.params || [], + defaults = options.defaults || [], + body, + marker = markerCreate(); - params = params || []; + state.yieldAllowed = options.generator; + + /* + * Esprima uses parseConciseBody() here, which is incorrect. Object literal + * methods must have braces. + */ body = parseFunctionSourceElements(); - if (first && strict && syntax.isRestrictedWord(params[0].name)) { - throwErrorTolerant(first, Messages.StrictParamName); + if (options.name && strict && syntax.isRestrictedWord(params[0].name)) { + throwErrorTolerant(options.name, Messages.StrictParamName); } strict = previousStrict; - - return markerApply(marker, astNodeFactory.createFunctionExpression(null, params, [], body)); + state.yieldAllowed = previousYieldAllowed; + + return markerApply(marker, astNodeFactory.createFunctionExpression( + null, + params, + defaults, + body, + options.rest || null, + options.generator, + body.type !== astNodeTypes.BlockStatement + )); } +function parsePropertyMethodFunction(options) { + var previousStrict = strict, + tmp, + method; -function parsePropertyMethodFunction() { - var previousStrict, tmp, method; - - previousStrict = strict; strict = true; tmp = parseParams(); @@ -2195,7 +2212,12 @@ function parsePropertyMethodFunction() { throwErrorTolerant(tmp.stricted, tmp.message); } - method = parsePropertyFunction(tmp.params); + method = parsePropertyFunction({ + params: tmp.params, + defaults: tmp.defaults, + rest: tmp.rest, + generator: options ? options.generator : false + }); strict = previousStrict; @@ -2234,10 +2256,11 @@ function parseObjectPropertyKey() { } function parseObjectProperty() { - var token, key, id, value, param, computed; + var token, key, id, param, computed; var allowComputed = extra.ecmaFeatures.objectLiteralComputedProperties, allowMethod = extra.ecmaFeatures.objectLiteralShorthandMethods, allowShorthand = extra.ecmaFeatures.objectLiteralShorthandProperties, + allowGenerators = extra.ecmaFeatures.generators, marker = markerCreate(); token = lookahead; @@ -2256,35 +2279,72 @@ function parseObjectProperty() { key = parseObjectPropertyKey(); expect("("); expect(")"); - value = parsePropertyFunction([]); - return markerApply(marker, astNodeFactory.createProperty("get", key, value, false, false, computed)); + return markerApply( + marker, + astNodeFactory.createProperty( + "get", + key, + parsePropertyFunction({ generator: false }), + false, + false, + computed + ) + ); } + if (token.value === "set" && !match(":") && !match("(")) { computed = (lookahead.value === "["); key = parseObjectPropertyKey(); expect("("); token = lookahead; - if (token.type !== Token.Identifier) { - expect(")"); - throwErrorTolerant(token, Messages.UnexpectedToken, token.value); - value = parsePropertyFunction([]); - } else { - param = [ parseVariableIdentifier() ]; - expect(")"); - value = parsePropertyFunction(param, token); - } - return markerApply(marker, astNodeFactory.createProperty("set", key, value, false, false, computed)); + param = [ parseVariableIdentifier() ]; + expect(")"); + return markerApply( + marker, + astNodeFactory.createProperty( + "set", + key, + parsePropertyFunction({ + params: param, + generator: false, + name: token + }), + false, + false, + computed + ) + ); } // normal property (key:value) if (match(":")) { lex(); - return markerApply(marker, astNodeFactory.createProperty("init", id, parseAssignmentExpression(), false, false, computed)); + return markerApply( + marker, + astNodeFactory.createProperty( + "init", + id, + parseAssignmentExpression(), + false, + false, + computed + ) + ); } // method shorthand (key(){...}) if (allowMethod && match("(")) { - return markerApply(marker, astNodeFactory.createProperty("init", id, parsePropertyMethodFunction({ generator: false }), true, false, computed)); + return markerApply( + marker, + astNodeFactory.createProperty( + "init", + id, + parsePropertyMethodFunction({ generator: false }), + true, + false, + computed + ) + ); } /* @@ -2298,11 +2358,46 @@ function parseObjectProperty() { } // shorthand property - return markerApply(marker, astNodeFactory.createProperty("init", id, id, false, true, false)); + return markerApply( + marker, + astNodeFactory.createProperty( + "init", + id, + id, + false, + true, + false + ) + ); } + // only possibility in this branch is a generator if (token.type === Token.EOF || token.type === Token.Punctuator) { - throwUnexpected(token); + if (!allowGenerators || !match("*")) { + throwUnexpected(token); + } + lex(); + + computed = (lookahead.type === Token.Punctuator && lookahead.value === "["); + + id = parseObjectPropertyKey(); + + if (!match("(")) { + throwUnexpected(lex()); + } + + return markerApply( + marker, + astNodeFactory.createProperty( + "init", + id, + parsePropertyMethodFunction({ generator: true }), + true, + false, + computed + ) + ); + } else { /* @@ -2315,12 +2410,32 @@ function parseObjectProperty() { // check for property value if (match(":")) { lex(); - return markerApply(marker, astNodeFactory.createProperty("init", key, parseAssignmentExpression(), false, false, false)); + return markerApply( + marker, + astNodeFactory.createProperty( + "init", + key, + parseAssignmentExpression(), + false, + false, + false + ) + ); } // check for method if (allowMethod && match("(")) { - return markerApply(marker, astNodeFactory.createProperty("init", key, parsePropertyMethodFunction(), true, false, false)); + return markerApply( + marker, + astNodeFactory.createProperty( + "init", + key, + parsePropertyMethodFunction(), + true, + false, + false + ) + ); } // no other options, this is bad @@ -2822,8 +2937,17 @@ function parseConditionalExpression() { function parseAssignmentExpression() { var token, left, right, node, - marker = markerCreate(); + marker, + allowGenerators = extra.ecmaFeatures.generators; + + // Note that 'yield' is treated as a keyword in strict mode, but a + // contextual keyword (identifier) in non-strict mode, so we need + // to use matchKeyword and matchContextualKeyword appropriately. + if (allowGenerators && ((state.yieldAllowed && matchContextualKeyword("yield")) || (strict && matchKeyword("yield")))) { + return parseYieldExpression(); + } + marker = markerCreate(); token = lookahead; node = left = parseConditionalExpression(); @@ -3694,54 +3818,85 @@ function parseParams(firstRestricted) { } function parseFunctionDeclaration() { - var id, params = [], body, token, stricted, tmp, firstRestricted, message, previousStrict, - marker = markerCreate(); + var id, body, token, tmp, firstRestricted, message, previousStrict, previousYieldAllowed, generator, + marker = markerCreate(), + allowGenerators = extra.ecmaFeatures.generators; - expectKeyword("function"); - token = lookahead; - id = parseVariableIdentifier(); - if (strict) { - if (syntax.isRestrictedWord(token.value)) { - throwErrorTolerant(token, Messages.StrictFunctionName); + expectKeyword("function"); + + generator = false; + if (allowGenerators && match("*")) { + lex(); + generator = true; } - } else { - if (syntax.isRestrictedWord(token.value)) { - firstRestricted = token; - message = Messages.StrictFunctionName; - } else if (syntax.isStrictModeReservedWord(token.value)) { - firstRestricted = token; - message = Messages.StrictReservedWord; + + token = lookahead; + + id = parseVariableIdentifier(); + + if (strict) { + if (syntax.isRestrictedWord(token.value)) { + throwErrorTolerant(token, Messages.StrictFunctionName); + } + } else { + if (syntax.isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictFunctionName; + } else if (syntax.isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } } - } - tmp = parseParams(firstRestricted); - params = tmp.params; - stricted = tmp.stricted; - firstRestricted = tmp.firstRestricted; - if (tmp.message) { - message = tmp.message; - } + tmp = parseParams(firstRestricted); + firstRestricted = tmp.firstRestricted; + if (tmp.message) { + message = tmp.message; + } - previousStrict = strict; - body = parseFunctionSourceElements(); - if (strict && firstRestricted) { - throwError(firstRestricted, message); - } - if (strict && stricted) { - throwErrorTolerant(stricted, message); - } - strict = previousStrict; + previousStrict = strict; + previousYieldAllowed = state.yieldAllowed; + state.yieldAllowed = generator; - return markerApply(marker, astNodeFactory.createFunctionDeclaration(id, params, [], body)); -} + body = parseFunctionSourceElements(); + + if (strict && firstRestricted) { + throwError(firstRestricted, message); + } + if (strict && tmp.stricted) { + throwErrorTolerant(tmp.stricted, message); + } + strict = previousStrict; + state.yieldAllowed = previousYieldAllowed; + + return markerApply( + marker, + astNodeFactory.createFunctionDeclaration( + id, + tmp.params, + tmp.defaults, + body, + tmp.rest, + generator, + false + ) + ); + } function parseFunctionExpression() { - var token, id = null, stricted, firstRestricted, message, tmp, params = [], - body, previousStrict, - marker = markerCreate(); + var token, id = null, firstRestricted, message, tmp, body, previousStrict, previousYieldAllowed, generator, + marker = markerCreate(), + allowGenerators = extra.ecmaFeatures.generators; expectKeyword("function"); + generator = false; + + if (allowGenerators && match("*")) { + lex(); + generator = true; + } + if (!match("(")) { token = lookahead; id = parseVariableIdentifier(); @@ -3761,26 +3916,62 @@ function parseFunctionExpression() { } tmp = parseParams(firstRestricted); - params = tmp.params; - stricted = tmp.stricted; firstRestricted = tmp.firstRestricted; if (tmp.message) { message = tmp.message; } previousStrict = strict; + previousYieldAllowed = state.yieldAllowed; + state.yieldAllowed = generator; + body = parseFunctionSourceElements(); + if (strict && firstRestricted) { throwError(firstRestricted, message); } - if (strict && stricted) { - throwErrorTolerant(stricted, message); + if (strict && tmp.stricted) { + throwErrorTolerant(tmp.stricted, message); } strict = previousStrict; + state.yieldAllowed = previousYieldAllowed; - return markerApply(marker, astNodeFactory.createFunctionExpression(id, params, [], body)); + return markerApply( + marker, + astNodeFactory.createFunctionExpression( + id, + tmp.params, + tmp.defaults, + body, + tmp.rest, + generator, + false + ) + ); } +function parseYieldExpression() { + var yieldToken, delegateFlag, expr, marker = markerCreate(); + + yieldToken = lex(); + assert(yieldToken.value === "yield", "Called parseYieldExpression with non-yield lookahead."); + + if (!state.yieldAllowed) { + throwErrorTolerant({}, Messages.IllegalYield); + } + + delegateFlag = false; + if (match("*")) { + lex(); + delegateFlag = true; + } + + expr = parseAssignmentExpression(); + + return markerApply(marker, astNodeFactory.createYieldExpression(expr, delegateFlag)); +} + + // 14 Program function parseSourceElement() { @@ -3909,6 +4100,8 @@ function tokenize(code, options) { inIteration: false, inSwitch: false, lastCommentStart: -1, + yieldAllowed: false, + inJSXSpreadAttribute: false, inJSXChild: false, inJSXTag: false }; @@ -4007,6 +4200,8 @@ function parse(code, options) { inIteration: false, inSwitch: false, lastCommentStart: -1, + yieldAllowed: false, + inJSXSpreadAttribute: false, inJSXChild: false, inJSXTag: false }; diff --git a/lib/ast-node-factory.js b/lib/ast-node-factory.js index a61c788b..ebbb48cf 100644 --- a/lib/ast-node-factory.js +++ b/lib/ast-node-factory.js @@ -282,18 +282,23 @@ module.exports = { * @param {ASTNode} params The function arguments * @param {ASTNode} defaults Any default arguments (ES6-only feature) * @param {ASTNode} body The function body + * @param {ASTNode} rest The node representing a rest argument. + * @param {boolean} generator True if the function is a generator, false if not. + * @param {boolean} expression True if the function is created via an expression. + * Always false for declarations, but kept here to be in sync with + * FunctionExpression objects. * @returns {ASTNode} An ASTNode representing a function declaration */ - createFunctionDeclaration: function (id, params, defaults, body) { + createFunctionDeclaration: function (id, params, defaults, body, rest, generator, expression) { return { type: astNodeTypes.FunctionDeclaration, id: id, params: params, - defaults: defaults, + defaults: defaults || [], body: body, - rest: null, - generator: false, - expression: false + rest: rest || null, + generator: !!generator, + expression: !!expression }; }, @@ -303,18 +308,21 @@ module.exports = { * @param {ASTNode} params The function arguments * @param {ASTNode} defaults Any default arguments (ES6-only feature) * @param {ASTNode} body The function body - * @returns {ASTNode} An ASTNode representing a function expression + * @param {ASTNode} rest The node representing a rest argument. + * @param {boolean} generator True if the function is a generator, false if not. + * @param {boolean} expression True if the function is created via an expression. + * @returns {ASTNode} An ASTNode representing a function declaration */ - createFunctionExpression: function (id, params, defaults, body) { + createFunctionExpression: function (id, params, defaults, body, rest, generator, expression) { return { type: astNodeTypes.FunctionExpression, id: id, params: params, - defaults: defaults, + defaults: defaults || [], body: body, - rest: null, - generator: false, - expression: false + rest: rest || null, + generator: !!generator, + expression: !!expression }; }, @@ -630,6 +638,14 @@ module.exports = { }; }, + createYieldExpression: function (argument, delegate) { + return { + type: astNodeTypes.YieldExpression, + argument: argument, + delegate: delegate + }; + }, + createJSXAttribute: function (name, value) { return { type: astNodeTypes.JSXAttribute, diff --git a/lib/ast-node-types.js b/lib/ast-node-types.js index fe8712cf..4d64538e 100644 --- a/lib/ast-node-types.js +++ b/lib/ast-node-types.js @@ -79,6 +79,7 @@ module.exports = { VariableDeclarator: "VariableDeclarator", WhileStatement: "WhileStatement", WithStatement: "WithStatement", + YieldExpression: "YieldExpression", JSXIdentifier: "JSXIdentifier", JSXNamespacedName: "JSXNamespacedName", JSXMemberExpression: "JSXMemberExpression", diff --git a/lib/features.js b/lib/features.js index 58223c3a..6b162c5e 100644 --- a/lib/features.js +++ b/lib/features.js @@ -66,6 +66,9 @@ module.exports = { // enable parsing of shorthand object literal properties objectLiteralShorthandProperties: false, + // enable parsing of generators/yield + generators: false, + // React JSX parsing jsx: false }; diff --git a/lib/messages.js b/lib/messages.js index 47b46034..4a50e587 100644 --- a/lib/messages.js +++ b/lib/messages.js @@ -58,6 +58,7 @@ module.exports = { IllegalContinue: "Illegal continue statement", IllegalBreak: "Illegal break statement", IllegalReturn: "Illegal return statement", + IllegalYield: "Illegal yield expression", StrictModeWith: "Strict mode code may not include a with statement", StrictCatchVariable: "Catch variable may not be eval or arguments in strict mode", StrictVarName: "Variable name may not be eval or arguments in strict mode", diff --git a/lib/syntax.js b/lib/syntax.js index 1886e115..7cad1afc 100644 --- a/lib/syntax.js +++ b/lib/syntax.js @@ -136,7 +136,8 @@ module.exports = { // 7.6.1.1 Keywords - isKeyword: function(id, strict) { + isKeyword: function(id, strict, ecmaFeatures) { + if (strict && this.isStrictModeReservedWord(id)) { return true; } @@ -156,7 +157,7 @@ module.exports = { (id === "void") || (id === "with") || (id === "enum"); case 5: return (id === "while") || (id === "break") || (id === "catch") || - (id === "throw") || (id === "const") || (id === "yield") || + (id === "throw") || (id === "const") || (!ecmaFeatures.generators && id === "yield") || (id === "class") || (id === "super"); case 6: return (id === "return") || (id === "typeof") || (id === "delete") || diff --git a/tests/fixtures/ast/API.json b/tests/fixtures/ast/API.json index b44075ce..4234b0c3 100644 --- a/tests/fixtures/ast/API.json +++ b/tests/fixtures/ast/API.json @@ -190,6 +190,7 @@ "VariableDeclarator": "VariableDeclarator", "WhileStatement": "WhileStatement", "WithStatement": "WithStatement", + "YieldExpression": "YieldExpression", "JSXIdentifier": "JSXIdentifier", "JSXNamespacedName": "JSXNamespacedName", "JSXMemberExpression": "JSXMemberExpression", diff --git a/tests/fixtures/ast/Invalid-syntax.json b/tests/fixtures/ast/Invalid-syntax.json index d9314c5c..7bf68b5c 100644 --- a/tests/fixtures/ast/Invalid-syntax.json +++ b/tests/fixtures/ast/Invalid-syntax.json @@ -1319,4 +1319,4 @@ "column": 22, "message": "Error: Line 1: Unexpected end of input" } -} \ No newline at end of file +} diff --git a/tests/fixtures/ast/Tolerant-parse.json b/tests/fixtures/ast/Tolerant-parse.json index 2a0cc465..4d366517 100644 --- a/tests/fixtures/ast/Tolerant-parse.json +++ b/tests/fixtures/ast/Tolerant-parse.json @@ -5425,149 +5425,6 @@ } ] }, - "({ set s() { } })": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "s", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - "defaults": [], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "rest": null, - "generator": false, - "expression": false, - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "kind": "set", - "range": [ - 3, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 1, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - } - ], - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "errors": [ - { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Error: Line 1: Unexpected token )" - } - ] - }, "foo(\"bar\") = baz": { "type": "Program", "body": [ diff --git a/tests/fixtures/attach-comments/block-trailing-comment.ast.js b/tests/fixtures/attach-comments/block-trailing-comment.result.js similarity index 99% rename from tests/fixtures/attach-comments/block-trailing-comment.ast.js rename to tests/fixtures/attach-comments/block-trailing-comment.result.js index 6d646dea..cda51a63 100644 --- a/tests/fixtures/attach-comments/block-trailing-comment.ast.js +++ b/tests/fixtures/attach-comments/block-trailing-comment.result.js @@ -128,4 +128,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/tests/fixtures/attach-comments/surrounding-call-comments.ast.js b/tests/fixtures/attach-comments/surrounding-call-comments.result.js similarity index 99% rename from tests/fixtures/attach-comments/surrounding-call-comments.ast.js rename to tests/fixtures/attach-comments/surrounding-call-comments.result.js index 5cc7c710..b3eff0a9 100644 --- a/tests/fixtures/attach-comments/surrounding-call-comments.ast.js +++ b/tests/fixtures/attach-comments/surrounding-call-comments.result.js @@ -206,4 +206,4 @@ module.exports = { } } ] -} +}; \ No newline at end of file diff --git a/tests/fixtures/attach-comments/surrounding-debugger-comments.ast.js b/tests/fixtures/attach-comments/surrounding-debugger-comments.result.js similarity index 99% rename from tests/fixtures/attach-comments/surrounding-debugger-comments.ast.js rename to tests/fixtures/attach-comments/surrounding-debugger-comments.result.js index d94a6bb7..8cd51c13 100644 --- a/tests/fixtures/attach-comments/surrounding-debugger-comments.ast.js +++ b/tests/fixtures/attach-comments/surrounding-debugger-comments.result.js @@ -170,4 +170,4 @@ module.exports = { } } ] -} +}; \ No newline at end of file diff --git a/tests/fixtures/attach-comments/surrounding-return-comments.ast.js b/tests/fixtures/attach-comments/surrounding-return-comments.result.js similarity index 99% rename from tests/fixtures/attach-comments/surrounding-return-comments.ast.js rename to tests/fixtures/attach-comments/surrounding-return-comments.result.js index ac90383b..cbe803e6 100644 --- a/tests/fixtures/attach-comments/surrounding-return-comments.ast.js +++ b/tests/fixtures/attach-comments/surrounding-return-comments.result.js @@ -171,4 +171,4 @@ module.exports = { } } ] -} +}; \ No newline at end of file diff --git a/tests/fixtures/attach-comments/surrounding-throw-comments.ast.js b/tests/fixtures/attach-comments/surrounding-throw-comments.result.js similarity index 99% rename from tests/fixtures/attach-comments/surrounding-throw-comments.ast.js rename to tests/fixtures/attach-comments/surrounding-throw-comments.result.js index b1560af0..3d7daafa 100644 --- a/tests/fixtures/attach-comments/surrounding-throw-comments.ast.js +++ b/tests/fixtures/attach-comments/surrounding-throw-comments.result.js @@ -189,4 +189,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/tests/fixtures/attach-comments/surrounding-while-loop-comments.ast.js b/tests/fixtures/attach-comments/surrounding-while-loop-comments.ast.js deleted file mode 100644 index 2d1e7bca..00000000 --- a/tests/fixtures/attach-comments/surrounding-while-loop-comments.ast.js +++ /dev/null @@ -1,286 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "f", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "params": [], - "defaults": [], - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 37, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 43, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - "range": [ - 30, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": " infinite ", - "range": [ - 15, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - } - } - ], - "trailingComments": [ - { - "type": "Block", - "value": " bar ", - "range": [ - 47, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 56 - } - } - } - ] - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "each", - "range": [ - 61, - 65 - ], - "loc": { - "start": { - "line": 1, - "column": 61 - }, - "end": { - "line": 1, - "column": 65 - } - } - }, - "init": null, - "range": [ - 61, - 65 - ], - "loc": { - "start": { - "line": 1, - "column": 61 - }, - "end": { - "line": 1, - "column": 65 - } - } - } - ], - "kind": "var", - "range": [ - 57, - 66 - ], - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 66 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": " bar ", - "range": [ - 47, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 56 - } - } - } - ] - } - ], - "range": [ - 13, - 68 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 68 - } - } - }, - "rest": null, - "generator": false, - "expression": false, - "range": [ - 0, - 68 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 68 - } - } - } - ], - "range": [ - 0, - 68 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 68 - } - }, - "comments": [ - { - "type": "Block", - "value": " infinite ", - "range": [ - 15, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Block", - "value": " bar ", - "range": [ - 47, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 56 - } - } - } - ] - }; diff --git a/tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js b/tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js new file mode 100644 index 00000000..ab166732 --- /dev/null +++ b/tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js @@ -0,0 +1,286 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "params": [], + "defaults": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 37, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 43, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 30, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": " infinite ", + "range": [ + 15, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": " bar ", + "range": [ + 47, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 56 + } + } + } + ] + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "each", + "range": [ + 61, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 65 + } + } + }, + "init": null, + "range": [ + 61, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 65 + } + } + } + ], + "kind": "var", + "range": [ + 57, + 66 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 66 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": " bar ", + "range": [ + 47, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 56 + } + } + } + ] + } + ], + "range": [ + 13, + 68 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 68 + } + } + }, + "rest": null, + "generator": false, + "expression": false, + "range": [ + 0, + 68 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 68 + } + } + } + ], + "range": [ + 0, + 68 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 68 + } + }, + "comments": [ + { + "type": "Block", + "value": " infinite ", + "range": [ + 15, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Block", + "value": " bar ", + "range": [ + 47, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 56 + } + } + } + ] +}; \ No newline at end of file diff --git a/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.ast.js b/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.result.js similarity index 99% rename from tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.ast.js rename to tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.result.js index 511fbba8..5aa27e5e 100644 --- a/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.ast.js +++ b/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.result.js @@ -357,4 +357,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/tests/fixtures/attach-comments/switch-fallthrough-comment.ast.js b/tests/fixtures/attach-comments/switch-fallthrough-comment.result.js similarity index 99% rename from tests/fixtures/attach-comments/switch-fallthrough-comment.ast.js rename to tests/fixtures/attach-comments/switch-fallthrough-comment.result.js index d292c8e8..d60d92eb 100644 --- a/tests/fixtures/attach-comments/switch-fallthrough-comment.ast.js +++ b/tests/fixtures/attach-comments/switch-fallthrough-comment.result.js @@ -279,4 +279,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/tests/fixtures/attach-comments/switch-no-default-comment-in-function.ast.js b/tests/fixtures/attach-comments/switch-no-default-comment-in-function.result.js similarity index 99% rename from tests/fixtures/attach-comments/switch-no-default-comment-in-function.ast.js rename to tests/fixtures/attach-comments/switch-no-default-comment-in-function.result.js index 4dfb7479..ef35c888 100644 --- a/tests/fixtures/attach-comments/switch-no-default-comment-in-function.ast.js +++ b/tests/fixtures/attach-comments/switch-no-default-comment-in-function.result.js @@ -283,4 +283,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.ast.js b/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.result.js similarity index 99% rename from tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.ast.js rename to tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.result.js index 536f39c5..81c5c0cf 100644 --- a/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.ast.js +++ b/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.result.js @@ -704,4 +704,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/tests/fixtures/attach-comments/switch-no-default-comment.ast.js b/tests/fixtures/attach-comments/switch-no-default-comment.result.js similarity index 99% rename from tests/fixtures/attach-comments/switch-no-default-comment.ast.js rename to tests/fixtures/attach-comments/switch-no-default-comment.result.js index 66c76668..f22f497c 100644 --- a/tests/fixtures/attach-comments/switch-no-default-comment.ast.js +++ b/tests/fixtures/attach-comments/switch-no-default-comment.result.js @@ -149,4 +149,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.result.js b/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.result.js index 2bc0d9a4..11ee13e2 100644 --- a/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.result.js +++ b/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.result.js @@ -160,4 +160,4 @@ module.exports = { "column": 18 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.result.js b/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.result.js index 2bc0d9a4..11ee13e2 100644 --- a/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.result.js +++ b/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.result.js @@ -160,4 +160,4 @@ module.exports = { "column": 18 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.config.js b/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.config.js new file mode 100644 index 00000000..5555feec --- /dev/null +++ b/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.config.js @@ -0,0 +1,4 @@ +module.exports = { + objectLiteralShorthandMethods: true, + generators: true +}; diff --git a/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.result.js b/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.result.js new file mode 100644 index 00000000..1bd234d2 --- /dev/null +++ b/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.result.js @@ -0,0 +1,227 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "test", + "range": [ + 11, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "defaults": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "YieldExpression", + "argument": { + "type": "Identifier", + "name": "v", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "delegate": true, + "range": [ + 21, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 21, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "rest": null, + "generator": true, + "expression": false, + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "kind": "init", + "method": true, + "shorthand": false, + "computed": false, + "range": [ + 10, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 8, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "range": [ + 4, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.src.js b/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.src.js new file mode 100644 index 00000000..1ae2612b --- /dev/null +++ b/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.src.js @@ -0,0 +1 @@ +var x = { *test () { yield *v } }; \ No newline at end of file diff --git a/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.result.js b/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.result.js index 9f619cd8..77bac083 100644 --- a/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.result.js +++ b/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.result.js @@ -206,4 +206,4 @@ module.exports = { "column": 2 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/binaryLiterals/invalid.result.js b/tests/fixtures/ecma-features/binaryLiterals/invalid.result.js index 7f25f2f2..6081eafe 100644 --- a/tests/fixtures/ecma-features/binaryLiterals/invalid.result.js +++ b/tests/fixtures/ecma-features/binaryLiterals/invalid.result.js @@ -1,7 +1,6 @@ module.exports = { - index: 4, - lineNumber: 1, - column: 5, - message: "Error: Line 1: Unexpected token ILLEGAL", - description: "Unexpected token ILLEGAL" -}; + "index": 4, + "lineNumber": 1, + "column": 5, + "description": "Unexpected token ILLEGAL" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/binaryLiterals/lowercase.result.js b/tests/fixtures/ecma-features/binaryLiterals/lowercase.result.js index 74886a1a..e817f468 100644 --- a/tests/fixtures/ecma-features/binaryLiterals/lowercase.result.js +++ b/tests/fixtures/ecma-features/binaryLiterals/lowercase.result.js @@ -52,4 +52,4 @@ module.exports = { "column": 6 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/binaryLiterals/uppercase.result.js b/tests/fixtures/ecma-features/binaryLiterals/uppercase.result.js index 62b05527..bc5bca07 100644 --- a/tests/fixtures/ecma-features/binaryLiterals/uppercase.result.js +++ b/tests/fixtures/ecma-features/binaryLiterals/uppercase.result.js @@ -52,4 +52,4 @@ module.exports = { "column": 6 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/blockBindings/const.result.js b/tests/fixtures/ecma-features/blockBindings/const.result.js index 124275d3..b78161e8 100644 --- a/tests/fixtures/ecma-features/blockBindings/const.result.js +++ b/tests/fixtures/ecma-features/blockBindings/const.result.js @@ -1,55 +1,14 @@ -// const foo = bar; module.exports = { - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, "type": "Program", "body": [ { - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, "type": "VariableDeclaration", "declarations": [ { - "range": [ - 6, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, "type": "VariableDeclarator", "id": { + "type": "Identifier", + "name": "foo", "range": [ 6, 9 @@ -63,11 +22,11 @@ module.exports = { "line": 1, "column": 9 } - }, - "type": "Identifier", - "name": "foo" + } }, "init": { + "type": "Identifier", + "name": "bar", "range": [ 12, 15 @@ -81,13 +40,53 @@ module.exports = { "line": 1, "column": 15 } + } + }, + "range": [ + 6, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 6 }, - "type": "Identifier", - "name": "bar" + "end": { + "line": 1, + "column": 15 + } } } ], - "kind": "const" + "kind": "const", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 } - ] -}; + } +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/blockBindings/let.result.js b/tests/fixtures/ecma-features/blockBindings/let.result.js index 32fb6fcc..969000f6 100644 --- a/tests/fixtures/ecma-features/blockBindings/let.result.js +++ b/tests/fixtures/ecma-features/blockBindings/let.result.js @@ -1,4 +1,3 @@ -// let foo = bar; module.exports = { "type": "Program", "body": [ @@ -90,4 +89,4 @@ module.exports = { "column": 14 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.result.js b/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.result.js index e26fa6f3..2a077075 100644 --- a/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.result.js +++ b/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.result.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = { "type": "Program", "body": [ { @@ -292,4 +292,4 @@ module.exports = { "column": 64 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/forOf/for-of-with-var-and-braces.result.js b/tests/fixtures/ecma-features/forOf/for-of-with-var-and-braces.result.js index 7fd2d38e..82ad9bd4 100644 --- a/tests/fixtures/ecma-features/forOf/for-of-with-var-and-braces.result.js +++ b/tests/fixtures/ecma-features/forOf/for-of-with-var-and-braces.result.js @@ -179,4 +179,4 @@ module.exports = { "column": 1 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/forOf/for-of-with-var-and-no-braces.result.js b/tests/fixtures/ecma-features/forOf/for-of-with-var-and-no-braces.result.js index ebeb8dfb..c8d9a616 100644 --- a/tests/fixtures/ecma-features/forOf/for-of-with-var-and-no-braces.result.js +++ b/tests/fixtures/ecma-features/forOf/for-of-with-var-and-no-braces.result.js @@ -160,4 +160,4 @@ module.exports = { "column": 18 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/forOf/invalid-for-of-with-const-and-no-braces.result.js b/tests/fixtures/ecma-features/forOf/invalid-for-of-with-const-and-no-braces.result.js index 647d7494..a1bd3d3c 100644 --- a/tests/fixtures/ecma-features/forOf/invalid-for-of-with-const-and-no-braces.result.js +++ b/tests/fixtures/ecma-features/forOf/invalid-for-of-with-const-and-no-braces.result.js @@ -1,7 +1,6 @@ module.exports = { - index: 5, - lineNumber: 1, - column: 6, - message: "Error: Line 1: Unexpected token const", - description: "Unexpected token const" -}; + "index": 5, + "lineNumber": 1, + "column": 6, + "description": "Unexpected token const" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/forOf/invalid-for-of-with-let-and-no-braces.result.js b/tests/fixtures/ecma-features/forOf/invalid-for-of-with-let-and-no-braces.result.js index 0ef65ede..ab022d0f 100644 --- a/tests/fixtures/ecma-features/forOf/invalid-for-of-with-let-and-no-braces.result.js +++ b/tests/fixtures/ecma-features/forOf/invalid-for-of-with-let-and-no-braces.result.js @@ -1,7 +1,6 @@ module.exports = { - index: 5, - lineNumber: 1, - column: 6, - message: "Error: Line 1: Unexpected token let", - description: "Unexpected token let" -}; + "index": 5, + "lineNumber": 1, + "column": 6, + "description": "Unexpected token let" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/generators/anonymous-generator.result.js b/tests/fixtures/ecma-features/generators/anonymous-generator.result.js new file mode 100644 index 00000000..1ea84063 --- /dev/null +++ b/tests/fixtures/ecma-features/generators/anonymous-generator.result.js @@ -0,0 +1,131 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + "defaults": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "YieldExpression", + "argument": { + "type": "Identifier", + "name": "v", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "delegate": false, + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 16, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 14, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "rest": null, + "generator": true, + "expression": false, + "range": [ + 1, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/ecma-features/generators/anonymous-generator.src.js b/tests/fixtures/ecma-features/generators/anonymous-generator.src.js new file mode 100644 index 00000000..e582946f --- /dev/null +++ b/tests/fixtures/ecma-features/generators/anonymous-generator.src.js @@ -0,0 +1 @@ +(function* () { yield v }); \ No newline at end of file diff --git a/tests/fixtures/ecma-features/generators/double-yield.result.js b/tests/fixtures/ecma-features/generators/double-yield.result.js new file mode 100644 index 00000000..faa6c624 --- /dev/null +++ b/tests/fixtures/ecma-features/generators/double-yield.result.js @@ -0,0 +1,150 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + "defaults": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "YieldExpression", + "argument": { + "type": "YieldExpression", + "argument": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 28, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "delegate": false, + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "delegate": false, + "range": [ + 16, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 16, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 14, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "rest": null, + "generator": true, + "expression": false, + "range": [ + 1, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/ecma-features/generators/double-yield.src.js b/tests/fixtures/ecma-features/generators/double-yield.src.js new file mode 100644 index 00000000..e026a337 --- /dev/null +++ b/tests/fixtures/ecma-features/generators/double-yield.src.js @@ -0,0 +1 @@ +(function* () { yield yield 10 }); \ No newline at end of file diff --git a/tests/fixtures/ecma-features/generators/empty-generator-declaration.result.js b/tests/fixtures/ecma-features/generators/empty-generator-declaration.result.js new file mode 100644 index 00000000..caf6bb88 --- /dev/null +++ b/tests/fixtures/ecma-features/generators/empty-generator-declaration.result.js @@ -0,0 +1,94 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "t", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "params": [], + "defaults": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "rest": null, + "generator": true, + "expression": false, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/ecma-features/generators/empty-generator-declaration.src.js b/tests/fixtures/ecma-features/generators/empty-generator-declaration.src.js new file mode 100644 index 00000000..66993554 --- /dev/null +++ b/tests/fixtures/ecma-features/generators/empty-generator-declaration.src.js @@ -0,0 +1 @@ +function* t() {}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/generators/generator-declaration.result.js b/tests/fixtures/ecma-features/generators/generator-declaration.result.js new file mode 100644 index 00000000..050795b3 --- /dev/null +++ b/tests/fixtures/ecma-features/generators/generator-declaration.result.js @@ -0,0 +1,148 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "test", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "params": [], + "defaults": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "YieldExpression", + "argument": { + "type": "Identifier", + "name": "v", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "delegate": true, + "range": [ + 20, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 20, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 18, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "rest": null, + "generator": true, + "expression": false, + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/ecma-features/generators/generator-declaration.src.js b/tests/fixtures/ecma-features/generators/generator-declaration.src.js new file mode 100644 index 00000000..3690a574 --- /dev/null +++ b/tests/fixtures/ecma-features/generators/generator-declaration.src.js @@ -0,0 +1 @@ +function* test () { yield *v }; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/generators/yield-delegation.result.js b/tests/fixtures/ecma-features/generators/yield-delegation.result.js new file mode 100644 index 00000000..59a5b926 --- /dev/null +++ b/tests/fixtures/ecma-features/generators/yield-delegation.result.js @@ -0,0 +1,131 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + "defaults": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "YieldExpression", + "argument": { + "type": "Identifier", + "name": "v", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "delegate": true, + "range": [ + 16, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 16, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 14, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "rest": null, + "generator": true, + "expression": false, + "range": [ + 1, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/ecma-features/generators/yield-delegation.src.js b/tests/fixtures/ecma-features/generators/yield-delegation.src.js new file mode 100644 index 00000000..fc14d64d --- /dev/null +++ b/tests/fixtures/ecma-features/generators/yield-delegation.src.js @@ -0,0 +1 @@ +(function* () { yield *v }); \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/embedded-comment.result.js b/tests/fixtures/ecma-features/jsx/embedded-comment.result.js index 09b187df..91e0b1ed 100644 --- a/tests/fixtures/ecma-features/jsx/embedded-comment.result.js +++ b/tests/fixtures/ecma-features/jsx/embedded-comment.result.js @@ -158,4 +158,4 @@ module.exports = { "column": 33 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/embedded-conditional.result.js b/tests/fixtures/ecma-features/jsx/embedded-conditional.result.js index 14b47c84..95bf645a 100644 --- a/tests/fixtures/ecma-features/jsx/embedded-conditional.result.js +++ b/tests/fixtures/ecma-features/jsx/embedded-conditional.result.js @@ -289,4 +289,4 @@ module.exports = { "column": 28 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/embedded-invalid-js-identifier.result.js b/tests/fixtures/ecma-features/jsx/embedded-invalid-js-identifier.result.js index 0db4be7d..d6c09c4d 100644 --- a/tests/fixtures/ecma-features/jsx/embedded-invalid-js-identifier.result.js +++ b/tests/fixtures/ecma-features/jsx/embedded-invalid-js-identifier.result.js @@ -199,4 +199,4 @@ module.exports = { "column": 42 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/embedded-tags.result.js b/tests/fixtures/ecma-features/jsx/embedded-tags.result.js index 72f9307b..07a66d83 100644 --- a/tests/fixtures/ecma-features/jsx/embedded-tags.result.js +++ b/tests/fixtures/ecma-features/jsx/embedded-tags.result.js @@ -326,4 +326,4 @@ module.exports = { "column": 58 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/empty-placeholder.result.js b/tests/fixtures/ecma-features/jsx/empty-placeholder.result.js index 0cd02492..939019bc 100644 --- a/tests/fixtures/ecma-features/jsx/empty-placeholder.result.js +++ b/tests/fixtures/ecma-features/jsx/empty-placeholder.result.js @@ -158,4 +158,4 @@ module.exports = { "column": 10 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/escape-patterns.result.js b/tests/fixtures/ecma-features/jsx/escape-patterns.result.js index d74eac4e..c6b8a059 100644 --- a/tests/fixtures/ecma-features/jsx/escape-patterns.result.js +++ b/tests/fixtures/ecma-features/jsx/escape-patterns.result.js @@ -485,4 +485,4 @@ module.exports = { "column": 84 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-attribute-missing-equals.result.js b/tests/fixtures/ecma-features/jsx/invalid-attribute-missing-equals.result.js index 63a6c8bd..3aab0c3b 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-attribute-missing-equals.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-attribute-missing-equals.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 15, "description": "Unexpected string" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-attribute.result.js b/tests/fixtures/ecma-features/jsx/invalid-attribute.result.js index 2d934f95..9fa90329 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-attribute.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-attribute.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 6, "description": "JSX value should be either an expression or a quoted JSX text" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-broken-tag.result.js b/tests/fixtures/ecma-features/jsx/invalid-broken-tag.result.js index f1dfaa96..aa67b515 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-broken-tag.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-broken-tag.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 13, "description": "Unexpected token ILLEGAL" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-computed-end-tag-name.result.js b/tests/fixtures/ecma-features/jsx/invalid-computed-end-tag-name.result.js index 0fa770f1..1cdeca51 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-computed-end-tag-name.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-computed-end-tag-name.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 3, "description": "Unexpected token [" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-computed-string-end-tag-name.result.js b/tests/fixtures/ecma-features/jsx/invalid-computed-string-end-tag-name.result.js index 0fa770f1..1cdeca51 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-computed-string-end-tag-name.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-computed-string-end-tag-name.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 3, "description": "Unexpected token [" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-embedded-expression.result.js b/tests/fixtures/ecma-features/jsx/invalid-embedded-expression.result.js index 9f4b2711..d6de4409 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-embedded-expression.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-embedded-expression.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 10, "description": "Unexpected token ;" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-leading-dot-tag-name.result.js b/tests/fixtures/ecma-features/jsx/invalid-leading-dot-tag-name.result.js index ed399012..23684cf6 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-leading-dot-tag-name.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-leading-dot-tag-name.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 2, "description": "Unexpected token ." -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-matching-placeholder-in-closing-tag.result.js b/tests/fixtures/ecma-features/jsx/invalid-matching-placeholder-in-closing-tag.result.js index cacdfdc7..2d1ad8ac 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-matching-placeholder-in-closing-tag.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-matching-placeholder-in-closing-tag.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 28, "description": "Unexpected token {" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tag.result.js b/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tag.result.js index cd33903a..0bb31198 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tag.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tag.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 8, "description": "Expected corresponding JSX closing tag for a" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tags.result.js b/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tags.result.js index 1c41e8bf..1f2fa3d7 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tags.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tags.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 10, "description": "Unexpected end of input" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-mismatched-dot-tag-name.result.js b/tests/fixtures/ecma-features/jsx/invalid-mismatched-dot-tag-name.result.js index 7d76553e..bd56fd9a 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-mismatched-dot-tag-name.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-mismatched-dot-tag-name.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 12, "description": "Expected corresponding JSX closing tag for a.b.c" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-mismatched-namespace-tag.result.js b/tests/fixtures/ecma-features/jsx/invalid-mismatched-namespace-tag.result.js index 90504981..c83000de 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-mismatched-namespace-tag.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-mismatched-namespace-tag.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 10, "description": "Expected corresponding JSX closing tag for a:b" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag-attribute-placeholder.result.js b/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag-attribute-placeholder.result.js index e1e367cd..6e46a62a 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag-attribute-placeholder.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag-attribute-placeholder.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 8, "description": "JSX attributes must only be assigned a non-empty expression" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag.result.js b/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag.result.js index 10518c26..c8d6b0e3 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 5, "description": "Unexpected end of input" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-name.result.js b/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-name.result.js index 467f7c63..da4c7bb8 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-name.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-name.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 2, "description": "Unexpected token :" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-value.result.js b/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-value.result.js index 1413566f..8f49499f 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-value.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-value.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 5, "description": "Unexpected token /" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-missing-spread-operator.result.js b/tests/fixtures/ecma-features/jsx/invalid-missing-spread-operator.result.js index 311010c8..437a2c61 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-missing-spread-operator.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-missing-spread-operator.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 7, "description": "Unexpected identifier" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-namespace-name-with-docts.result.js b/tests/fixtures/ecma-features/jsx/invalid-namespace-name-with-docts.result.js index a7a11f47..6013cda4 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-namespace-name-with-docts.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-namespace-name-with-docts.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 5, "description": "Unexpected token :" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-namespace-value-with-dots.result.js b/tests/fixtures/ecma-features/jsx/invalid-namespace-value-with-dots.result.js index 48465fe8..63f4cb77 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-namespace-value-with-dots.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-namespace-value-with-dots.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 5, "description": "Unexpected token ." -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-no-common-parent-with-comment.result.js b/tests/fixtures/ecma-features/jsx/invalid-no-common-parent-with-comment.result.js index 097328d4..625b1e91 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-no-common-parent-with-comment.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-no-common-parent-with-comment.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 50, "description": "Adjacent JSX elements must be wrapped in an enclosing tag" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-no-common-parent.result.js b/tests/fixtures/ecma-features/jsx/invalid-no-common-parent.result.js index e80fb932..44bc3ebb 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-no-common-parent.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-no-common-parent.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 23, "description": "Adjacent JSX elements must be wrapped in an enclosing tag" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-no-tag-name.result.js b/tests/fixtures/ecma-features/jsx/invalid-no-tag-name.result.js index a1f49aa0..4b63e089 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-no-tag-name.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-no-tag-name.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 2, "description": "Unexpected token /" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-placeholder-in-closing-tag.result.js b/tests/fixtures/ecma-features/jsx/invalid-placeholder-in-closing-tag.result.js index a9997afb..cf509b4f 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-placeholder-in-closing-tag.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-placeholder-in-closing-tag.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 17, "description": "Unexpected token {" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-trailing-dot-tag-name.result.js b/tests/fixtures/ecma-features/jsx/invalid-trailing-dot-tag-name.result.js index 9dc9e8a9..c5d79c06 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-trailing-dot-tag-name.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-trailing-dot-tag-name.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 4, "description": "Unexpected token >" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/invalid-unexpected-comma.result.js b/tests/fixtures/ecma-features/jsx/invalid-unexpected-comma.result.js index 50917ef4..84fc704b 100644 --- a/tests/fixtures/ecma-features/jsx/invalid-unexpected-comma.result.js +++ b/tests/fixtures/ecma-features/jsx/invalid-unexpected-comma.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 20, "description": "Unexpected token ," -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/japanese-characters.result.js b/tests/fixtures/ecma-features/jsx/japanese-characters.result.js index 45743842..de7dc331 100644 --- a/tests/fixtures/ecma-features/jsx/japanese-characters.result.js +++ b/tests/fixtures/ecma-features/jsx/japanese-characters.result.js @@ -123,4 +123,4 @@ module.exports = { "column": 12 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/less-than-operator.result.js b/tests/fixtures/ecma-features/jsx/less-than-operator.result.js index 33cf0970..aebf3d0e 100644 --- a/tests/fixtures/ecma-features/jsx/less-than-operator.result.js +++ b/tests/fixtures/ecma-features/jsx/less-than-operator.result.js @@ -125,4 +125,4 @@ module.exports = { "column": 14 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/multiple-blank-spaces.result.js b/tests/fixtures/ecma-features/jsx/multiple-blank-spaces.result.js index 18387e0d..058f59b0 100644 --- a/tests/fixtures/ecma-features/jsx/multiple-blank-spaces.result.js +++ b/tests/fixtures/ecma-features/jsx/multiple-blank-spaces.result.js @@ -143,4 +143,4 @@ module.exports = { "column": 12 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/namespaced-attribute-and-value-inserted.result.js b/tests/fixtures/ecma-features/jsx/namespaced-attribute-and-value-inserted.result.js index a9e91f12..15b30c39 100644 --- a/tests/fixtures/ecma-features/jsx/namespaced-attribute-and-value-inserted.result.js +++ b/tests/fixtures/ecma-features/jsx/namespaced-attribute-and-value-inserted.result.js @@ -434,4 +434,4 @@ module.exports = { "column": 41 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/namespaced-name-and-attribute.result.js b/tests/fixtures/ecma-features/jsx/namespaced-name-and-attribute.result.js index a13b1162..278af273 100644 --- a/tests/fixtures/ecma-features/jsx/namespaced-name-and-attribute.result.js +++ b/tests/fixtures/ecma-features/jsx/namespaced-name-and-attribute.result.js @@ -196,4 +196,4 @@ module.exports = { "column": 12 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/newslines-and-entities.result.js b/tests/fixtures/ecma-features/jsx/newslines-and-entities.result.js index acafd17b..defe6a93 100644 --- a/tests/fixtures/ecma-features/jsx/newslines-and-entities.result.js +++ b/tests/fixtures/ecma-features/jsx/newslines-and-entities.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 10, "description": "Unexpected token ILLEGAL" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/self-closing-tag-with-newline.result.js b/tests/fixtures/ecma-features/jsx/self-closing-tag-with-newline.result.js index f4e4f69f..6501f8ae 100644 --- a/tests/fixtures/ecma-features/jsx/self-closing-tag-with-newline.result.js +++ b/tests/fixtures/ecma-features/jsx/self-closing-tag-with-newline.result.js @@ -3,4 +3,4 @@ module.exports = { "lineNumber": 1, "column": 4, "description": "Unexpected token ILLEGAL" -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/self-closing-tag.result.js b/tests/fixtures/ecma-features/jsx/self-closing-tag.result.js index 2f31d452..a8c1007e 100644 --- a/tests/fixtures/ecma-features/jsx/self-closing-tag.result.js +++ b/tests/fixtures/ecma-features/jsx/self-closing-tag.result.js @@ -89,4 +89,4 @@ module.exports = { "column": 6 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/spread-operator-attribute-and-regular-attribute.result.js b/tests/fixtures/ecma-features/jsx/spread-operator-attribute-and-regular-attribute.result.js index 7a694378..536f215e 100644 --- a/tests/fixtures/ecma-features/jsx/spread-operator-attribute-and-regular-attribute.result.js +++ b/tests/fixtures/ecma-features/jsx/spread-operator-attribute-and-regular-attribute.result.js @@ -179,4 +179,4 @@ module.exports = { "column": 36 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/spread-operator-attributes.result.js b/tests/fixtures/ecma-features/jsx/spread-operator-attributes.result.js index b0ef67dc..959a785e 100644 --- a/tests/fixtures/ecma-features/jsx/spread-operator-attributes.result.js +++ b/tests/fixtures/ecma-features/jsx/spread-operator-attributes.result.js @@ -125,4 +125,4 @@ module.exports = { "column": 19 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/tag-names-with-dots.result.js b/tests/fixtures/ecma-features/jsx/tag-names-with-dots.result.js index b4126870..02ba9ff0 100644 --- a/tests/fixtures/ecma-features/jsx/tag-names-with-dots.result.js +++ b/tests/fixtures/ecma-features/jsx/tag-names-with-dots.result.js @@ -193,4 +193,4 @@ module.exports = { "column": 12 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/tag-names-with-multi-dots.result.js b/tests/fixtures/ecma-features/jsx/tag-names-with-multi-dots.result.js index b91b8b7b..33aa8f82 100644 --- a/tests/fixtures/ecma-features/jsx/tag-names-with-multi-dots.result.js +++ b/tests/fixtures/ecma-features/jsx/tag-names-with-multi-dots.result.js @@ -263,4 +263,4 @@ module.exports = { "column": 16 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/test-content.result.js b/tests/fixtures/ecma-features/jsx/test-content.result.js index 5e1a8f70..ddb61adc 100644 --- a/tests/fixtures/ecma-features/jsx/test-content.result.js +++ b/tests/fixtures/ecma-features/jsx/test-content.result.js @@ -143,4 +143,4 @@ module.exports = { "column": 25 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/trailing-spread-operator-attribute.result.js b/tests/fixtures/ecma-features/jsx/trailing-spread-operator-attribute.result.js index 1a00e9da..f6894730 100644 --- a/tests/fixtures/ecma-features/jsx/trailing-spread-operator-attribute.result.js +++ b/tests/fixtures/ecma-features/jsx/trailing-spread-operator-attribute.result.js @@ -267,4 +267,4 @@ module.exports = { "column": 54 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/jsx/unknown-escape-pattern.result.js b/tests/fixtures/ecma-features/jsx/unknown-escape-pattern.result.js index 4911efca..fba651ec 100644 --- a/tests/fixtures/ecma-features/jsx/unknown-escape-pattern.result.js +++ b/tests/fixtures/ecma-features/jsx/unknown-escape-pattern.result.js @@ -144,4 +144,4 @@ module.exports = { "column": 24 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-addition-property.result.js b/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-addition-property.result.js index 6b855984..63f55e35 100644 --- a/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-addition-property.result.js +++ b/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-addition-property.result.js @@ -185,4 +185,4 @@ module.exports = { "column": 2 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-and-identifier.result.js b/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-and-identifier.result.js index a0977527..1652f44c 100644 --- a/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-and-identifier.result.js +++ b/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-and-identifier.result.js @@ -168,4 +168,4 @@ module.exports = { "column": 19 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.result.js b/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.result.js index df801ad2..b520c8e3 100644 --- a/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.result.js +++ b/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.result.js @@ -231,4 +231,4 @@ module.exports = { "column": 32 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-string-property.result.js b/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-string-property.result.js index e121d8ca..602f714b 100644 --- a/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-string-property.result.js +++ b/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-string-property.result.js @@ -148,4 +148,4 @@ module.exports = { "column": 2 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-variable-property.result.js b/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-variable-property.result.js index 00a2c3ef..a68c49f8 100644 --- a/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-variable-property.result.js +++ b/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-variable-property.result.js @@ -147,4 +147,4 @@ module.exports = { "column": 2 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-computed-variable-property.result.js b/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-computed-variable-property.result.js index 20078c55..6199e79d 100644 --- a/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-computed-variable-property.result.js +++ b/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-computed-variable-property.result.js @@ -1,7 +1,6 @@ module.exports = { - index: 20, - lineNumber: 3, - column: 11, - message: "Error: Line 1: Unexpected token }", - description: "Unexpected token }" -}; + "index": 20, + "lineNumber": 3, + "column": 11, + "description": "Unexpected token }" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.result.js b/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.result.js index f5d36123..efa2268a 100644 --- a/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.result.js +++ b/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.result.js @@ -1,7 +1,6 @@ module.exports = { - index: 5, - lineNumber: 1, - column: 6, - message: "Error: Line 1: Unexpected token }", - description: "Unexpected token }" -}; + "index": 5, + "lineNumber": 1, + "column": 6, + "description": "Unexpected token }" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-addition.result.js b/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-addition.result.js index 034fde1a..fd31ffd8 100644 --- a/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-addition.result.js +++ b/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-addition.result.js @@ -148,4 +148,4 @@ module.exports = { "column": 20 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.result.js b/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.result.js index 26cdc031..03146caf 100644 --- a/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.result.js +++ b/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.result.js @@ -132,4 +132,4 @@ module.exports = { "column": 23 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression.result.js b/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression.result.js index 74a9dee6..1a882314 100644 --- a/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression.result.js +++ b/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression.result.js @@ -110,4 +110,4 @@ module.exports = { "column": 12 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralShorthandMethods/invalid-method-no-braces.result.js b/tests/fixtures/ecma-features/objectLiteralShorthandMethods/invalid-method-no-braces.result.js index f16b61ef..11d5ceb1 100644 --- a/tests/fixtures/ecma-features/objectLiteralShorthandMethods/invalid-method-no-braces.result.js +++ b/tests/fixtures/ecma-features/objectLiteralShorthandMethods/invalid-method-no-braces.result.js @@ -1,7 +1,6 @@ module.exports = { - index: 19, - lineNumber: 2, - column: 14, - message: "Error: Line 1: Unexpected number", - description: "Unexpected number" -}; + "index": 19, + "lineNumber": 2, + "column": 14, + "description": "Unexpected number" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.result.js b/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.result.js index 47efee1e..a8ab5b5e 100644 --- a/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.result.js +++ b/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.result.js @@ -206,4 +206,4 @@ module.exports = { "column": 2 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.result.js b/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.result.js index fdc7df5a..bac95333 100644 --- a/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.result.js +++ b/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.result.js @@ -185,4 +185,4 @@ module.exports = { "column": 3 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.result.js b/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.result.js index 21de75b4..fcaadb65 100644 --- a/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.result.js +++ b/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.result.js @@ -185,4 +185,4 @@ module.exports = { "column": 3 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.result.js b/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.result.js index e24fc585..48475946 100644 --- a/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.result.js +++ b/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.result.js @@ -204,4 +204,4 @@ module.exports = { "column": 3 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.result.js b/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.result.js index f4f6f10b..bf8b2fc9 100644 --- a/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.result.js +++ b/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.result.js @@ -186,4 +186,4 @@ module.exports = { "column": 3 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.result.js b/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.result.js index 672c677a..f204e108 100644 --- a/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.result.js +++ b/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.result.js @@ -185,4 +185,4 @@ module.exports = { "column": 3 } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.result.js b/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.result.js index 7995f76e..730e340d 100644 --- a/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.result.js +++ b/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.result.js @@ -207,4 +207,4 @@ module.exports = { "column": 2 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/objectLiteralShorthandProperties/shorthand-properties.result.js b/tests/fixtures/ecma-features/objectLiteralShorthandProperties/shorthand-properties.result.js index f5bdd908..03baa434 100644 --- a/tests/fixtures/ecma-features/objectLiteralShorthandProperties/shorthand-properties.result.js +++ b/tests/fixtures/ecma-features/objectLiteralShorthandProperties/shorthand-properties.result.js @@ -296,4 +296,4 @@ module.exports = { "column": 2 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/octalLiterals/invalid.result.js b/tests/fixtures/ecma-features/octalLiterals/invalid.result.js index 7f25f2f2..6081eafe 100644 --- a/tests/fixtures/ecma-features/octalLiterals/invalid.result.js +++ b/tests/fixtures/ecma-features/octalLiterals/invalid.result.js @@ -1,7 +1,6 @@ module.exports = { - index: 4, - lineNumber: 1, - column: 5, - message: "Error: Line 1: Unexpected token ILLEGAL", - description: "Unexpected token ILLEGAL" -}; + "index": 4, + "lineNumber": 1, + "column": 5, + "description": "Unexpected token ILLEGAL" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/octalLiterals/lowercase.result.js b/tests/fixtures/ecma-features/octalLiterals/lowercase.result.js index 742a6bf7..d391a5a8 100644 --- a/tests/fixtures/ecma-features/octalLiterals/lowercase.result.js +++ b/tests/fixtures/ecma-features/octalLiterals/lowercase.result.js @@ -52,4 +52,4 @@ module.exports = { "column": 6 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/octalLiterals/uppercase.result.js b/tests/fixtures/ecma-features/octalLiterals/uppercase.result.js index ac7fed1a..712b9b26 100644 --- a/tests/fixtures/ecma-features/octalLiterals/uppercase.result.js +++ b/tests/fixtures/ecma-features/octalLiterals/uppercase.result.js @@ -52,4 +52,4 @@ module.exports = { "column": 6 } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.result.js b/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.result.js index 159b452d..acaa1c07 100644 --- a/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.result.js +++ b/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.result.js @@ -1,49 +1,97 @@ -// var x = /[\u{0000000000000061}-\u{7A}]/u; module.exports = { - type: 'Program', - body: [{ - type: 'VariableDeclaration', - declarations: [{ - type: 'VariableDeclarator', - id: { - type: 'Identifier', - name: 'x', - range: [4, 5], - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 5 } + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": null, + "raw": "/[\\u{0000000000000061}-\\u{7A}]/u", + "regex": { + "pattern": "[\\u{0000000000000061}-\\u{7A}]", + "flags": "u" + }, + "range": [ + 8, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + "range": [ + 4, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 40 + } + } } - }, - init: { - type: 'Literal', - value: null, - raw: '/[\\u{0000000000000061}-\\u{7A}]/u', - regex: { - pattern: '[\\u{0000000000000061}-\\u{7A}]', - flags: 'u' + ], + "kind": "var", + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 }, - range: [8, 40], - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 40 } + "end": { + "line": 1, + "column": 41 } - }, - range: [4, 40], - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 40 } } - }], - kind: 'var', - range: [0, 41], - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 41 } } - }], - range: [0, 41], - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 41 } + ], + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } } -}; +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/regexUFlag/regex-u-invalid-extended-escape.result.js b/tests/fixtures/ecma-features/regexUFlag/regex-u-invalid-extended-escape.result.js index 5863fa69..92df24b5 100644 --- a/tests/fixtures/ecma-features/regexUFlag/regex-u-invalid-extended-escape.result.js +++ b/tests/fixtures/ecma-features/regexUFlag/regex-u-invalid-extended-escape.result.js @@ -1,7 +1,6 @@ module.exports = { - index: 21, - lineNumber: 1, - column: 22, - message: "Error: Line 1: Invalid regular expression", - description: "Invalid regular expression" -}; + "index": 21, + "lineNumber": 1, + "column": 22, + "description": "Invalid regular expression" +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.result.js b/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.result.js index 455c1e80..844717c2 100644 --- a/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.result.js +++ b/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.result.js @@ -1,55 +1,14 @@ -// var foo = /foo/u; module.exports = { - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, "type": "Program", "body": [ { - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, "type": "VariableDeclaration", "declarations": [ { - "range": [ - 4, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, "type": "VariableDeclarator", "id": { + "type": "Identifier", + "name": "foo", "range": [ 4, 7 @@ -63,11 +22,16 @@ module.exports = { "line": 1, "column": 7 } - }, - "type": "Identifier", - "name": "foo" + } }, "init": { + "type": "Literal", + "value": null, + "raw": "/foo/u", + "regex": { + "pattern": "foo", + "flags": "u" + }, "range": [ 10, 16 @@ -81,18 +45,53 @@ module.exports = { "line": 1, "column": 16 } + } + }, + "range": [ + 4, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 4 }, - "type": "Literal", - "value": null, - "regex": { - "pattern": "foo", - "flags": "u" - }, - "raw": "/foo/u" + "end": { + "line": 1, + "column": 16 + } } } ], - "kind": "var" + "kind": "var", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 } - ] -}; + } +}; \ No newline at end of file diff --git a/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.result.js b/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.result.js index 996f562d..54906b26 100644 --- a/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.result.js +++ b/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.result.js @@ -1,55 +1,14 @@ -// var foo = /foo/y; module.exports = { - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, "type": "Program", "body": [ { - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, "type": "VariableDeclaration", "declarations": [ { - "range": [ - 4, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, "type": "VariableDeclarator", "id": { + "type": "Identifier", + "name": "foo", "range": [ 4, 7 @@ -63,11 +22,16 @@ module.exports = { "line": 1, "column": 7 } - }, - "type": "Identifier", - "name": "foo" + } }, "init": { + "type": "Literal", + "value": null, + "raw": "/foo/y", + "regex": { + "pattern": "foo", + "flags": "y" + }, "range": [ 10, 16 @@ -81,18 +45,53 @@ module.exports = { "line": 1, "column": 16 } + } + }, + "range": [ + 4, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 4 }, - "type": "Literal", - "value": null, - "regex": { - "pattern": "foo", - "flags": "y" - }, - "raw": "/foo/y" + "end": { + "line": 1, + "column": 16 + } } } ], - "kind": "var" + "kind": "var", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 } - ] -}; + } +}; \ No newline at end of file diff --git a/tests/lib/attach-comments.js b/tests/lib/attach-comments.js index 90f1a521..eee2d69f 100644 --- a/tests/lib/attach-comments.js +++ b/tests/lib/attach-comments.js @@ -54,7 +54,7 @@ describe("attachComment: true", function() { leche.withData(testFiles, function(filename) { it("should produce correct AST when parsed with attachComments", function() { - var output = require(path.resolve(__dirname, "../../", filename + ".ast.js")); + var output = require(path.resolve(__dirname, "../../", filename + ".result.js")); var input = shelljs.cat(filename + ".src.js"); var result = espree.parse(input, { @@ -63,7 +63,7 @@ describe("attachComment: true", function() { attachComment: true }); - assert.deepEqual(result, output); + assert.deepEqual(result.body[0], output.body[0]); }); }); diff --git a/tools/create-test-example.js b/tools/create-test-example.js index 7c04c74f..e1d5d280 100644 --- a/tools/create-test-example.js +++ b/tools/create-test-example.js @@ -1,10 +1,2 @@ -/*!espree-section: spread-operator-attributes*/ -
-/*!espree-section: spread-operator-attribute-and-regular-attribute*/ -
-/*!espree-section: trailing-spread-operator-attribute*/ -
-/*!espree-section: invalid-placeholder-in-closing-tag*/ -
stuff
-/*!espree-section: invalid-matching-placeholder-in-closing-tag*/ -
stuff
+/*!espree-section: generator-object-literal-method*/ +var x = { *test () { yield *v } }; diff --git a/tools/update-tests.js b/tools/update-tests.js new file mode 100644 index 00000000..e22e7c26 --- /dev/null +++ b/tools/update-tests.js @@ -0,0 +1,128 @@ +/** + * @fileoverview A simple script to update existing tests to reflect new + * parser changes. + * @author Nicholas C. Zakas + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +/* + * Usage: + * node tools/update-tests.js + * + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var shelljs = require("shelljs"), + espree = require("../espree"), + path = require("path"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +function getExpectedResult(code, config) { + try { + return espree.parse(code, config); + } catch (ex) { + return ex; // if an error is thrown, match the error + } +} + +function getTestFilenames(directory) { + return shelljs.find(directory).filter(function(filename) { + return filename.indexOf(".src.js") > -1; + }).map(function(filename) { + return filename.substring(directory.length - 1, filename.length - 7); // strip off ".src.js" + }); +} + +function outputResult(result, testResultFilename) { + ("module.exports = " + JSON.stringify(result, null, " ") + ";").to(testResultFilename); +} + +//------------------------------------------------------------------------------ +// Setup +//------------------------------------------------------------------------------ + +var FIXTURES_DIR = "./tests/fixtures/ecma-features", + FIXTURES_MIX_DIR = "./tests/fixtures/ecma-features-mix", + COMMENTS_DIR = "./tests/fixtures/attach-comments"; + +var testFiles = getTestFilenames(FIXTURES_DIR), + mixFiles = getTestFilenames(FIXTURES_MIX_DIR), + commentFiles = getTestFilenames(COMMENTS_DIR); + + +commentFiles.forEach(function(filename) { + var testResultFilename = path.resolve(__dirname, "..", COMMENTS_DIR, filename) + ".result.js", + code = shelljs.cat(path.resolve(COMMENTS_DIR, filename) + ".src.js"), + result = getExpectedResult(code, { + loc: true, + range: true, + attachComment: true + }); + + outputResult(result, testResultFilename); +}); + +// update all tests in ecma-features +testFiles.forEach(function(filename) { + + var feature = path.dirname(filename), + code = shelljs.cat(path.resolve(FIXTURES_DIR, filename) + ".src.js"), + config = { + loc: true, + range: true, + ecmaFeatures: {} + }; + + config.ecmaFeatures[feature] = true; + var testResultFilename = path.resolve(__dirname, "..", FIXTURES_DIR, filename) + ".result.js"; + var result = getExpectedResult(code, config); + + outputResult(result, testResultFilename); +}); + +// update all tests in ecma-features-mix +mixFiles.forEach(function(filename) { + + var feature = path.dirname(filename), + code = shelljs.cat(path.resolve(FIXTURES_MIX_DIR, filename) + ".src.js"), + config = { + loc: true, + range: true, + ecmaFeatures: {} + }; + + config.ecmaFeatures = require(path.resolve(__dirname, "../", FIXTURES_MIX_DIR, filename) + ".config.js"); + + var testResultFilename = path.resolve(__dirname, "..", FIXTURES_MIX_DIR, filename) + ".result.js", + result = getExpectedResult(code, config); + + outputResult(result, testResultFilename); +});