diff --git a/packages/babel-core/test/fixtures/parse/output.json b/packages/babel-core/test/fixtures/parse/output.json index 42395528d1..00396f2c2e 100644 --- a/packages/babel-core/test/fixtures/parse/output.json +++ b/packages/babel-core/test/fixtures/parse/output.json @@ -57,7 +57,7 @@ "column": 11 } }, - "expression": { + "callee": { "type": "Identifier", "start": 1, "end": 11, diff --git a/packages/babel-generator/src/generators/expressions.js b/packages/babel-generator/src/generators/expressions.js index 2a7fc66e2e..8aa84f2f5e 100644 --- a/packages/babel-generator/src/generators/expressions.js +++ b/packages/babel-generator/src/generators/expressions.js @@ -91,7 +91,7 @@ export function Super() { export function Decorator(node: Object) { this.token("@"); - this.print(node.expression, node); + this.print(node.callee, node); this.newline(); } diff --git a/packages/babel-plugin-proposal-decorators/src/index.js b/packages/babel-plugin-proposal-decorators/src/index.js index fee3f43d6b..8a1efe87c5 100644 --- a/packages/babel-plugin-proposal-decorators/src/index.js +++ b/packages/babel-plugin-proposal-decorators/src/index.js @@ -44,18 +44,18 @@ export default declare(api => { ).reduce((acc, prop) => acc.concat(prop.node.decorators || []), []); const identDecorators = decorators.filter( - decorator => !t.isIdentifier(decorator.expression), + decorator => !t.isIdentifier(decorator.callee), ); if (identDecorators.length === 0) return; return t.sequenceExpression( identDecorators .map(decorator => { - const expression = decorator.expression; - const id = (decorator.expression = path.scope.generateDeclaredUidIdentifier( + const callee = decorator.callee; + const id = (decorator.callee = path.scope.generateDeclaredUidIdentifier( "dec", )); - return t.assignmentExpression("=", id, expression); + return t.assignmentExpression("=", id, callee); }) .concat([path.node]), ); @@ -74,7 +74,7 @@ export default declare(api => { const name = classPath.scope.generateDeclaredUidIdentifier("class"); return decorators - .map(dec => dec.expression) + .map(dec => dec.callee) .reverse() .reduce(function(acc, decorator) { return buildClassDecorator({ @@ -171,9 +171,7 @@ export default declare(api => { t.callExpression(state.addHelper("applyDecoratedDescriptor"), [ t.cloneNode(target), t.cloneNode(property), - t.arrayExpression( - decorators.map(dec => t.cloneNode(dec.expression)), - ), + t.arrayExpression(decorators.map(dec => t.cloneNode(dec.callee))), t.objectExpression([ t.objectProperty( t.identifier("enumerable"), @@ -189,9 +187,7 @@ export default declare(api => { t.callExpression(state.addHelper("applyDecoratedDescriptor"), [ t.cloneNode(target), t.cloneNode(property), - t.arrayExpression( - decorators.map(dec => t.cloneNode(dec.expression)), - ), + t.arrayExpression(decorators.map(dec => t.cloneNode(dec.callee))), t.isObjectProperty(node) || t.isClassProperty(node, { static: true }) ? buildGetObjectInitializer({ diff --git a/packages/babel-types/README.md b/packages/babel-types/README.md index 4ae433c26a..aeb03d9bb9 100644 --- a/packages/babel-types/README.md +++ b/packages/babel-types/README.md @@ -584,12 +584,13 @@ Aliases: `Flow`, `FlowPredicate` ### decorator ```javascript -t.decorator(expression) +t.decorator(callee, arguments) ``` See also `t.isDecorator(node, opts)` and `t.assertDecorator(node, opts)`. - - `expression`: `Expression` (required) + - `callee`: `Expression` (required) + - `arguments`: `Array` (default: `null`) --- diff --git a/packages/babel-types/src/definitions/experimental.js b/packages/babel-types/src/definitions/experimental.js index 7b22fa0a04..87d4cafcfa 100644 --- a/packages/babel-types/src/definitions/experimental.js +++ b/packages/babel-types/src/definitions/experimental.js @@ -135,11 +135,18 @@ defineType("Import", { }); defineType("Decorator", { - visitor: ["expression"], + visitor: ["callee", "arguments"], fields: { - expression: { + callee: { validate: assertNodeType("Expression"), }, + arguments: { + optional: true, + validate: chain( + assertValueType("array"), + assertEach(assertNodeType("Expression", "SpreadElement")), + ), + }, }, }); diff --git a/packages/babylon/src/parser/statement.js b/packages/babylon/src/parser/statement.js index 8919221897..175b0c7553 100644 --- a/packages/babylon/src/parser/statement.js +++ b/packages/babylon/src/parser/statement.js @@ -265,33 +265,37 @@ export default class StatementParser extends ExpressionParser { this.next(); if (this.hasPlugin("decorators2")) { - const startPos = this.state.start; - const startLoc = this.state.startLoc; - let expr = this.parseIdentifier(false); + // Every time a decorator class expression is evaluated, a new empty array is pushed onto the stack + // So that the decorators of any nested class expressions will be dealt with separately + this.state.decoratorStack.push([]); - while (this.eat(tt.dot)) { - const node = this.startNodeAt(startPos, startLoc); - node.object = expr; - node.property = this.parseIdentifier(true); - node.computed = false; - expr = this.finishNode(node, "MemberExpression"); + if (this.eat(tt.parenL)) { + node.callee = this.parseExpression(); + this.expect(tt.parenR); + } else { + const startPos = this.state.start; + const startLoc = this.state.startLoc; + let expr = this.parseIdentifier(false); + + while (this.eat(tt.dot)) { + const node = this.startNodeAt(startPos, startLoc); + node.object = expr; + node.property = this.parseIdentifier(true); + node.computed = false; + expr = this.finishNode(node, "MemberExpression"); + } + + node.callee = expr; } if (this.eat(tt.parenL)) { - const node = this.startNodeAt(startPos, startLoc); - node.callee = expr; - // Every time a decorator class expression is evaluated, a new empty array is pushed onto the stack - // So that the decorators of any nested class expressions will be dealt with separately - this.state.decoratorStack.push([]); node.arguments = this.parseCallExpressionArguments(tt.parenR, false); - this.state.decoratorStack.pop(); - expr = this.finishNode(node, "CallExpression"); - this.toReferencedList(expr.arguments); + this.toReferencedList(node.arguments); } - node.expression = expr; + this.state.decoratorStack.pop(); } else { - node.expression = this.parseMaybeAssign(); + node.callee = this.parseMaybeAssign(); } return this.finishNode(node, "Decorator"); } @@ -959,14 +963,13 @@ export default class StatementParser extends ExpressionParser { this.parseClassMember(classBody, member, state); if ( - this.hasPlugin("decorators2") && - ["method", "get", "set"].indexOf(member.kind) === -1 && + member.kind === "constructor" && member.decorators && member.decorators.length > 0 ) { this.raise( member.start, - "Stage 2 decorators may only be used with a class or a class method", + "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?", ); } } diff --git a/packages/babylon/src/types.js b/packages/babylon/src/types.js index 5368dcd6da..f6557ed942 100644 --- a/packages/babylon/src/types.js +++ b/packages/babylon/src/types.js @@ -336,6 +336,7 @@ export type VariableDeclarator = NodeBase & { export type Decorator = NodeBase & { type: "Decorator", expression: Expression, + arguments?: Array, }; export type Directive = NodeBase & { diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/class-decorator-call-expr/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/class-decorator-call-expr/output.json index 26d8fca5be..3da71c5551 100644 --- a/packages/babylon/test/fixtures/experimental/decorators-2/class-decorator-call-expr/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators-2/class-decorator-call-expr/output.json @@ -57,10 +57,10 @@ "column": 11 } }, - "expression": { - "type": "CallExpression", + "callee": { + "type": "Identifier", "start": 1, - "end": 11, + "end": 4, "loc": { "start": { "line": 1, @@ -68,49 +68,34 @@ }, "end": { "line": 1, - "column": 11 - } + "column": 4 + }, + "identifierName": "foo" }, - "callee": { - "type": "Identifier", - "start": 1, - "end": 4, + "name": "foo" + }, + "arguments": [ + { + "type": "StringLiteral", + "start": 5, + "end": 10, "loc": { "start": { "line": 1, - "column": 1 + "column": 5 }, "end": { "line": 1, - "column": 4 - }, - "identifierName": "foo" + "column": 10 + } }, - "name": "foo" - }, - "arguments": [ - { - "type": "StringLiteral", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "extra": { - "rawValue": "bar", - "raw": "'bar'" - }, - "value": "bar" - } - ] - } + "extra": { + "rawValue": "bar", + "raw": "'bar'" + }, + "value": "bar" + } + ] } ], "id": { diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/class-decorator/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/class-decorator/output.json index b0570136eb..176de43982 100644 --- a/packages/babylon/test/fixtures/experimental/decorators-2/class-decorator/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators-2/class-decorator/output.json @@ -57,7 +57,7 @@ "column": 4 } }, - "expression": { + "callee": { "type": "Identifier", "start": 1, "end": 4, diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/class-expression/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/class-expression/output.json index 72dc5339c8..aef537ea6a 100644 --- a/packages/babylon/test/fixtures/experimental/decorators-2/class-expression/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators-2/class-expression/output.json @@ -103,7 +103,7 @@ "column": 14 } }, - "expression": { + "callee": { "type": "Identifier", "start": 11, "end": 14, @@ -184,7 +184,7 @@ "column": 6 } }, - "expression": { + "callee": { "type": "Identifier", "start": 30, "end": 33, diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/class-generator/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/class-generator/output.json index 83bddbb347..109c1dc3a7 100644 --- a/packages/babylon/test/fixtures/experimental/decorators-2/class-generator/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators-2/class-generator/output.json @@ -104,7 +104,7 @@ "column": 6 } }, - "expression": { + "callee": { "type": "Identifier", "start": 13, "end": 16, diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/no-class-property/input.js b/packages/babylon/test/fixtures/experimental/decorators-2/class-property/input.js similarity index 100% rename from packages/babylon/test/fixtures/experimental/decorators-2/no-class-property/input.js rename to packages/babylon/test/fixtures/experimental/decorators-2/class-property/input.js diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/class-property/options.json b/packages/babylon/test/fixtures/experimental/decorators-2/class-property/options.json new file mode 100644 index 0000000000..9224c9db6e --- /dev/null +++ b/packages/babylon/test/fixtures/experimental/decorators-2/class-property/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties", "classPrivateProperties", "decorators2"] +} diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/class-property/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/class-property/output.json new file mode 100644 index 0000000000..efd269eaca --- /dev/null +++ b/packages/babylon/test/fixtures/experimental/decorators-2/class-property/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 12, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 12, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "callee": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "dec" + }, + "name": "dec" + } + } + ], + "static": false, + "key": { + "type": "Identifier", + "start": 17, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "name" + }, + "name": "name" + }, + "computed": false, + "value": { + "type": "NumericLiteral", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/complex-expr/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/complex-expr/output.json index d1e5d66b3a..9be8bc134d 100644 --- a/packages/babylon/test/fixtures/experimental/decorators-2/complex-expr/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators-2/complex-expr/output.json @@ -104,10 +104,10 @@ "column": 16 } }, - "expression": { - "type": "CallExpression", + "callee": { + "type": "MemberExpression", "start": 13, - "end": 26, + "end": 20, "loc": { "start": { "line": 2, @@ -115,13 +115,13 @@ }, "end": { "line": 2, - "column": 16 + "column": 10 } }, - "callee": { + "object": { "type": "MemberExpression", "start": 13, - "end": 20, + "end": 18, "loc": { "start": { "line": 2, @@ -129,13 +129,13 @@ }, "end": { "line": 2, - "column": 10 + "column": 8 } }, "object": { "type": "MemberExpression", "start": 13, - "end": 18, + "end": 16, "loc": { "start": { "line": 2, @@ -143,13 +143,13 @@ }, "end": { "line": 2, - "column": 8 + "column": 6 } }, "object": { - "type": "MemberExpression", + "type": "Identifier", "start": 13, - "end": 16, + "end": 14, "loc": { "start": { "line": 2, @@ -157,120 +157,105 @@ }, "end": { "line": 2, - "column": 6 - } - }, - "object": { - "type": "Identifier", - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 4 - }, - "identifierName": "a" + "column": 4 }, - "name": "a" + "identifierName": "a" }, - "property": { - "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - }, - "identifierName": "b" - }, - "name": "b" - }, - "computed": false + "name": "a" }, "property": { "type": "Identifier", - "start": 17, - "end": 18, + "start": 15, + "end": 16, "loc": { "start": { "line": 2, - "column": 7 + "column": 5 }, "end": { "line": 2, - "column": 8 + "column": 6 }, - "identifierName": "c" + "identifierName": "b" }, - "name": "c" + "name": "b" }, "computed": false }, "property": { "type": "Identifier", - "start": 19, - "end": 20, + "start": 17, + "end": 18, "loc": { "start": { "line": 2, - "column": 9 + "column": 7 }, "end": { "line": 2, - "column": 10 + "column": 8 }, - "identifierName": "d" + "identifierName": "c" }, - "name": "d" + "name": "c" }, "computed": false }, - "arguments": [ - { - "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "e" + "property": { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 9 }, - "name": "e" + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "d" }, - { - "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "f" + "name": "d" + }, + "computed": false + }, + "arguments": [ + { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 11 }, - "name": "f" - } - ] - } + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "e" + }, + "name": "e" + }, + { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "f" + }, + "name": "f" + } + ] } ], "static": false, diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/no-computed-decorator-member/input.js b/packages/babylon/test/fixtures/experimental/decorators-2/compued-property/input.js similarity index 67% rename from packages/babylon/test/fixtures/experimental/decorators-2/no-computed-decorator-member/input.js rename to packages/babylon/test/fixtures/experimental/decorators-2/compued-property/input.js index f261291097..a1a540fe28 100644 --- a/packages/babylon/test/fixtures/experimental/decorators-2/no-computed-decorator-member/input.js +++ b/packages/babylon/test/fixtures/experimental/decorators-2/compued-property/input.js @@ -1,5 +1,5 @@ class Foo { - @bar[bizz] + @bar [bizz] abc() { } diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/compued-property/options.json b/packages/babylon/test/fixtures/experimental/decorators-2/compued-property/options.json new file mode 100644 index 0000000000..16412e2e6a --- /dev/null +++ b/packages/babylon/test/fixtures/experimental/decorators-2/compued-property/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["decorators2", "classProperties"] +} diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/compued-property/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/compued-property/output.json new file mode 100644 index 0000000000..47fd3e62e1 --- /dev/null +++ b/packages/babylon/test/fixtures/experimental/decorators-2/compued-property/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "callee": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "static": false, + "computed": true, + "key": { + "type": "Identifier", + "start": 20, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "bizz" + }, + "name": "bizz" + }, + "value": null + }, + { + "type": "ClassMethod", + "start": 28, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 28, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "abc" + }, + "name": "abc" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/export-decorated-class/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/export-decorated-class/output.json index d3e6301bb2..1de3383b10 100644 --- a/packages/babylon/test/fixtures/experimental/decorators-2/export-decorated-class/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators-2/export-decorated-class/output.json @@ -73,7 +73,7 @@ "column": 11 } }, - "expression": { + "callee": { "type": "Identifier", "start": 8, "end": 11, diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/export-default-decorated-class/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/export-default-decorated-class/output.json index 973e5b5604..439f124aaa 100644 --- a/packages/babylon/test/fixtures/experimental/decorators-2/export-default-decorated-class/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators-2/export-default-decorated-class/output.json @@ -71,7 +71,7 @@ "column": 4 } }, - "expression": { + "callee": { "type": "Identifier", "start": 17, "end": 20, @@ -129,4 +129,4 @@ ], "directives": [] } -} +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/get-decorator/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/get-decorator/output.json index 5db365b958..8ead46c650 100644 --- a/packages/babylon/test/fixtures/experimental/decorators-2/get-decorator/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators-2/get-decorator/output.json @@ -104,7 +104,7 @@ "column": 6 } }, - "expression": { + "callee": { "type": "Identifier", "start": 13, "end": 16, diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/decoratorception-class/input.js b/packages/babylon/test/fixtures/experimental/decorators-2/nested-class-decorator-parameters/input.js similarity index 100% rename from packages/babylon/test/fixtures/experimental/decorators-2/decoratorception-class/input.js rename to packages/babylon/test/fixtures/experimental/decorators-2/nested-class-decorator-parameters/input.js diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/decoratorception-class/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/nested-class-decorator-parameters/output.json similarity index 54% rename from packages/babylon/test/fixtures/experimental/decorators-2/decoratorception-class/output.json rename to packages/babylon/test/fixtures/experimental/decorators-2/nested-class-decorator-parameters/output.json index 5ee1bc7345..33bbc9f55b 100644 --- a/packages/babylon/test/fixtures/experimental/decorators-2/decoratorception-class/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators-2/nested-class-decorator-parameters/output.json @@ -57,175 +57,160 @@ "column": 2 } }, - "expression": { - "type": "CallExpression", + "callee": { + "type": "Identifier", "start": 1, - "end": 40, + "end": 6, "loc": { "start": { "line": 1, "column": 1 }, "end": { - "line": 3, - "column": 2 - } + "line": 1, + "column": 6 + }, + "identifierName": "outer" }, - "callee": { - "type": "Identifier", - "start": 1, - "end": 6, + "name": "outer" + }, + "arguments": [ + { + "type": "ObjectExpression", + "start": 7, + "end": 39, "loc": { "start": { "line": 1, - "column": 1 + "column": 7 }, "end": { - "line": 1, - "column": 6 - }, - "identifierName": "outer" + "line": 3, + "column": 1 + } }, - "name": "outer" - }, - "arguments": [ - { - "type": "ObjectExpression", - "start": 7, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 7 + "properties": [ + { + "type": "ObjectProperty", + "start": 11, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 28 + } }, - "end": { - "line": 3, - "column": 1 - } - }, - "properties": [ - { - "type": "ObjectProperty", + "method": false, + "key": { + "type": "Identifier", "start": 11, - "end": 37, + "end": 16, "loc": { "start": { "line": 2, "column": 2 }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "store" + }, + "name": "store" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ClassExpression", + "start": 18, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 9 + }, "end": { "line": 2, "column": 28 } }, - "method": false, - "key": { + "decorators": [ + { + "type": "Decorator", + "start": 18, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "callee": { + "type": "Identifier", + "start": 19, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "inner" + }, + "name": "inner" + } + } + ], + "id": { "type": "Identifier", - "start": 11, - "end": 16, + "start": 31, + "end": 34, "loc": { "start": { "line": 2, - "column": 2 + "column": 22 }, "end": { "line": 2, - "column": 7 + "column": 25 }, - "identifierName": "store" + "identifierName": "Foo" }, - "name": "store" + "name": "Foo" }, - "computed": false, - "shorthand": false, - "value": { - "type": "ClassExpression", - "start": 18, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 35, "end": 37, "loc": { "start": { "line": 2, - "column": 9 + "column": 26 }, "end": { "line": 2, "column": 28 } }, - "decorators": [ - { - "type": "Decorator", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "expression": { - "type": "Identifier", - "start": 19, - "end": 24, - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - }, - "identifierName": "inner" - }, - "name": "inner" - } - } - ], - "id": { - "type": "Identifier", - "start": 31, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 25 - }, - "identifierName": "Foo" - }, - "name": "Foo" - }, - "superClass": null, - "body": { - "type": "ClassBody", - "start": 35, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 28 - } - }, - "body": [] - } + "body": [] } } - ] - } - ] - } + } + ] + } + ] } ], "id": { diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/nested-class-decorator/input.js b/packages/babylon/test/fixtures/experimental/decorators-2/nested-class-decorator/input.js new file mode 100644 index 0000000000..3c55767910 --- /dev/null +++ b/packages/babylon/test/fixtures/experimental/decorators-2/nested-class-decorator/input.js @@ -0,0 +1,6 @@ +@({ + store: @inner class Foo {} +}) +class Bar { + +} diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/nested-class-decorator/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/nested-class-decorator/output.json new file mode 100644 index 0000000000..25cabbc2ee --- /dev/null +++ b/packages/babylon/test/fixtures/experimental/decorators-2/nested-class-decorator/output.json @@ -0,0 +1,235 @@ +{ + "type": "File", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "callee": { + "type": "ObjectExpression", + "start": 2, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 6, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "store" + }, + "name": "store" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ClassExpression", + "start": 13, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 13, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "callee": { + "type": "Identifier", + "start": 14, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "inner" + }, + "name": "inner" + } + } + ], + "id": { + "type": "Identifier", + "start": 26, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "body": [] + } + } + } + ] + } + } + ], + "id": { + "type": "Identifier", + "start": 42, + "end": 45, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + }, + "identifierName": "Bar" + }, + "name": "Bar" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 46, + "end": 52, + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/decoratorception-method/input.js b/packages/babylon/test/fixtures/experimental/decorators-2/nested-method-decorator-parameters/input.js similarity index 100% rename from packages/babylon/test/fixtures/experimental/decorators-2/decoratorception-method/input.js rename to packages/babylon/test/fixtures/experimental/decorators-2/nested-method-decorator-parameters/input.js diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/decoratorception-method/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/nested-method-decorator-parameters/output.json similarity index 58% rename from packages/babylon/test/fixtures/experimental/decorators-2/decoratorception-method/output.json rename to packages/babylon/test/fixtures/experimental/decorators-2/nested-method-decorator-parameters/output.json index b05b9fcf61..26fad22d6b 100644 --- a/packages/babylon/test/fixtures/experimental/decorators-2/decoratorception-method/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators-2/nested-method-decorator-parameters/output.json @@ -104,198 +104,183 @@ "column": 3 } }, - "expression": { - "type": "CallExpression", + "callee": { + "type": "Identifier", "start": 14, - "end": 91, + "end": 19, "loc": { "start": { "line": 2, "column": 3 }, "end": { - "line": 7, - "column": 3 - } + "line": 2, + "column": 8 + }, + "identifierName": "outer" }, - "callee": { - "type": "Identifier", - "start": 14, - "end": 19, + "name": "outer" + }, + "arguments": [ + { + "type": "ClassExpression", + "start": 25, + "end": 87, "loc": { "start": { - "line": 2, - "column": 3 + "line": 3, + "column": 4 }, "end": { - "line": 2, - "column": 8 - }, - "identifierName": "outer" + "line": 6, + "column": 5 + } }, - "name": "outer" - }, - "arguments": [ - { - "type": "ClassExpression", - "start": 25, + "decorators": [ + { + "type": "Decorator", + "start": 25, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "callee": { + "type": "Identifier", + "start": 26, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 13 + }, + "identifierName": "classDec" + }, + "name": "classDec" + } + } + ], + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 41, "end": 87, "loc": { "start": { "line": 3, - "column": 4 + "column": 20 }, "end": { "line": 6, "column": 5 } }, - "decorators": [ + "body": [ { - "type": "Decorator", - "start": 25, - "end": 34, + "type": "ClassMethod", + "start": 50, + "end": 80, "loc": { "start": { - "line": 3, - "column": 4 + "line": 4, + "column": 6 }, "end": { - "line": 3, - "column": 13 + "line": 5, + "column": 22 } }, - "expression": { + "decorators": [ + { + "type": "Decorator", + "start": 50, + "end": 56, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 12 + } + }, + "callee": { + "type": "Identifier", + "start": 51, + "end": 56, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 12 + }, + "identifierName": "inner" + }, + "name": "inner" + } + } + ], + "static": false, + "key": { "type": "Identifier", - "start": 26, - "end": 34, + "start": 64, + "end": 75, "loc": { "start": { - "line": 3, - "column": 5 + "line": 5, + "column": 6 }, "end": { - "line": 3, - "column": 13 + "line": 5, + "column": 17 }, - "identifierName": "classDec" + "identifierName": "innerMethod" }, - "name": "classDec" - } - } - ], - "id": null, - "superClass": null, - "body": { - "type": "ClassBody", - "start": 41, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 20 + "name": "innerMethod" }, - "end": { - "line": 6, - "column": 5 - } - }, - "body": [ - { - "type": "ClassMethod", - "start": 50, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 78, "end": 80, "loc": { "start": { - "line": 4, - "column": 6 + "line": 5, + "column": 20 }, "end": { "line": 5, "column": 22 } }, - "decorators": [ - { - "type": "Decorator", - "start": 50, - "end": 56, - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 12 - } - }, - "expression": { - "type": "Identifier", - "start": 51, - "end": 56, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 12 - }, - "identifierName": "inner" - }, - "name": "inner" - } - } - ], - "static": false, - "key": { - "type": "Identifier", - "start": 64, - "end": 75, - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 17 - }, - "identifierName": "innerMethod" - }, - "name": "innerMethod" - }, - "computed": false, - "kind": "method", - "id": null, - "generator": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "start": 78, - "end": 80, - "loc": { - "start": { - "line": 5, - "column": 20 - }, - "end": { - "line": 5, - "column": 22 - } - }, - "body": [], - "directives": [] - } + "body": [], + "directives": [] } - ] - } + } + ] } - ] - } + } + ] } ], "static": false, diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/nested-method-decorator/input.js b/packages/babylon/test/fixtures/experimental/decorators-2/nested-method-decorator/input.js new file mode 100644 index 0000000000..81fdab5caa --- /dev/null +++ b/packages/babylon/test/fixtures/experimental/decorators-2/nested-method-decorator/input.js @@ -0,0 +1,9 @@ +class Bar{ + @( + @classDec class { + @inner + innerMethod() {} + } + ) + outerMethod() {} +} diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/nested-method-decorator/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/nested-method-decorator/output.json new file mode 100644 index 0000000000..3756c207be --- /dev/null +++ b/packages/babylon/test/fixtures/experimental/decorators-2/nested-method-decorator/output.json @@ -0,0 +1,315 @@ +{ + "type": "File", + "start": 0, + "end": 107, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 107, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 107, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Bar" + }, + "name": "Bar" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 9, + "end": 107, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 13, + "end": 105, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 8, + "column": 18 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 13, + "end": 86, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + }, + "callee": { + "type": "ClassExpression", + "start": 20, + "end": 82, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 6, + "column": 5 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 20, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "callee": { + "type": "Identifier", + "start": 21, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 13 + }, + "identifierName": "classDec" + }, + "name": "classDec" + } + } + ], + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 36, + "end": 82, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 6, + "column": 5 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 45, + "end": 75, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 5, + "column": 22 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 45, + "end": 51, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 12 + } + }, + "callee": { + "type": "Identifier", + "start": 46, + "end": 51, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 12 + }, + "identifierName": "inner" + }, + "name": "inner" + } + } + ], + "static": false, + "key": { + "type": "Identifier", + "start": 59, + "end": 70, + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 17 + }, + "identifierName": "innerMethod" + }, + "name": "innerMethod" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 73, + "end": 75, + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 22 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + } + ], + "static": false, + "key": { + "type": "Identifier", + "start": 89, + "end": 100, + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 13 + }, + "identifierName": "outerMethod" + }, + "name": "outerMethod" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 103, + "end": 105, + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 18 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/no-class-property/options.json b/packages/babylon/test/fixtures/experimental/decorators-2/no-class-property/options.json deleted file mode 100644 index 024e2be712..0000000000 --- a/packages/babylon/test/fixtures/experimental/decorators-2/no-class-property/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["classProperties", "decorators2"], - "throws": "Stage 2 decorators may only be used with a class or a class method (2:2)" -} diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/no-computed-decorator-member/options.json b/packages/babylon/test/fixtures/experimental/decorators-2/no-computed-decorator-member/options.json deleted file mode 100644 index 999cde36f6..0000000000 --- a/packages/babylon/test/fixtures/experimental/decorators-2/no-computed-decorator-member/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["decorators2", "classProperties"], - "throws": "Stage 2 decorators may only be used with a class or a class method (2:2)" -} diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/no-private-property/options.json b/packages/babylon/test/fixtures/experimental/decorators-2/no-private-property/options.json deleted file mode 100644 index 14c752698a..0000000000 --- a/packages/babylon/test/fixtures/experimental/decorators-2/no-private-property/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["classProperties", "classPrivateProperties", "decorators2"], - "throws": "Stage 2 decorators may only be used with a class or a class method (2:2)" -} diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/no-static-property/options.json b/packages/babylon/test/fixtures/experimental/decorators-2/no-static-property/options.json deleted file mode 100644 index 024e2be712..0000000000 --- a/packages/babylon/test/fixtures/experimental/decorators-2/no-static-property/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["classProperties", "decorators2"], - "throws": "Stage 2 decorators may only be used with a class or a class method (2:2)" -} diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/on-computed-name-method/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/on-computed-name-method/output.json index 0abd604dcf..edc981dccd 100644 --- a/packages/babylon/test/fixtures/experimental/decorators-2/on-computed-name-method/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators-2/on-computed-name-method/output.json @@ -104,7 +104,7 @@ "column": 6 } }, - "expression": { + "callee": { "type": "Identifier", "start": 13, "end": 16, diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/parenthesized/input.js b/packages/babylon/test/fixtures/experimental/decorators-2/parenthesized/input.js new file mode 100644 index 0000000000..79f9aa6971 --- /dev/null +++ b/packages/babylon/test/fixtures/experimental/decorators-2/parenthesized/input.js @@ -0,0 +1,6 @@ +@(foo().bar) +class Foo { + @(member[expression]) method() {} + + @(foo + bar) method2() {} +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/parenthesized/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/parenthesized/output.json new file mode 100644 index 0000000000..d8d01d4ffb --- /dev/null +++ b/packages/babylon/test/fixtures/experimental/decorators-2/parenthesized/output.json @@ -0,0 +1,413 @@ +{ + "type": "File", + "start": 0, + "end": 91, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 91, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 91, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "callee": { + "type": "MemberExpression", + "start": 2, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "object": { + "type": "CallExpression", + "start": 2, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "callee": { + "type": "Identifier", + "start": 2, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + }, + "property": { + "type": "Identifier", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false + } + } + ], + "id": { + "type": "Identifier", + "start": 19, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 23, + "end": 91, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 27, + "end": 60, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 35 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 27, + "end": 48, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "callee": { + "type": "MemberExpression", + "start": 29, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 22 + } + }, + "object": { + "type": "Identifier", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 10 + }, + "identifierName": "member" + }, + "name": "member" + }, + "property": { + "type": "Identifier", + "start": 36, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 21 + }, + "identifierName": "expression" + }, + "name": "expression" + }, + "computed": true + } + } + ], + "static": false, + "key": { + "type": "Identifier", + "start": 49, + "end": 55, + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 30 + }, + "identifierName": "method" + }, + "name": "method" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 58, + "end": 60, + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 35 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start": 64, + "end": 89, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 27 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 64, + "end": 76, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 14 + } + }, + "callee": { + "type": "BinaryExpression", + "start": 66, + "end": 75, + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 13 + } + }, + "left": { + "type": "Identifier", + "start": 66, + "end": 69, + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "operator": "+", + "right": { + "type": "Identifier", + "start": 72, + "end": 75, + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 13 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + } + ], + "static": false, + "key": { + "type": "Identifier", + "start": 77, + "end": 84, + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 22 + }, + "identifierName": "method2" + }, + "name": "method2" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 87, + "end": 89, + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 27 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/no-private-property/input.js b/packages/babylon/test/fixtures/experimental/decorators-2/private-property/input.js similarity index 100% rename from packages/babylon/test/fixtures/experimental/decorators-2/no-private-property/input.js rename to packages/babylon/test/fixtures/experimental/decorators-2/private-property/input.js diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/private-property/options.json b/packages/babylon/test/fixtures/experimental/decorators-2/private-property/options.json new file mode 100644 index 0000000000..9224c9db6e --- /dev/null +++ b/packages/babylon/test/fixtures/experimental/decorators-2/private-property/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties", "classPrivateProperties", "decorators2"] +} diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/private-property/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/private-property/output.json new file mode 100644 index 0000000000..3146c46607 --- /dev/null +++ b/packages/babylon/test/fixtures/experimental/decorators-2/private-property/output.json @@ -0,0 +1,186 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 12, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "callee": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "dec" + }, + "name": "dec" + } + } + ], + "static": false, + "key": { + "type": "PrivateName", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "name" + }, + "name": "name" + } + }, + "value": { + "type": "NumericLiteral", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/restricted-1/input.js b/packages/babylon/test/fixtures/experimental/decorators-2/restricted-1/input.js index cf35085f86..8402c20e30 100644 --- a/packages/babylon/test/fixtures/experimental/decorators-2/restricted-1/input.js +++ b/packages/babylon/test/fixtures/experimental/decorators-2/restricted-1/input.js @@ -1,2 +1,2 @@ -@(bar.baz) -class Foo {} +@foo().bar +class Baz {} diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/restricted-1/options.json b/packages/babylon/test/fixtures/experimental/decorators-2/restricted-1/options.json index b5b75f4187..9fc4104fb3 100644 --- a/packages/babylon/test/fixtures/experimental/decorators-2/restricted-1/options.json +++ b/packages/babylon/test/fixtures/experimental/decorators-2/restricted-1/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:1)" + "throws": "Leading decorators must be attached to a class declaration (1:6)" } diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/restricted-2/input.js b/packages/babylon/test/fixtures/experimental/decorators-2/restricted-2/input.js index 8402c20e30..5dbb5849b7 100644 --- a/packages/babylon/test/fixtures/experimental/decorators-2/restricted-2/input.js +++ b/packages/babylon/test/fixtures/experimental/decorators-2/restricted-2/input.js @@ -1,2 +1,2 @@ -@foo().bar +@foo()() class Baz {} diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/set-decorator/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/set-decorator/output.json index 90cf5e8b03..893757bd73 100644 --- a/packages/babylon/test/fixtures/experimental/decorators-2/set-decorator/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators-2/set-decorator/output.json @@ -104,7 +104,7 @@ "column": 6 } }, - "expression": { + "callee": { "type": "Identifier", "start": 13, "end": 16, diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/static-method/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/static-method/output.json index 79bd82fd29..3800c970f8 100644 --- a/packages/babylon/test/fixtures/experimental/decorators-2/static-method/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators-2/static-method/output.json @@ -104,7 +104,7 @@ "column": 6 } }, - "expression": { + "callee": { "type": "Identifier", "start": 15, "end": 18, diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/no-static-property/input.js b/packages/babylon/test/fixtures/experimental/decorators-2/static-property/input.js similarity index 100% rename from packages/babylon/test/fixtures/experimental/decorators-2/no-static-property/input.js rename to packages/babylon/test/fixtures/experimental/decorators-2/static-property/input.js diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/static-property/options.json b/packages/babylon/test/fixtures/experimental/decorators-2/static-property/options.json new file mode 100644 index 0000000000..9d1f561723 --- /dev/null +++ b/packages/babylon/test/fixtures/experimental/decorators-2/static-property/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties", "decorators2"] +} diff --git a/packages/babylon/test/fixtures/experimental/decorators-2/static-property/output.json b/packages/babylon/test/fixtures/experimental/decorators-2/static-property/output.json new file mode 100644 index 0000000000..ca7e9341d5 --- /dev/null +++ b/packages/babylon/test/fixtures/experimental/decorators-2/static-property/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 12, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 12, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "callee": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "dec" + }, + "name": "dec" + } + } + ], + "static": true, + "key": { + "type": "Identifier", + "start": 24, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "name" + }, + "name": "name" + }, + "computed": false, + "value": { + "type": "NumericLiteral", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babylon/test/fixtures/experimental/decorators/class-decorator-assignment/output.json b/packages/babylon/test/fixtures/experimental/decorators/class-decorator-assignment/output.json index 56d24af64a..848711fcda 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/class-decorator-assignment/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/class-decorator-assignment/output.json @@ -103,7 +103,7 @@ "column": 14 } }, - "expression": { + "callee": { "type": "Identifier", "start": 11, "end": 14, diff --git a/packages/babylon/test/fixtures/experimental/decorators/class-decorator-call-expr/output.json b/packages/babylon/test/fixtures/experimental/decorators/class-decorator-call-expr/output.json index 26d8fca5be..96e981b0ad 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/class-decorator-call-expr/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/class-decorator-call-expr/output.json @@ -57,7 +57,7 @@ "column": 11 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 1, "end": 11, diff --git a/packages/babylon/test/fixtures/experimental/decorators/class-decorator-getter/output.json b/packages/babylon/test/fixtures/experimental/decorators/class-decorator-getter/output.json index eae716dff6..5624b03a36 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/class-decorator-getter/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/class-decorator-getter/output.json @@ -104,7 +104,7 @@ "column": 16 } }, - "expression": { + "callee": { "type": "Identifier", "start": 13, "end": 16, diff --git a/packages/babylon/test/fixtures/experimental/decorators/class-decorator-same-line/output.json b/packages/babylon/test/fixtures/experimental/decorators/class-decorator-same-line/output.json index 45e2e59ed7..62724f381e 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/class-decorator-same-line/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/class-decorator-same-line/output.json @@ -57,7 +57,7 @@ "column": 4 } }, - "expression": { + "callee": { "type": "Identifier", "start": 1, "end": 4, diff --git a/packages/babylon/test/fixtures/experimental/decorators/class-decorator-setter/output.json b/packages/babylon/test/fixtures/experimental/decorators/class-decorator-setter/output.json index 6787d02b98..a9b9bb4111 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/class-decorator-setter/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/class-decorator-setter/output.json @@ -104,7 +104,7 @@ "column": 16 } }, - "expression": { + "callee": { "type": "Identifier", "start": 13, "end": 16, diff --git a/packages/babylon/test/fixtures/experimental/decorators/class-decorator/output.json b/packages/babylon/test/fixtures/experimental/decorators/class-decorator/output.json index b0570136eb..176de43982 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/class-decorator/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/class-decorator/output.json @@ -57,7 +57,7 @@ "column": 4 } }, - "expression": { + "callee": { "type": "Identifier", "start": 1, "end": 4, diff --git a/packages/babylon/test/fixtures/experimental/decorators/class-decorators-multiple/output.json b/packages/babylon/test/fixtures/experimental/decorators/class-decorators-multiple/output.json index ebcbd85f3d..40a5435ebe 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/class-decorators-multiple/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/class-decorators-multiple/output.json @@ -104,7 +104,7 @@ "column": 16 } }, - "expression": { + "callee": { "type": "Identifier", "start": 13, "end": 16, @@ -136,7 +136,7 @@ "column": 21 } }, - "expression": { + "callee": { "type": "Identifier", "start": 18, "end": 21, diff --git a/packages/babylon/test/fixtures/experimental/decorators/class-method-parameter/output.json b/packages/babylon/test/fixtures/experimental/decorators/class-method-parameter/output.json index 63933c49d6..32e3dc2a54 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/class-method-parameter/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/class-method-parameter/output.json @@ -144,7 +144,7 @@ "column": 20 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 27, "end": 32, @@ -211,7 +211,7 @@ "column": 40 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 37, "end": 52, @@ -332,7 +332,7 @@ "column": 47 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 54, "end": 59, diff --git a/packages/babylon/test/fixtures/experimental/decorators/computed-member-expr-on-prop/output.json b/packages/babylon/test/fixtures/experimental/decorators/computed-member-expr-on-prop/output.json index 0064500c2d..d6d945320f 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/computed-member-expr-on-prop/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/computed-member-expr-on-prop/output.json @@ -104,7 +104,7 @@ "column": 11 } }, - "expression": { + "callee": { "type": "MemberExpression", "start": 15, "end": 23, diff --git a/packages/babylon/test/fixtures/experimental/decorators/computed-member-expression/output.json b/packages/babylon/test/fixtures/experimental/decorators/computed-member-expression/output.json index bf99b74320..ec927c0277 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/computed-member-expression/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/computed-member-expression/output.json @@ -104,7 +104,7 @@ "column": 12 } }, - "expression": { + "callee": { "type": "MemberExpression", "start": 15, "end": 24, diff --git a/packages/babylon/test/fixtures/experimental/decorators/export-decorators-on-class/output.json b/packages/babylon/test/fixtures/experimental/decorators/export-decorators-on-class/output.json index 90463128b5..9d946578d8 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/export-decorators-on-class/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/export-decorators-on-class/output.json @@ -73,7 +73,7 @@ "column": 4 } }, - "expression": { + "callee": { "type": "Identifier", "start": 1, "end": 4, diff --git a/packages/babylon/test/fixtures/experimental/decorators/export-default-declaration-function-declaration-parameter/output.json b/packages/babylon/test/fixtures/experimental/decorators/export-default-declaration-function-declaration-parameter/output.json index 1297f4920f..0389dc74ff 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/export-default-declaration-function-declaration-parameter/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/export-default-declaration-function-declaration-parameter/output.json @@ -107,7 +107,7 @@ "column": 35 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 30, "end": 35, @@ -174,7 +174,7 @@ "column": 55 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 40, "end": 55, @@ -295,7 +295,7 @@ "column": 62 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 57, "end": 62, diff --git a/packages/babylon/test/fixtures/experimental/decorators/export-default-decorators-on-class/output.json b/packages/babylon/test/fixtures/experimental/decorators/export-default-decorators-on-class/output.json index 3fcaa85ea6..b52915d866 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/export-default-decorators-on-class/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/export-default-decorators-on-class/output.json @@ -71,7 +71,7 @@ "column": 4 } }, - "expression": { + "callee": { "type": "Identifier", "start": 1, "end": 4, diff --git a/packages/babylon/test/fixtures/experimental/decorators/export-default-with-nested-class/output.json b/packages/babylon/test/fixtures/experimental/decorators/export-default-with-nested-class/output.json index c247e9e09f..05914a043f 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/export-default-with-nested-class/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/export-default-with-nested-class/output.json @@ -71,7 +71,7 @@ "column": 16 } }, - "expression": { + "callee": { "type": "Identifier", "start": 1, "end": 16, diff --git a/packages/babylon/test/fixtures/experimental/decorators/function-declaration-parameter/output.json b/packages/babylon/test/fixtures/experimental/decorators/function-declaration-parameter/output.json index 907c3b783b..0eadd50aba 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/function-declaration-parameter/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/function-declaration-parameter/output.json @@ -93,7 +93,7 @@ "column": 20 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 15, "end": 20, @@ -160,7 +160,7 @@ "column": 40 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 25, "end": 40, @@ -281,7 +281,7 @@ "column": 47 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 42, "end": 47, diff --git a/packages/babylon/test/fixtures/experimental/decorators/function-expression-parameter/output.json b/packages/babylon/test/fixtures/experimental/decorators/function-expression-parameter/output.json index 4e6198ddf7..35f5ec392e 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/function-expression-parameter/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/function-expression-parameter/output.json @@ -123,7 +123,7 @@ "column": 29 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 24, "end": 29, @@ -190,7 +190,7 @@ "column": 49 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 34, "end": 49, @@ -311,7 +311,7 @@ "column": 56 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 51, "end": 56, diff --git a/packages/babylon/test/fixtures/experimental/decorators/method-decorator/output.json b/packages/babylon/test/fixtures/experimental/decorators/method-decorator/output.json index 95acd52c44..825114840b 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/method-decorator/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/method-decorator/output.json @@ -104,7 +104,7 @@ "column": 16 } }, - "expression": { + "callee": { "type": "Identifier", "start": 13, "end": 16, diff --git a/packages/babylon/test/fixtures/experimental/decorators/object-decorator/output.json b/packages/babylon/test/fixtures/experimental/decorators/object-decorator/output.json index 8ceeef6f0e..bc48898615 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/object-decorator/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/object-decorator/output.json @@ -57,7 +57,7 @@ "column": 25 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 1, "end": 25, @@ -133,7 +133,7 @@ "column": 11 } }, - "expression": { + "callee": { "type": "Identifier", "start": 8, "end": 11, @@ -212,7 +212,7 @@ "column": 30 } }, - "expression": { + "callee": { "type": "Identifier", "start": 27, "end": 30, diff --git a/packages/babylon/test/fixtures/experimental/decorators/object-method-parameter/output.json b/packages/babylon/test/fixtures/experimental/decorators/object-method-parameter/output.json index 90ccc20f02..1fcc4c57f7 100644 --- a/packages/babylon/test/fixtures/experimental/decorators/object-method-parameter/output.json +++ b/packages/babylon/test/fixtures/experimental/decorators/object-method-parameter/output.json @@ -158,7 +158,7 @@ "column": 15 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 22, "end": 27, @@ -225,7 +225,7 @@ "column": 35 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 32, "end": 47, @@ -346,7 +346,7 @@ "column": 42 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 49, "end": 54, diff --git a/packages/babylon/test/fixtures/experimental/uncategorised/40/output.json b/packages/babylon/test/fixtures/experimental/uncategorised/40/output.json index 42ef576b83..70ef40699b 100644 --- a/packages/babylon/test/fixtures/experimental/uncategorised/40/output.json +++ b/packages/babylon/test/fixtures/experimental/uncategorised/40/output.json @@ -57,7 +57,7 @@ "column": 4 } }, - "expression": { + "callee": { "type": "Identifier", "start": 1, "end": 4, @@ -122,7 +122,7 @@ "column": 27 } }, - "expression": { + "callee": { "type": "Identifier", "start": 24, "end": 27, diff --git a/packages/babylon/test/fixtures/experimental/uncategorised/47/output.json b/packages/babylon/test/fixtures/experimental/uncategorised/47/output.json index 37fe3d9890..8e74943f7e 100644 --- a/packages/babylon/test/fixtures/experimental/uncategorised/47/output.json +++ b/packages/babylon/test/fixtures/experimental/uncategorised/47/output.json @@ -104,7 +104,7 @@ "column": 16 } }, - "expression": { + "callee": { "type": "Identifier", "start": 13, "end": 16, diff --git a/packages/babylon/test/fixtures/experimental/uncategorised/48/output.json b/packages/babylon/test/fixtures/experimental/uncategorised/48/output.json index 1c84e7bbb5..2aff0b84a4 100644 --- a/packages/babylon/test/fixtures/experimental/uncategorised/48/output.json +++ b/packages/babylon/test/fixtures/experimental/uncategorised/48/output.json @@ -104,7 +104,7 @@ "column": 16 } }, - "expression": { + "callee": { "type": "Identifier", "start": 13, "end": 16, diff --git a/packages/babylon/test/fixtures/experimental/uncategorised/49/output.json b/packages/babylon/test/fixtures/experimental/uncategorised/49/output.json index b5a8d458eb..ecf0ccfef1 100644 --- a/packages/babylon/test/fixtures/experimental/uncategorised/49/output.json +++ b/packages/babylon/test/fixtures/experimental/uncategorised/49/output.json @@ -118,7 +118,7 @@ "column": 16 } }, - "expression": { + "callee": { "type": "Identifier", "start": 13, "end": 16, diff --git a/packages/babylon/test/fixtures/experimental/uncategorised/62/output.json b/packages/babylon/test/fixtures/experimental/uncategorised/62/output.json index 9c37f72e9c..864afee525 100644 --- a/packages/babylon/test/fixtures/experimental/uncategorised/62/output.json +++ b/packages/babylon/test/fixtures/experimental/uncategorised/62/output.json @@ -57,7 +57,7 @@ "column": 24 } }, - "expression": { + "callee": { "type": "CallExpression", "start": 1, "end": 24, diff --git a/packages/babylon/test/fixtures/typescript/class/parameter-properties-with-decorators/output.json b/packages/babylon/test/fixtures/typescript/class/parameter-properties-with-decorators/output.json index 4096b04c95..e78afd1534 100644 --- a/packages/babylon/test/fixtures/typescript/class/parameter-properties-with-decorators/output.json +++ b/packages/babylon/test/fixtures/typescript/class/parameter-properties-with-decorators/output.json @@ -142,7 +142,7 @@ "column": 20 } }, - "expression": { + "callee": { "type": "Identifier", "start": 27, "end": 30,