From 2e5b46ec901edc9d855f2b75e49f19b5955a5563 Mon Sep 17 00:00:00 2001 From: Andrew Boyton Date: Tue, 5 Feb 2019 00:48:13 +1100 Subject: [PATCH 1/5] docs(eslint-plugin): add instructions for using Airbnb's config (#177) --- packages/eslint-plugin/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 1ec6df21604..cacb6666fdd 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -84,6 +84,22 @@ Install [`eslint-config-prettier`](https://github.com/prettier/eslint-config-pre **Note: Make sure you have `eslint-config-prettier@4.0.0` or newer.** +## Usage with Airbnb + +Airbnb has two configs, a base one [`eslint-config-airbnb-base`](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base) and one that includes rules for React [`eslint-config-airbnb`](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb). + +First you'll need to install the config according to the instructions in one of the links above. `npx install-peerdeps --dev eslint-config-airbnb` or `npx install-peerdeps --dev eslint-config-airbnb-base` should work if you are using **npm 5+**. + +Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.eslintrc`. You might also want to turn on `plugin:@typescript-eslint/recommended` as well to enable all of the recommended rules. + +```json +{ + "extends": ["airbnb-base", "plugin:@typescript-eslint/recommended"] +} +``` + +**Note: You can use Airbnb's rules alongside Prettier, see [Usage with Prettier](#usage-with-prettier)** + ## Supported Rules From e37a1edb66160e64a3a5b15db8c294905ccc6d02 Mon Sep 17 00:00:00 2001 From: Armano Date: Mon, 4 Feb 2019 14:48:54 +0100 Subject: [PATCH 2/5] fix(ts-estree): fix issue with nested jsx tag names (#197) --- .../tests/lib/__snapshots__/jsx.ts.snap | 50 +- packages/typescript-estree/src/convert.ts | 123 ++--- .../tests/ast-alignment/fixtures-to-test.ts | 7 +- .../tests/lib/__snapshots__/convert.ts.snap | 519 ++++++++++++++++++ .../tests/lib/__snapshots__/jsx.ts.snap | 50 +- .../typescript-estree/tests/lib/convert.ts | 128 +++++ 6 files changed, 736 insertions(+), 141 deletions(-) create mode 100644 packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap create mode 100644 packages/typescript-estree/tests/lib/convert.ts diff --git a/packages/parser/tests/lib/__snapshots__/jsx.ts.snap b/packages/parser/tests/lib/__snapshots__/jsx.ts.snap index 02d917e3fb5..a9b76778c34 100644 --- a/packages/parser/tests/lib/__snapshots__/jsx.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/jsx.ts.snap @@ -9526,7 +9526,6 @@ Object { }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { "column": 41, @@ -9548,11 +9547,12 @@ Object { "line": 2, }, }, + "name": "this", "range": Array [ 45, 49, ], - "type": "ThisExpression", + "type": "JSXIdentifier", }, "property": Object { "loc": Object { @@ -9570,13 +9570,13 @@ Object { 50, 55, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "range": Array [ 45, 55, ], - "type": "MemberExpression", + "type": "JSXMemberExpression", }, "property": Object { "loc": Object { @@ -9677,7 +9677,6 @@ Object { }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { "column": 13, @@ -9699,11 +9698,12 @@ Object { "line": 2, }, }, + "name": "this", "range": Array [ 17, 21, ], - "type": "ThisExpression", + "type": "JSXIdentifier", }, "property": Object { "loc": Object { @@ -9721,13 +9721,13 @@ Object { 22, 27, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "range": Array [ 17, 27, ], - "type": "MemberExpression", + "type": "JSXMemberExpression", }, "property": Object { "loc": Object { @@ -9846,7 +9846,6 @@ Object { }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { "column": 9, @@ -9858,7 +9857,6 @@ Object { }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { "column": 7, @@ -9870,7 +9868,6 @@ Object { }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { "column": 5, @@ -9897,7 +9894,7 @@ Object { 74, 75, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "property": Object { "loc": Object { @@ -9915,13 +9912,13 @@ Object { 76, 77, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "range": Array [ 74, 77, ], - "type": "MemberExpression", + "type": "JSXMemberExpression", }, "property": Object { "loc": Object { @@ -9939,13 +9936,13 @@ Object { 78, 79, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "range": Array [ 74, 79, ], - "type": "MemberExpression", + "type": "JSXMemberExpression", }, "property": Object { "loc": Object { @@ -9963,13 +9960,13 @@ Object { 80, 81, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "range": Array [ 74, 81, ], - "type": "MemberExpression", + "type": "JSXMemberExpression", }, "property": Object { "loc": Object { @@ -10070,7 +10067,6 @@ Object { }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { "column": 8, @@ -10082,7 +10078,6 @@ Object { }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { "column": 6, @@ -10094,7 +10089,6 @@ Object { }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { "column": 4, @@ -10121,7 +10115,7 @@ Object { 1, 2, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "property": Object { "loc": Object { @@ -10139,13 +10133,13 @@ Object { 3, 4, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "range": Array [ 1, 4, ], - "type": "MemberExpression", + "type": "JSXMemberExpression", }, "property": Object { "loc": Object { @@ -10163,13 +10157,13 @@ Object { 5, 6, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "range": Array [ 1, 6, ], - "type": "MemberExpression", + "type": "JSXMemberExpression", }, "property": Object { "loc": Object { @@ -10187,13 +10181,13 @@ Object { 7, 8, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "range": Array [ 1, 8, ], - "type": "MemberExpression", + "type": "JSXMemberExpression", }, "property": Object { "loc": Object { diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 8e2d6a876a1..2a170392030 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -9,7 +9,6 @@ import ts from 'typescript'; import * as es from './typedefs'; import { canContainDirective, - convertToken, createError, findNextToken, fixExports, @@ -25,7 +24,6 @@ import { isComma, isComputedProperty, isESTreeClassMember, - isJSXToken, isOptional, unescapeStringLiteralText } from './node-utils'; @@ -369,50 +367,47 @@ export class Converter { /** * Converts a TypeScript JSX node.tagName into an ESTree node.name - * @param tagName the tagName object from a JSX ts.Node + * @param node the tagName object from a JSX ts.Node * @param parent * @returns the converted ESTree name object */ - private convertTypeScriptJSXTagNameToESTreeName( - tagName: ts.JsxTagNameExpression, + private convertJSXTagName( + node: ts.JsxTagNameExpression, parent: ts.Node ): es.JSXMemberExpression | es.JSXIdentifier { - // TODO: remove convertToken call - const tagNameToken = convertToken(tagName, this.ast); - - if (tagName.kind === SyntaxKind.PropertyAccessExpression) { - const isNestedMemberExpression = - tagName.expression.kind === SyntaxKind.PropertyAccessExpression; - - // Convert TSNode left and right objects into ESTreeNode object - // and property objects - const object = this.convertChild(tagName.expression, parent); - const property = this.convertChild(tagName.name, parent); - - // Assign the appropriate types - object.type = isNestedMemberExpression - ? AST_NODE_TYPES.JSXMemberExpression - : AST_NODE_TYPES.JSXIdentifier; - property.type = AST_NODE_TYPES.JSXIdentifier; - if ((tagName as any).expression.kind === SyntaxKind.ThisKeyword) { - object.name = 'this'; - } - - return this.createNode(tagName, { - type: AST_NODE_TYPES.JSXMemberExpression, - range: tagNameToken.range, - loc: tagNameToken.loc, - object: object, - property: property - }); - } else { - return this.createNode(tagName, { - type: AST_NODE_TYPES.JSXIdentifier, - range: tagNameToken.range, - loc: tagNameToken.loc, - name: tagNameToken.value - }); + let result: es.JSXMemberExpression | es.JSXIdentifier; + switch (node.kind) { + case SyntaxKind.PropertyAccessExpression: + result = this.createNode(node, { + type: AST_NODE_TYPES.JSXMemberExpression, + object: this.convertJSXTagName(node.expression, parent), + property: this.convertJSXTagName( + node.name, + parent + ) as es.JSXIdentifier + }); + break; + case SyntaxKind.ThisKeyword: + result = this.createNode(node, { + type: AST_NODE_TYPES.JSXIdentifier, + name: 'this' + }); + break; + case SyntaxKind.Identifier: + default: + result = this.createNode(node, { + type: AST_NODE_TYPES.JSXIdentifier, + name: node.text + }); + break; + } + + if (result && this.options.shouldProvideParserServices) { + this.tsNodeToESTreeNodeMap.set(node, result); + this.esTreeNodeToTSNodeMap.set(result, node); } + + return result; } /** @@ -1617,36 +1612,12 @@ export class Converter { } case SyntaxKind.PropertyAccessExpression: - if (isJSXToken(parent)) { - const jsxMemberExpression = this.createNode( - node, - { - type: AST_NODE_TYPES.MemberExpression, - object: this.convertChild(node.expression), - property: this.convertChild(node.name) - } - ); - // TODO: refactor this - const isNestedMemberExpression = - node.expression.kind === SyntaxKind.PropertyAccessExpression; - if (node.expression.kind === SyntaxKind.ThisKeyword) { - (jsxMemberExpression.object as any).name = 'this'; - } - - (jsxMemberExpression.object as any).type = isNestedMemberExpression - ? AST_NODE_TYPES.MemberExpression - : AST_NODE_TYPES.JSXIdentifier; - (jsxMemberExpression as any).property.type = - AST_NODE_TYPES.JSXIdentifier; - return jsxMemberExpression; - } else { - return this.createNode(node, { - type: AST_NODE_TYPES.MemberExpression, - object: this.convertChild(node.expression), - property: this.convertChild(node.name), - computed: false - }); - } + return this.createNode(node, { + type: AST_NODE_TYPES.MemberExpression, + object: this.convertChild(node.expression), + property: this.convertChild(node.name), + computed: false + }); case SyntaxKind.ElementAccessExpression: return this.createNode(node, { @@ -1844,10 +1815,7 @@ export class Converter { ? this.convertTypeArgumentsToTypeParameters(node.typeArguments) : undefined, selfClosing: true, - name: this.convertTypeScriptJSXTagNameToESTreeName( - node.tagName, - node - ), + name: this.convertJSXTagName(node.tagName, node), attributes: node.attributes.properties.map(el => this.convertChild(el) ), @@ -1865,10 +1833,7 @@ export class Converter { ? this.convertTypeArgumentsToTypeParameters(node.typeArguments) : undefined, selfClosing: false, - name: this.convertTypeScriptJSXTagNameToESTreeName( - node.tagName, - node - ), + name: this.convertJSXTagName(node.tagName, node), attributes: node.attributes.properties.map(el => this.convertChild(el) ) @@ -1877,7 +1842,7 @@ export class Converter { case SyntaxKind.JsxClosingElement: return this.createNode(node, { type: AST_NODE_TYPES.JSXClosingElement, - name: this.convertTypeScriptJSXTagNameToESTreeName(node.tagName, node) + name: this.convertJSXTagName(node.tagName, node) }); case SyntaxKind.JsxOpeningFragment: diff --git a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts index ede45e93fcd..e92f68f968f 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -284,12 +284,7 @@ tester.addFixturePatternConfig('javascript/unicodeCodePointEscapes'); /* ================================================== */ tester.addFixturePatternConfig('jsx', { - ignore: jsxFilesWithKnownIssues.concat([ - /** - * ts-estree: nested jsx tag names are not correctly converted - */ - 'tag-names-with-multi-dots-multi' - ]) + ignore: jsxFilesWithKnownIssues }); tester.addFixturePatternConfig('jsx-useJSXTextNode'); diff --git a/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap new file mode 100644 index 00000000000..05a20300876 --- /dev/null +++ b/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap @@ -0,0 +1,519 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`convert deeplyCopy should convert node correctly 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 35, + ], + "transformFlags": undefined, + "type": "TSJSDocNullableType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 35, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 35, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 18, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 15, + 18, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 35, + ], + "transformFlags": undefined, + "type": "TSJSDocNullableType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 35, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 35, + ], + "transformFlags": undefined, + "type": "TSJSDocNullableType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 34, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 34, + ], + "type": "TSParenthesizedType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 23, + 33, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 33, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 33, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSFunctionType", + }, + }, + }, + }, + }, + }, + ], + }, + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`convert deeplyCopy should convert node with decorators correctly 1`] = ` +Object { + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 1, + 5, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Decorator", + }, + ], + "heritageClauses": undefined, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "members": Array [], + "modifiers": undefined, + "name": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 18, + ], + "transformFlags": undefined, + "type": "TSClassDeclaration", + "typeParameters": null, +} +`; + +exports[`convert deeplyCopy should convert node with type parameters correctly 1`] = ` +Object { + "heritageClauses": undefined, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "members": Array [], + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 15, + ], + "transformFlags": undefined, + "type": "TSClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 10, + 11, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 9, + 12, + ], + "type": "TSTypeParameterDeclaration", + }, +} +`; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/jsx.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/jsx.ts.snap index cb1f698c267..d0d092c7841 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/jsx.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/jsx.ts.snap @@ -9486,7 +9486,6 @@ Object { }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { "column": 41, @@ -9508,11 +9507,12 @@ Object { "line": 2, }, }, + "name": "this", "range": Array [ 45, 49, ], - "type": "ThisExpression", + "type": "JSXIdentifier", }, "property": Object { "loc": Object { @@ -9530,13 +9530,13 @@ Object { 50, 55, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "range": Array [ 45, 55, ], - "type": "MemberExpression", + "type": "JSXMemberExpression", }, "property": Object { "loc": Object { @@ -9637,7 +9637,6 @@ Object { }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { "column": 13, @@ -9659,11 +9658,12 @@ Object { "line": 2, }, }, + "name": "this", "range": Array [ 17, 21, ], - "type": "ThisExpression", + "type": "JSXIdentifier", }, "property": Object { "loc": Object { @@ -9681,13 +9681,13 @@ Object { 22, 27, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "range": Array [ 17, 27, ], - "type": "MemberExpression", + "type": "JSXMemberExpression", }, "property": Object { "loc": Object { @@ -9806,7 +9806,6 @@ Object { }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { "column": 9, @@ -9818,7 +9817,6 @@ Object { }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { "column": 7, @@ -9830,7 +9828,6 @@ Object { }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { "column": 5, @@ -9857,7 +9854,7 @@ Object { 74, 75, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "property": Object { "loc": Object { @@ -9875,13 +9872,13 @@ Object { 76, 77, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "range": Array [ 74, 77, ], - "type": "MemberExpression", + "type": "JSXMemberExpression", }, "property": Object { "loc": Object { @@ -9899,13 +9896,13 @@ Object { 78, 79, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "range": Array [ 74, 79, ], - "type": "MemberExpression", + "type": "JSXMemberExpression", }, "property": Object { "loc": Object { @@ -9923,13 +9920,13 @@ Object { 80, 81, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "range": Array [ 74, 81, ], - "type": "MemberExpression", + "type": "JSXMemberExpression", }, "property": Object { "loc": Object { @@ -10030,7 +10027,6 @@ Object { }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { "column": 8, @@ -10042,7 +10038,6 @@ Object { }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { "column": 6, @@ -10054,7 +10049,6 @@ Object { }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { "column": 4, @@ -10081,7 +10075,7 @@ Object { 1, 2, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "property": Object { "loc": Object { @@ -10099,13 +10093,13 @@ Object { 3, 4, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "range": Array [ 1, 4, ], - "type": "MemberExpression", + "type": "JSXMemberExpression", }, "property": Object { "loc": Object { @@ -10123,13 +10117,13 @@ Object { 5, 6, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "range": Array [ 1, 6, ], - "type": "MemberExpression", + "type": "JSXMemberExpression", }, "property": Object { "loc": Object { @@ -10147,13 +10141,13 @@ Object { 7, 8, ], - "type": "Identifier", + "type": "JSXIdentifier", }, "range": Array [ 1, 8, ], - "type": "MemberExpression", + "type": "JSXMemberExpression", }, "property": Object { "loc": Object { diff --git a/packages/typescript-estree/tests/lib/convert.ts b/packages/typescript-estree/tests/lib/convert.ts new file mode 100644 index 00000000000..ee2a44f7b7c --- /dev/null +++ b/packages/typescript-estree/tests/lib/convert.ts @@ -0,0 +1,128 @@ +import { Converter } from '../../src/convert'; +import ts from 'typescript'; + +describe('convert', () => { + function convertCode(code: string): ts.SourceFile { + return ts.createSourceFile( + 'text.ts', + code, + ts.ScriptTarget.ESNext, + true, + ts.ScriptKind.TSX + ); + } + + it('deeplyCopy should convert node correctly', () => { + const ast = convertCode('type foo = ?foo | ?(() => void)?'); + + const instance = new Converter(ast, { + errorOnUnknownASTType: false, + useJSXTextNode: false, + shouldProvideParserServices: false + }); + expect(instance.convertProgram()).toMatchSnapshot(); + }); + + it('deeplyCopy should convert node with decorators correctly', () => { + const ast = convertCode('@test class foo {}'); + + const instance = new Converter(ast, { + errorOnUnknownASTType: false, + useJSXTextNode: false, + shouldProvideParserServices: false + }); + expect((instance as any).deeplyCopy(ast.statements[0])).toMatchSnapshot(); + }); + + it('deeplyCopy should convert node with type parameters correctly', () => { + const ast = convertCode('class foo {}'); + + const instance = new Converter(ast, { + errorOnUnknownASTType: false, + useJSXTextNode: false, + shouldProvideParserServices: false + }); + expect((instance as any).deeplyCopy(ast.statements[0])).toMatchSnapshot(); + }); + + it('deeplyCopy should fail on unknown node', () => { + const ast = convertCode('type foo = ?foo | ?(() => void)?'); + + const instance = new Converter(ast, { + errorOnUnknownASTType: true, + useJSXTextNode: false, + shouldProvideParserServices: false + }); + expect(() => instance.convertProgram()).toThrow( + 'Unknown AST_NODE_TYPE: "TSJSDocNullableType"' + ); + }); + + it('nodeMaps should contain basic nodes', () => { + const ast = convertCode(` + 'test'; + 2; + class foo {}; + type bar = {}; + `); + + const instance = new Converter(ast, { + errorOnUnknownASTType: false, + useJSXTextNode: false, + shouldProvideParserServices: true + }); + instance.convertProgram(); + const maps = instance.getASTMaps(); + + function checkMaps(child: any) { + child.forEachChild((node: any) => { + if ( + node.kind !== ts.SyntaxKind.EndOfFileToken && + node.kind !== ts.SyntaxKind.JsxAttributes && + node.kind !== ts.SyntaxKind.VariableDeclaration + ) { + expect(node).toBe( + maps.esTreeNodeToTSNodeMap.get(maps.tsNodeToESTreeNodeMap.get(node)) + ); + } + checkMaps(node); + }); + } + + expect(ast).toBe( + maps.esTreeNodeToTSNodeMap.get(maps.tsNodeToESTreeNodeMap.get(ast)) + ); + checkMaps(ast); + }); + + it('nodeMaps should contain jsx nodes', () => { + const ast = convertCode(``); + + const instance = new Converter(ast, { + errorOnUnknownASTType: false, + useJSXTextNode: false, + shouldProvideParserServices: true + }); + instance.convertProgram(); + const maps = instance.getASTMaps(); + + function checkMaps(child: any) { + child.forEachChild((node: any) => { + if ( + node.kind !== ts.SyntaxKind.EndOfFileToken && + node.kind !== ts.SyntaxKind.JsxAttributes + ) { + expect(node).toBe( + maps.esTreeNodeToTSNodeMap.get(maps.tsNodeToESTreeNodeMap.get(node)) + ); + } + checkMaps(node); + }); + } + + expect(ast).toBe( + maps.esTreeNodeToTSNodeMap.get(maps.tsNodeToESTreeNodeMap.get(ast)) + ); + checkMaps(ast); + }); +}); From f513a143f549f8ccc8ec4851f245364c4542af73 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 4 Feb 2019 11:49:05 -0500 Subject: [PATCH 3/5] feat(*): change TypeScript version range to >=3.2.1 <3.4.0 (#184) --- README.md | 8 +++++--- package.json | 2 +- packages/eslint-plugin/package.json | 2 +- packages/parser/README.md | 2 ++ packages/parser/src/parser-options.ts | 1 + packages/parser/src/parser.ts | 12 ++++++++++++ packages/parser/tests/lib/parser.ts | 21 +++++++++++++++++++++ packages/typescript-estree/package.json | 3 +-- packages/typescript-estree/src/parser.ts | 10 ++++++---- yarn.lock | 8 ++++---- 10 files changed, 54 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 75e75658d06..fb5dbbcabab 100644 --- a/README.md +++ b/README.md @@ -42,11 +42,13 @@ The `canary` (latest master) version is: ## Supported TypeScript Version -We will always endeavor to support the latest stable version of TypeScript. +We will always endeavor to support the latest stable version of TypeScript. Sometimes, but not always, changes in TypeScript will not require breaking changes in this project, and so we are able to support more than one version of TypeScript. -The version of TypeScript currently supported by this parser is `~3.2.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. +**The version range of TypeScript currently supported by this parser is `>=3.2.1 <3.4.0`.** -If you use a non-supported version of TypeScript, the parser will log a warning to the console. +This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. + +If you use a non-supported version of TypeScript, the parser will log a warning to the console. If you want to disable this warning, you can configure this in your `parserOptions`. See: [`@typescript-eslint/parser`](./packages/parser/) and [`@typescript-eslint/typescript-estree`](./packages/typescript-estree/). **Please ensure that you are using a supported version before submitting any issues/bug reports.** diff --git a/package.json b/package.json index a95c4a1a571..db01c0bf521 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,6 @@ "rimraf": "^2.6.3", "ts-jest": "^23.10.4", "tslint": "^5.11.0", - "typescript": "~3.2.1" + "typescript": ">=3.2.1 <3.4.0" } } diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index b0bf9f288e0..e710176c425 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -34,6 +34,6 @@ }, "peerDependencies": { "eslint": "^5.0.0", - "typescript": "~3.2.1" + "typescript": "*" } } diff --git a/packages/parser/README.md b/packages/parser/README.md index d0a6879b4e5..78d17e6388f 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -54,6 +54,8 @@ The following additional configuration options are available by specifying them - **`extraFileExtensions`** - default `undefined`. This option allows you to provide one or more additional file extensions which should be considered in the TypeScript Program compilation. E.g. a `.vue` file +- **`warnOnUnsupportedTypeScriptVersion`** - default `true`. This option allows you to toggle the warning that the parser will give you if you use a version of TypeScript which is not explicitly supported + ### .eslintrc.json ```json diff --git a/packages/parser/src/parser-options.ts b/packages/parser/src/parser-options.ts index 95d6e54c182..d374ac57b91 100644 --- a/packages/parser/src/parser-options.ts +++ b/packages/parser/src/parser-options.ts @@ -17,4 +17,5 @@ export interface ParserOptions { errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; tsconfigRootDir?: string; extraFileExtensions?: string[]; + warnOnUnsupportedTypeScriptVersion?: boolean; } diff --git a/packages/parser/src/parser.ts b/packages/parser/src/parser.ts index 2dd32b38362..be3c3e7506e 100644 --- a/packages/parser/src/parser.ts +++ b/packages/parser/src/parser.ts @@ -75,6 +75,18 @@ export function parseForESLint( } } + /** + * Allow the user to suppress the warning from typescript-estree if they are using an unsupported + * version of TypeScript + */ + const warnOnUnsupportedTypeScriptVersion = validateBoolean( + options.warnOnUnsupportedTypeScriptVersion, + true + ); + if (!warnOnUnsupportedTypeScriptVersion) { + parserOptions.loggerFn = false; + } + const { ast, services } = parseAndGenerateServices(code, parserOptions); ast.sourceType = options.sourceType; diff --git a/packages/parser/tests/lib/parser.ts b/packages/parser/tests/lib/parser.ts index 332be8b6e43..6a844baae22 100644 --- a/packages/parser/tests/lib/parser.ts +++ b/packages/parser/tests/lib/parser.ts @@ -84,4 +84,25 @@ describe('parser', () => { `"Cannot assign to read only property 'ArrayExpression' of object '#'"` ); }); + + it('`warnOnUnsupportedTypeScriptVersion: false` should set `loggerFn: false` on typescript-estree', () => { + const code = 'const valid = true;'; + const spy = jest.spyOn(typescriptESTree, 'parseAndGenerateServices'); + parseForESLint(code, { warnOnUnsupportedTypeScriptVersion: true }); + expect(spy).toHaveBeenCalledWith(code, { + ecmaFeatures: {}, + jsx: false, + sourceType: 'script', + useJSXTextNode: true + }); + parseForESLint(code, { warnOnUnsupportedTypeScriptVersion: false }); + expect(spy).toHaveBeenCalledWith(code, { + ecmaFeatures: {}, + jsx: false, + sourceType: 'script', + useJSXTextNode: true, + loggerFn: false, + warnOnUnsupportedTypeScriptVersion: false + }); + }); }); diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 5c7f52edf27..50432ba4d21 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -42,7 +42,6 @@ "typescript": "*" }, "devDependencies": { - "@typescript-eslint/shared-fixtures": "1.2.0", - "typescript": "~3.2.1" + "@typescript-eslint/shared-fixtures": "1.2.0" } } diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 3c9680df06d..ca3d27db77e 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -18,9 +18,11 @@ import * as es from './typedefs'; import { Extra, ParserOptions } from './parser-options'; import { getFirstSemanticOrSyntacticError } from './semantic-errors'; -const packageJSON = require('../package.json'); - -const SUPPORTED_TYPESCRIPT_VERSIONS = packageJSON.devDependencies.typescript; +/** + * This needs to be kept in sync with the top-level README.md in the + * typescript-eslint monorepo + */ +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.4.0'; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, @@ -287,7 +289,7 @@ interface ParseAndGenerateServicesResult { // Public //------------------------------------------------------------------------------ -export const version: string = packageJSON.version; +export const version: string = require('../package.json').version; export function parse( code: string, diff --git a/yarn.lock b/yarn.lock index 1969160e6c4..51d8518fb37 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7056,10 +7056,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@~3.2.1: - version "3.2.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.2.tgz#fe8101c46aa123f8353523ebdcf5730c2ae493e5" - integrity sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg== +"typescript@>=3.2.1 <3.4.0": + version "3.3.1" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.1.tgz#6de14e1db4b8a006ac535e482c8ba018c55f750b" + integrity sha512-cTmIDFW7O0IHbn1DPYjkiebHxwtCMU+eTy30ZtJNBPF9j2O1ITu5XH2YnBeVRKWHqF+3JQwWJv0Q0aUgX8W7IA== uglify-js@^3.1.4: version "3.4.9" From d4dfa3bb78365222055fb18b266416439c40deaf Mon Sep 17 00:00:00 2001 From: Armano Date: Tue, 5 Feb 2019 00:49:48 +0100 Subject: [PATCH 4/5] fix(ts-estree): fix issues with typeParams in FunctionExpression (#208) --- .../lib/__snapshots__/typescript.ts.snap | 252 +++++++++--------- packages/typescript-estree/src/convert.ts | 52 ++-- packages/typescript-estree/src/typedefs.ts | 1 - .../tests/ast-alignment/utils.ts | 15 ++ .../lib/__snapshots__/typescript.ts.snap | 252 +++++++++--------- 5 files changed, 292 insertions(+), 280 deletions(-) diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index f57d7523a35..a6058f009be 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -11047,13 +11047,13 @@ Object { "line": 2, }, "start": Object { - "column": 16, + "column": 13, "line": 2, }, }, "params": Array [], "range": Array [ - 26, + 23, 32, ], "type": "FunctionExpression", @@ -11180,13 +11180,13 @@ Object { "line": 4, }, "start": Object { - "column": 20, + "column": 17, "line": 4, }, }, "params": Array [], "range": Array [ - 54, + 51, 60, ], "type": "FunctionExpression", @@ -13831,13 +13831,13 @@ Object { "line": 2, }, "start": Object { - "column": 11, + "column": 8, "line": 2, }, }, "params": Array [], "range": Array [ - 23, + 20, 28, ], "type": "FunctionExpression", @@ -14260,13 +14260,13 @@ Object { "line": 2, }, "start": Object { - "column": 17, + "column": 8, "line": 2, }, }, "params": Array [], "range": Array [ - 29, + 20, 34, ], "type": "FunctionExpression", @@ -16112,13 +16112,13 @@ Object { "line": 3, }, "start": Object { - "column": 8, + "column": 5, "line": 3, }, }, "params": Array [], "range": Array [ - 38, + 35, 44, ], "type": "FunctionExpression", @@ -28360,13 +28360,13 @@ Object { "line": 3, }, "start": Object { - "column": 18, + "column": 15, "line": 2, }, }, "params": Array [], "range": Array [ - 28, + 25, 44, ], "returnType": Object { @@ -28527,13 +28527,13 @@ Object { "line": 6, }, "start": Object { - "column": 20, + "column": 17, "line": 5, }, }, "params": Array [], "range": Array [ - 66, + 63, 82, ], "returnType": Object { @@ -58372,60 +58372,6 @@ Object { ], "shorthand": false, "type": "Property", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "T", - "range": Array [ - 30, - 31, - ], - "type": "Identifier", - }, - "range": Array [ - 30, - 31, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 29, - 32, - ], - "type": "TSTypeParameterDeclaration", - }, "value": Object { "async": false, "body": Object { @@ -58492,13 +58438,13 @@ Object { "line": 4, }, "start": Object { - "column": 18, + "column": 15, "line": 2, }, }, "params": Array [], "range": Array [ - 32, + 29, 61, ], "returnType": Object { @@ -58536,6 +58482,60 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "T", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "range": Array [ + 30, + 31, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 29, + 32, + ], + "type": "TSTypeParameterDeclaration", + }, }, }, Object { @@ -58576,60 +58576,6 @@ Object { ], "shorthand": false, "type": "Property", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 5, - "line": 5, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 5, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 5, - }, - }, - "name": "T", - "range": Array [ - 69, - 70, - ], - "type": "Identifier", - }, - "range": Array [ - 69, - 70, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 68, - 71, - ], - "type": "TSTypeParameterDeclaration", - }, "value": Object { "async": false, "body": Object { @@ -58696,13 +58642,13 @@ Object { "line": 7, }, "start": Object { - "column": 8, + "column": 5, "line": 5, }, }, "params": Array [], "range": Array [ - 71, + 68, 100, ], "returnType": Object { @@ -58740,6 +58686,60 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "T", + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + }, + "range": Array [ + 69, + 70, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 68, + 71, + ], + "type": "TSTypeParameterDeclaration", + }, }, }, Object { diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 2a170392030..6f9465c1513 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -468,20 +468,22 @@ export class Converter { } /** - * Uses the current TSNode's end location for its `type` to adjust the location data of the given - * ESTreeNode, which should be the parent of the final typeAnnotation node - * @param typeAnnotationParent The node that will have its location data mutated - * @param node + * Uses the provided range location to adjust the location data of the given Node + * @param result The node that will have its location data mutated + * @param childRange The child node range used to expand location */ - private fixTypeAnnotationParentLocation( - typeAnnotationParent: es.BaseNode, - node: ts.TypeNode + private fixParentLocation( + result: es.BaseNode, + childRange: [number, number] ): void { - typeAnnotationParent.range[1] = node.getEnd(); - typeAnnotationParent.loc.end = getLineAndCharacterFor( - typeAnnotationParent.range[1], - this.ast - ); + if (childRange[0] < result.range[0]) { + result.range[0] = childRange[0]; + result.loc.start = getLineAndCharacterFor(result.range[0], this.ast); + } + if (childRange[1] > result.range[1]) { + result.range[1] = childRange[1]; + result.loc.end = getLineAndCharacterFor(result.range[1], this.ast); + } } /** @@ -713,7 +715,7 @@ export class Converter { node.type, node ); - this.fixTypeAnnotationParentLocation(result.id, node.type); + this.fixParentLocation(result.id, result.id.typeAnnotation.range); } return result; } @@ -893,6 +895,14 @@ export class Converter { method.returnType = this.convertTypeAnnotation(node.type, node); } + // Process typeParameters + if (node.typeParameters && node.typeParameters.length) { + method.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( + node.typeParameters + ); + this.fixParentLocation(method, method.typeParameters.range); + } + let result: | es.Property | es.TSAbstractMethodDefinition @@ -970,19 +980,6 @@ export class Converter { ) { result.kind = 'constructor'; } - - // Process typeParameters - if (node.typeParameters && node.typeParameters.length) { - if (result.type !== AST_NODE_TYPES.Property) { - method.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( - node.typeParameters - ); - } else { - result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( - node.typeParameters - ); - } - } return result; } @@ -1009,6 +1006,7 @@ export class Converter { constructor.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters ); + this.fixParentLocation(constructor, constructor.typeParameters.range); } // Process returnType @@ -1291,7 +1289,7 @@ export class Converter { node.type, node ); - this.fixTypeAnnotationParentLocation(parameter, node.type); + this.fixParentLocation(parameter, parameter.typeAnnotation.range); } if (node.questionToken) { diff --git a/packages/typescript-estree/src/typedefs.ts b/packages/typescript-estree/src/typedefs.ts index 140ed6e09a4..f5fecea9ef7 100644 --- a/packages/typescript-estree/src/typedefs.ts +++ b/packages/typescript-estree/src/typedefs.ts @@ -893,7 +893,6 @@ export interface Property extends BaseNode { method: boolean; shorthand: boolean; kind: 'init'; - typeParameters?: TSTypeParameterDeclaration; } export interface RestElement extends BaseNode { diff --git a/packages/typescript-estree/tests/ast-alignment/utils.ts b/packages/typescript-estree/tests/ast-alignment/utils.ts index ee0a2b7d72f..f00b7d9ad16 100644 --- a/packages/typescript-estree/tests/ast-alignment/utils.ts +++ b/packages/typescript-estree/tests/ast-alignment/utils.ts @@ -251,6 +251,21 @@ export function preprocessBabylonAST(ast: any): any { ) { node.type = 'TSClassImplements'; } + }, + // https://github.com/prettier/prettier/issues/5817 + FunctionExpression(node: any, parent: any) { + if (parent.typeParameters && parent.type === 'Property') { + node.typeParameters = parent.typeParameters; + delete parent.typeParameters; + } + + /** + * babel issue: ranges of typeParameters are not included in FunctionExpression range + */ + if (node.typeParameters) { + node.range[0] = node.typeParameters.range[0]; + node.loc.start = Object.assign({}, node.typeParameters.loc.start); + } } } ); diff --git a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap index 0c1e0c5afe6..b9d07faaa47 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -11023,13 +11023,13 @@ Object { "line": 2, }, "start": Object { - "column": 16, + "column": 13, "line": 2, }, }, "params": Array [], "range": Array [ - 26, + 23, 32, ], "type": "FunctionExpression", @@ -11156,13 +11156,13 @@ Object { "line": 4, }, "start": Object { - "column": 20, + "column": 17, "line": 4, }, }, "params": Array [], "range": Array [ - 54, + 51, 60, ], "type": "FunctionExpression", @@ -13801,13 +13801,13 @@ Object { "line": 2, }, "start": Object { - "column": 11, + "column": 8, "line": 2, }, }, "params": Array [], "range": Array [ - 23, + 20, 28, ], "type": "FunctionExpression", @@ -14229,13 +14229,13 @@ Object { "line": 2, }, "start": Object { - "column": 17, + "column": 8, "line": 2, }, }, "params": Array [], "range": Array [ - 29, + 20, 34, ], "type": "FunctionExpression", @@ -16076,13 +16076,13 @@ Object { "line": 3, }, "start": Object { - "column": 8, + "column": 5, "line": 3, }, }, "params": Array [], "range": Array [ - 38, + 35, 44, ], "type": "FunctionExpression", @@ -28309,13 +28309,13 @@ Object { "line": 3, }, "start": Object { - "column": 18, + "column": 15, "line": 2, }, }, "params": Array [], "range": Array [ - 28, + 25, 44, ], "returnType": Object { @@ -28476,13 +28476,13 @@ Object { "line": 6, }, "start": Object { - "column": 20, + "column": 17, "line": 5, }, }, "params": Array [], "range": Array [ - 66, + 63, 82, ], "returnType": Object { @@ -58224,60 +58224,6 @@ Object { ], "shorthand": false, "type": "Property", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "T", - "range": Array [ - 30, - 31, - ], - "type": "Identifier", - }, - "range": Array [ - 30, - 31, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 29, - 32, - ], - "type": "TSTypeParameterDeclaration", - }, "value": Object { "async": false, "body": Object { @@ -58344,13 +58290,13 @@ Object { "line": 4, }, "start": Object { - "column": 18, + "column": 15, "line": 2, }, }, "params": Array [], "range": Array [ - 32, + 29, 61, ], "returnType": Object { @@ -58388,6 +58334,60 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "T", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "range": Array [ + 30, + 31, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 29, + 32, + ], + "type": "TSTypeParameterDeclaration", + }, }, }, Object { @@ -58428,60 +58428,6 @@ Object { ], "shorthand": false, "type": "Property", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 5, - "line": 5, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 5, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 5, - }, - }, - "name": "T", - "range": Array [ - 69, - 70, - ], - "type": "Identifier", - }, - "range": Array [ - 69, - 70, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 68, - 71, - ], - "type": "TSTypeParameterDeclaration", - }, "value": Object { "async": false, "body": Object { @@ -58548,13 +58494,13 @@ Object { "line": 7, }, "start": Object { - "column": 8, + "column": 5, "line": 5, }, }, "params": Array [], "range": Array [ - 71, + 68, 100, ], "returnType": Object { @@ -58592,6 +58538,60 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "T", + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + }, + "range": Array [ + 69, + 70, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 68, + 71, + ], + "type": "TSTypeParameterDeclaration", + }, }, }, Object { From c1abae9cbe05a6ae750a3ea6dd21e9a71b56bf41 Mon Sep 17 00:00:00 2001 From: Armano Date: Tue, 5 Feb 2019 01:38:55 +0100 Subject: [PATCH 5/5] refactor(ts-estree): improve definition of parameters (#209) - add missing tests for decorators --- .../lib/__snapshots__/typescript.ts.snap | 4876 ++++++++++++----- .../parameter-array-pattern-decorator.src.ts | 3 + .../parameter-object-pattern-decorator.src.ts | 3 + .../parameter-rest-element-decorator.src.ts | 3 + .../decorator-on-function.src.ts | 2 + packages/typescript-estree/src/convert.ts | 15 +- packages/typescript-estree/src/typedefs.ts | 14 +- .../tests/ast-alignment/fixtures-to-test.ts | 10 +- .../semantic-diagnostics-enabled.ts.snap | 15 + .../lib/__snapshots__/typescript.ts.snap | 4872 +++++++++++----- 10 files changed, 7118 insertions(+), 2695 deletions(-) create mode 100644 packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-array-pattern-decorator.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-object-pattern-decorator.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-rest-element-decorator.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-function.src.ts diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index a6058f009be..6f4ae3ff203 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -82288,7 +82288,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-constructor.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-array-pattern-decorator.src 1`] = ` Object { "body": Array [ Object { @@ -82299,198 +82299,55 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 15, + "column": 5, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, - "name": "constructor", + "name": "bar", "range": Array [ - 20, - 31, + 14, + 17, ], "type": "Identifier", }, - "kind": "constructor", + "kind": "method", "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 37, + "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 20, - 113, + 14, + 49, ], "static": false, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [ - Object { - "expression": Object { - "left": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 81, - 85, - ], - "type": "ThisExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 13, - "line": 3, - }, - }, - "name": "title", - "range": Array [ - 86, - 91, - ], - "type": "Identifier", - }, - "range": Array [ - 81, - 91, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 33, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "operator": "=", - "range": Array [ - 81, - 106, - ], - "right": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 33, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "name": "config", - "range": Array [ - 94, - 100, - ], - "type": "Identifier", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 3, - }, - }, - "name": "title", - "range": Array [ - 101, - 106, - ], - "type": "Identifier", - }, - "range": Array [ - 94, - 106, - ], - "type": "MemberExpression", - }, - "type": "AssignmentExpression", - }, - "loc": Object { - "end": Object { - "column": 34, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 81, - 107, - ], - "type": "ExpressionStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 37, + "line": 2, }, "start": Object { - "column": 55, + "column": 35, "line": 2, }, }, "range": Array [ - 71, - 113, + 47, + 49, ], "type": "BlockStatement", }, @@ -82499,11 +82356,11 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 37, + "line": 2, }, "start": Object { - "column": 15, + "column": 5, "line": 2, }, }, @@ -82516,146 +82373,148 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 19, "line": 2, }, "start": Object { - "column": 24, + "column": 15, "line": 2, }, }, - "name": "APP_CONFIG", "range": Array [ - 40, - 50, + 27, + 31, ], - "type": "Identifier", + "raw": "true", + "type": "Literal", + "value": true, }, ], "callee": Object { "loc": Object { "end": Object { - "column": 23, + "column": 14, "line": 2, }, "start": Object { - "column": 17, + "column": 7, "line": 2, }, }, - "name": "Inject", + "name": "special", "range": Array [ - 33, - 39, + 19, + 26, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 35, + "column": 20, "line": 2, }, "start": Object { - "column": 17, + "column": 7, "line": 2, }, }, "range": Array [ - 33, - 51, + 19, + 32, ], "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 35, + "column": 20, "line": 2, }, "start": Object { - "column": 16, + "column": 6, "line": 2, }, }, "range": Array [ + 18, 32, - 51, ], "type": "Decorator", }, ], + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + ], "loc": Object { "end": Object { - "column": 53, + "column": 33, "line": 2, }, "start": Object { - "column": 36, + "column": 21, "line": 2, }, }, - "name": "config", "range": Array [ - 52, - 69, + 33, + 45, ], - "type": "Identifier", + "type": "ArrayPattern", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 53, + "column": 33, "line": 2, }, "start": Object { - "column": 42, + "column": 28, "line": 2, }, }, "range": Array [ - 58, - 69, + 40, + 45, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 53, + "column": 33, "line": 2, }, "start": Object { - "column": 44, + "column": 30, "line": 2, }, }, "range": Array [ - 60, - 69, + 42, + 45, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 53, - "line": 2, - }, - "start": Object { - "column": 44, - "line": 2, - }, - }, - "name": "AppConfig", - "range": Array [ - 60, - 69, - ], - "type": "Identifier", - }, + "type": "TSAnyKeyword", }, }, }, ], "range": Array [ - 31, - 113, + 17, + 49, ], "type": "FunctionExpression", }, @@ -82664,23 +82523,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, "range": Array [ - 14, - 115, + 10, + 51, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 1, }, "start": Object { @@ -82688,17 +82547,17 @@ Object { "line": 1, }, }, - "name": "Service", + "name": "Foo", "range": Array [ 6, - 13, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, @@ -82707,7 +82566,7 @@ Object { }, "range": Array [ 0, - 115, + 51, ], "superClass": null, "type": "ClassDeclaration", @@ -82717,7 +82576,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 4, }, "start": Object { "column": 0, @@ -82726,7 +82585,7 @@ Object { }, "range": Array [ 0, - 116, + 52, ], "sourceType": "module", "tokens": Array [ @@ -82751,7 +82610,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 1, }, "start": Object { @@ -82761,25 +82620,25 @@ Object { }, "range": Array [ 6, - 13, + 9, ], "type": "Identifier", - "value": "Service", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 11, "line": 1, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, "range": Array [ - 14, - 15, + 10, + 11, ], "type": "Punctuator", "value": "{", @@ -82787,35 +82646,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 5, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 20, - 31, + 14, + 17, ], "type": "Identifier", - "value": "constructor", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 6, "line": 2, }, "start": Object { - "column": 15, + "column": 5, "line": 2, }, }, "range": Array [ - 31, - 32, + 17, + 18, ], "type": "Punctuator", "value": "(", @@ -82823,17 +82682,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 7, "line": 2, }, "start": Object { - "column": 16, + "column": 6, "line": 2, }, }, "range": Array [ - 32, - 33, + 18, + 19, ], "type": "Punctuator", "value": "@", @@ -82841,35 +82700,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 14, "line": 2, }, "start": Object { - "column": 17, + "column": 7, "line": 2, }, }, "range": Array [ - 33, - 39, + 19, + 26, ], "type": "Identifier", - "value": "Inject", + "value": "special", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 15, "line": 2, }, "start": Object { - "column": 23, + "column": 14, "line": 2, }, }, "range": Array [ - 39, - 40, + 26, + 27, ], "type": "Punctuator", "value": "(", @@ -82877,35 +82736,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 19, "line": 2, }, "start": Object { - "column": 24, + "column": 15, "line": 2, }, }, "range": Array [ - 40, - 50, + 27, + 31, ], - "type": "Identifier", - "value": "APP_CONFIG", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 20, "line": 2, }, "start": Object { - "column": 34, + "column": 19, "line": 2, }, }, "range": Array [ - 50, - 51, + 31, + 32, ], "type": "Punctuator", "value": ")", @@ -82913,251 +82772,2244 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, + "column": 22, "line": 2, }, "start": Object { - "column": 36, + "column": 21, "line": 2, }, }, "range": Array [ - 52, - 58, + 33, + 34, ], - "type": "Identifier", - "value": "config", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 26, "line": 2, }, "start": Object { - "column": 42, + "column": 23, "line": 2, }, }, "range": Array [ - 58, - 59, + 35, + 38, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 53, + "column": 28, "line": 2, }, "start": Object { - "column": 44, + "column": 27, "line": 2, }, }, "range": Array [ - 60, - 69, + 39, + 40, ], - "type": "Identifier", - "value": "AppConfig", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 54, + "column": 29, "line": 2, }, "start": Object { - "column": 53, + "column": 28, "line": 2, }, }, "range": Array [ - 69, - 70, + 40, + 41, ], "type": "Punctuator", - "value": ")", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 56, + "column": 33, "line": 2, }, "start": Object { - "column": 55, + "column": 30, "line": 2, }, }, "range": Array [ - 71, - 72, + 42, + 45, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 34, + "line": 2, }, "start": Object { - "column": 8, - "line": 3, + "column": 33, + "line": 2, }, }, "range": Array [ - 81, - 85, + 45, + 46, ], - "type": "Keyword", - "value": "this", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 36, + "line": 2, }, "start": Object { - "column": 12, - "line": 3, + "column": 35, + "line": 2, }, }, "range": Array [ - 85, - 86, + 47, + 48, ], "type": "Punctuator", - "value": ".", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 37, + "line": 2, }, "start": Object { - "column": 13, - "line": 3, + "column": 36, + "line": 2, }, }, "range": Array [ - 86, - 91, + 48, + 49, ], - "type": "Identifier", - "value": "title", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 1, "line": 3, }, "start": Object { - "column": 19, + "column": 0, "line": 3, }, }, "range": Array [ - 92, - 93, + 50, + 51, ], "type": "Punctuator", - "value": "=", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-constructor.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 3, - }, + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 113, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 85, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "title", + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + }, + "range": Array [ + 81, + 91, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "operator": "=", + "range": Array [ + 81, + 106, + ], + "right": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "name": "config", + "range": Array [ + 94, + 100, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "name": "title", + "range": Array [ + 101, + 106, + ], + "type": "Identifier", + }, + "range": Array [ + 94, + 106, + ], + "type": "MemberExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 107, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 55, + "line": 2, + }, + }, + "range": Array [ + 71, + 113, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "APP_CONFIG", + "range": Array [ + 40, + 50, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "Inject", + "range": Array [ + 33, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 33, + 51, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 51, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "name": "config", + "range": Array [ + 52, + 69, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 58, + 69, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 60, + 69, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "name": "AppConfig", + "range": Array [ + 60, + 69, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 31, + 113, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 115, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Service", + "range": Array [ + 6, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 115, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 116, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 13, + ], + "type": "Identifier", + "value": "Service", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 33, + 39, + ], + "type": "Identifier", + "value": "Inject", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 50, + ], + "type": "Identifier", + "value": "APP_CONFIG", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 52, + 58, + ], + "type": "Identifier", + "value": "config", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 60, + 69, + ], + "type": "Identifier", + "value": "AppConfig", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 2, + }, + "start": Object { + "column": 55, + "line": 2, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 85, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + "value": "title", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 94, + 100, + ], + "type": "Identifier", + "value": "config", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 101, + 106, + ], + "type": "Identifier", + "value": "title", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 50, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 48, + 50, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 33, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 21, + 28, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 34, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 34, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 35, + 46, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 19, + 50, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 52, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "Identifier", + "value": "special", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 33, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 63, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 61, + 63, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 42, + 46, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 34, + 41, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 34, + 47, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 33, + 47, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 48, + 59, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 51, + 59, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 32, + 63, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 65, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "StaticFoo", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 66, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, "start": Object { - "column": 21, - "line": 3, + "column": 6, + "line": 1, }, }, "range": Array [ - 94, - 100, + 6, + 15, ], "type": "Identifier", - "value": "config", + "value": "StaticFoo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "Identifier", + "value": "special", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { "column": 28, - "line": 3, + "line": 2, }, "start": Object { - "column": 27, - "line": 3, + "column": 24, + "line": 2, }, }, "range": Array [ - 100, - 101, + 42, + 46, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, ], "type": "Punctuator", - "value": ".", + "value": ")", }, Object { "loc": Object { "end": Object { "column": 33, - "line": 3, + "line": 2, }, "start": Object { - "column": 28, - "line": 3, + "column": 30, + "line": 2, }, }, "range": Array [ - 101, - 106, + 48, + 51, ], "type": "Identifier", - "value": "title", + "value": "baz", }, Object { "loc": Object { "end": Object { "column": 34, - "line": 3, + "line": 2, }, "start": Object { "column": 33, - "line": 3, + "line": 2, }, }, "range": Array [ - 106, - 107, + 51, + 52, ], "type": "Punctuator", - "value": ";", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 45, + "line": 2, }, "start": Object { - "column": 4, - "line": 4, + "column": 44, + "line": 2, }, }, "range": Array [ - 112, - 113, + 62, + 63, ], "type": "Punctuator", "value": "}", @@ -83166,16 +85018,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, - "line": 5, + "line": 3, }, }, "range": Array [ - 114, - 115, + 64, + 65, ], "type": "Punctuator", "value": "}", @@ -83185,7 +85037,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-instance-member.src 1`] = ` Object { "body": Array [ Object { @@ -83196,7 +85048,7 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 2, }, "start": Object { @@ -83204,18 +85056,18 @@ Object { "line": 2, }, }, - "name": "bar", + "name": "greet", "range": Array [ - 16, - 19, + 20, + 25, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { "column": 4, @@ -83223,28 +85075,138 @@ Object { }, }, "range": Array [ - 16, - 50, + 20, + 95, ], "static": false, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [], + "body": Array [ + Object { + "argument": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 67, + 75, + ], + "raw": "\\"Hello \\"", + "type": "Literal", + "value": "Hello ", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 67, + 82, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "name", + "range": Array [ + 78, + 82, + ], + "type": "Identifier", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 67, + 88, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 85, + 88, + ], + "raw": "\\"!\\"", + "type": "Literal", + "value": "!", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 60, + 89, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 36, + "column": 34, "line": 2, }, }, "range": Array [ - 48, 50, + 95, ], "type": "BlockStatement", }, @@ -83253,11 +85215,11 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 7, + "column": 9, "line": 2, }, }, @@ -83266,133 +85228,95 @@ Object { "decorators": Array [ Object { "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 29, - 33, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "special", - "range": Array [ - 21, - 28, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 22, + "column": 19, "line": 2, }, "start": Object { - "column": 9, + "column": 11, "line": 2, }, }, + "name": "required", "range": Array [ - 21, - 34, + 27, + 35, ], - "type": "CallExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 22, + "column": 19, "line": 2, }, "start": Object { - "column": 8, + "column": 10, "line": 2, }, }, "range": Array [ - 20, - 34, + 26, + 35, ], "type": "Decorator", }, ], "loc": Object { "end": Object { - "column": 34, + "column": 32, "line": 2, }, "start": Object { - "column": 23, + "column": 20, "line": 2, }, }, - "name": "baz", + "name": "name", "range": Array [ - 35, - 46, + 36, + 48, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 34, + "column": 32, "line": 2, }, "start": Object { - "column": 26, + "column": 24, "line": 2, }, }, "range": Array [ - 38, - 46, + 40, + 48, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 34, + "column": 32, "line": 2, }, "start": Object { - "column": 28, + "column": 26, "line": 2, }, }, "range": Array [ - 40, - 46, + 42, + 48, ], - "type": "TSNumberKeyword", + "type": "TSStringKeyword", }, }, }, ], "range": Array [ - 19, - 50, + 25, + 95, ], "type": "FunctionExpression", }, @@ -83401,23 +85325,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { - "column": 10, + "column": 14, "line": 1, }, }, "range": Array [ - 10, - 52, + 14, + 97, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 1, }, "start": Object { @@ -83425,17 +85349,17 @@ Object { "line": 1, }, }, - "name": "Foo", + "name": "Greeter", "range": Array [ 6, - 9, + 13, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, @@ -83444,7 +85368,7 @@ Object { }, "range": Array [ 0, - 52, + 97, ], "superClass": null, "type": "ClassDeclaration", @@ -83454,7 +85378,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 6, }, "start": Object { "column": 0, @@ -83463,7 +85387,7 @@ Object { }, "range": Array [ 0, - 53, + 98, ], "sourceType": "module", "tokens": Array [ @@ -83488,7 +85412,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 1, }, "start": Object { @@ -83498,25 +85422,25 @@ Object { }, "range": Array [ 6, - 9, + 13, ], "type": "Identifier", - "value": "Foo", + "value": "Greeter", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 15, "line": 1, }, "start": Object { - "column": 10, + "column": 14, "line": 1, }, }, "range": Array [ - 10, - 11, + 14, + 15, ], "type": "Punctuator", "value": "{", @@ -83524,7 +85448,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 2, }, "start": Object { @@ -83533,26 +85457,26 @@ Object { }, }, "range": Array [ - 16, - 19, + 20, + 25, ], "type": "Identifier", - "value": "bar", + "value": "greet", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 2, }, "start": Object { - "column": 7, + "column": 9, "line": 2, }, }, "range": Array [ - 19, - 20, + 25, + 26, ], "type": "Punctuator", "value": "(", @@ -83560,17 +85484,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 2, }, "start": Object { - "column": 8, + "column": 10, "line": 2, }, }, "range": Array [ - 20, - 21, + 26, + 27, ], "type": "Punctuator", "value": "@", @@ -83578,71 +85502,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 19, "line": 2, }, "start": Object { - "column": 9, + "column": 11, "line": 2, }, }, "range": Array [ - 21, - 28, + 27, + 35, ], "type": "Identifier", - "value": "special", + "value": "required", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 24, "line": 2, }, "start": Object { - "column": 16, + "column": 20, "line": 2, }, }, "range": Array [ - 28, - 29, + 36, + 40, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 32, "line": 2, }, "start": Object { - "column": 17, + "column": 26, "line": 2, }, }, "range": Array [ - 29, - 33, + 42, + 48, ], - "type": "Boolean", - "value": "true", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 33, "line": 2, }, "start": Object { - "column": 21, + "column": 32, "line": 2, }, }, "range": Array [ - 33, - 34, + 48, + 49, ], "type": "Punctuator", "value": ")", @@ -83650,107 +85592,161 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, + "column": 35, "line": 2, }, "start": Object { - "column": 23, + "column": 34, "line": 2, }, }, "range": Array [ - 35, - 38, + 50, + 51, ], - "type": "Identifier", - "value": "baz", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 14, + "line": 3, }, "start": Object { - "column": 26, - "line": 2, + "column": 8, + "line": 3, }, }, "range": Array [ - 38, - 39, + 60, + 66, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 67, + 75, + ], + "type": "String", + "value": "\\"Hello \\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 76, + 77, ], "type": "Punctuator", - "value": ":", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 2, + "column": 30, + "line": 3, }, "start": Object { - "column": 28, - "line": 2, + "column": 26, + "line": 3, }, }, "range": Array [ - 40, - 46, + 78, + 82, ], "type": "Identifier", - "value": "number", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 2, + "column": 32, + "line": 3, }, "start": Object { - "column": 34, - "line": 2, + "column": 31, + "line": 3, }, }, "range": Array [ - 46, - 47, + 83, + 84, ], "type": "Punctuator", - "value": ")", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 85, + 88, + ], + "type": "String", + "value": "\\"!\\"", }, Object { "loc": Object { "end": Object { "column": 37, - "line": 2, + "line": 3, }, "start": Object { "column": 36, - "line": 2, + "line": 3, }, }, "range": Array [ - 48, - 49, + 88, + 89, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 37, - "line": 2, + "column": 4, + "line": 4, }, }, "range": Array [ - 49, - 50, + 94, + 95, ], "type": "Punctuator", "value": "}", @@ -83759,16 +85755,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 3, + "line": 5, }, }, "range": Array [ - 51, - 52, + 96, + 97, ], "type": "Punctuator", "value": "}", @@ -83778,7 +85774,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -83789,7 +85785,7 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 2, }, "start": Object { @@ -83797,18 +85793,18 @@ Object { "line": 2, }, }, - "name": "bar", + "name": "greet", "range": Array [ - 29, - 32, + 33, + 38, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 45, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { "column": 4, @@ -83816,28 +85812,138 @@ Object { }, }, "range": Array [ - 22, - 63, + 26, + 108, ], "static": true, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [], + "body": Array [ + Object { + "argument": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 80, + 88, + ], + "raw": "\\"Hello \\"", + "type": "Literal", + "value": "Hello ", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 80, + 95, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "name", + "range": Array [ + 91, + 95, + ], + "type": "Identifier", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 80, + 101, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 98, + 101, + ], + "raw": "\\"!\\"", + "type": "Literal", + "value": "!", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 73, + 102, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { - "column": 45, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 43, + "column": 41, "line": 2, }, }, "range": Array [ - 61, 63, + 108, ], "type": "BlockStatement", }, @@ -83846,11 +85952,11 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 45, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 14, + "column": 16, "line": 2, }, }, @@ -83859,133 +85965,95 @@ Object { "decorators": Array [ Object { "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "range": Array [ - 42, - 46, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "special", - "range": Array [ - 34, - 41, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 29, + "column": 26, "line": 2, }, "start": Object { - "column": 16, + "column": 18, "line": 2, }, }, + "name": "required", "range": Array [ - 34, - 47, + 40, + 48, ], - "type": "CallExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 29, + "column": 26, "line": 2, }, "start": Object { - "column": 15, + "column": 17, "line": 2, }, }, "range": Array [ - 33, - 47, + 39, + 48, ], "type": "Decorator", }, ], "loc": Object { "end": Object { - "column": 41, + "column": 39, "line": 2, }, "start": Object { - "column": 30, + "column": 27, "line": 2, }, }, - "name": "baz", + "name": "name", "range": Array [ - 48, - 59, + 49, + 61, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 39, "line": 2, }, "start": Object { - "column": 33, + "column": 31, "line": 2, }, }, "range": Array [ - 51, - 59, + 53, + 61, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 39, "line": 2, }, "start": Object { - "column": 35, + "column": 33, "line": 2, }, }, "range": Array [ - 53, - 59, + 55, + 61, ], - "type": "TSNumberKeyword", + "type": "TSStringKeyword", }, }, }, ], "range": Array [ - 32, - 63, + 38, + 108, ], "type": "FunctionExpression", }, @@ -83994,23 +86062,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { - "column": 16, + "column": 20, "line": 1, }, }, "range": Array [ - 16, - 65, + 20, + 110, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 15, + "column": 19, "line": 1, }, "start": Object { @@ -84018,17 +86086,17 @@ Object { "line": 1, }, }, - "name": "StaticFoo", + "name": "StaticGreeter", "range": Array [ 6, - 15, + 19, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, @@ -84037,7 +86105,7 @@ Object { }, "range": Array [ 0, - 65, + 110, ], "superClass": null, "type": "ClassDeclaration", @@ -84047,7 +86115,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 6, }, "start": Object { "column": 0, @@ -84056,7 +86124,7 @@ Object { }, "range": Array [ 0, - 66, + 111, ], "sourceType": "module", "tokens": Array [ @@ -84081,7 +86149,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 19, "line": 1, }, "start": Object { @@ -84091,25 +86159,25 @@ Object { }, "range": Array [ 6, - 15, + 19, ], "type": "Identifier", - "value": "StaticFoo", + "value": "StaticGreeter", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 21, "line": 1, }, "start": Object { - "column": 16, + "column": 20, "line": 1, }, }, "range": Array [ - 16, - 17, + 20, + 21, ], "type": "Punctuator", "value": "{", @@ -84126,8 +86194,8 @@ Object { }, }, "range": Array [ - 22, - 28, + 26, + 32, ], "type": "Keyword", "value": "static", @@ -84135,7 +86203,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 2, }, "start": Object { @@ -84144,26 +86212,26 @@ Object { }, }, "range": Array [ - 29, - 32, + 33, + 38, ], "type": "Identifier", - "value": "bar", + "value": "greet", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 2, }, "start": Object { - "column": 14, + "column": 16, "line": 2, }, }, "range": Array [ - 32, - 33, + 38, + 39, ], "type": "Punctuator", "value": "(", @@ -84171,17 +86239,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 18, "line": 2, }, "start": Object { - "column": 15, + "column": 17, "line": 2, }, }, "range": Array [ - 33, - 34, + 39, + 40, ], "type": "Punctuator", "value": "@", @@ -84189,71 +86257,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 26, "line": 2, }, "start": Object { - "column": 16, + "column": 18, "line": 2, }, }, "range": Array [ - 34, - 41, + 40, + 48, ], "type": "Identifier", - "value": "special", + "value": "required", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 31, "line": 2, }, "start": Object { - "column": 23, + "column": 27, "line": 2, }, }, "range": Array [ - 41, - 42, + 49, + 53, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 39, "line": 2, }, "start": Object { - "column": 24, + "column": 33, "line": 2, }, }, "range": Array [ - 42, - 46, + 55, + 61, ], - "type": "Boolean", - "value": "true", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 40, "line": 2, }, "start": Object { - "column": 28, + "column": 39, "line": 2, }, }, "range": Array [ - 46, - 47, + 61, + 62, ], "type": "Punctuator", "value": ")", @@ -84261,107 +86347,161 @@ Object { Object { "loc": Object { "end": Object { - "column": 33, + "column": 42, "line": 2, }, "start": Object { - "column": 30, + "column": 41, "line": 2, }, }, "range": Array [ - 48, - 51, + 63, + 64, ], - "type": "Identifier", - "value": "baz", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 2, + "column": 14, + "line": 3, }, "start": Object { - "column": 33, - "line": 2, + "column": 8, + "line": 3, }, }, "range": Array [ - 51, - 52, + 73, + 79, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 80, + 88, + ], + "type": "String", + "value": "\\"Hello \\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 89, + 90, ], "type": "Punctuator", - "value": ":", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 41, - "line": 2, + "column": 30, + "line": 3, }, "start": Object { - "column": 35, - "line": 2, + "column": 26, + "line": 3, }, }, "range": Array [ - 53, - 59, + 91, + 95, ], "type": "Identifier", - "value": "number", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 2, + "column": 32, + "line": 3, }, "start": Object { - "column": 41, - "line": 2, + "column": 31, + "line": 3, }, }, "range": Array [ - 59, - 60, + 96, + 97, ], "type": "Punctuator", - "value": ")", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 44, - "line": 2, + "column": 36, + "line": 3, }, "start": Object { - "column": 43, - "line": 2, + "column": 33, + "line": 3, }, }, "range": Array [ - 61, - 62, + 98, + 101, + ], + "type": "String", + "value": "\\"!\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 101, + 102, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 45, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 44, - "line": 2, + "column": 4, + "line": 4, }, }, "range": Array [ - 62, - 63, + 107, + 108, ], "type": "Punctuator", "value": "}", @@ -84370,16 +86510,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 3, + "line": 5, }, }, "range": Array [ - 64, - 65, + 109, + 110, ], "type": "Punctuator", "value": "}", @@ -84389,7 +86529,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-instance-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-object-pattern-decorator.src 1`] = ` Object { "body": Array [ Object { @@ -84400,165 +86540,55 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, - "name": "greet", + "name": "bar", "range": Array [ - 20, - 25, + 14, + 17, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 37, + "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 20, - 95, + 14, + 49, ], "static": false, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [ - Object { - "argument": Object { - "left": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 67, - 75, - ], - "raw": "\\"Hello \\"", - "type": "Literal", - "value": "Hello ", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 67, - 82, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "name": "name", - "range": Array [ - 78, - 82, - ], - "type": "Identifier", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 67, - 88, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 85, - 88, - ], - "raw": "\\"!\\"", - "type": "Literal", - "value": "!", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 60, - 89, - ], - "type": "ReturnStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 37, + "line": 2, }, "start": Object { - "column": 34, + "column": 35, "line": 2, }, }, "range": Array [ - 50, - 95, + 47, + 49, ], "type": "BlockStatement", }, @@ -84567,11 +86597,11 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 37, + "line": 2, }, "start": Object { - "column": 9, + "column": 5, "line": 2, }, }, @@ -84580,95 +86610,191 @@ Object { "decorators": Array [ Object { "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 2, }, "start": Object { - "column": 11, + "column": 7, "line": 2, }, }, - "name": "required", "range": Array [ - 27, - 35, + 19, + 32, ], - "type": "Identifier", + "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 2, }, "start": Object { - "column": 10, + "column": 6, "line": 2, }, }, "range": Array [ - 26, - 35, + 18, + 32, ], "type": "Decorator", }, ], "loc": Object { "end": Object { - "column": 32, + "column": 33, "line": 2, }, "start": Object { - "column": 20, + "column": 21, "line": 2, }, }, - "name": "name", + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 35, + 38, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + }, + ], "range": Array [ - 36, - 48, + 33, + 45, ], - "type": "Identifier", + "type": "ObjectPattern", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 32, + "column": 33, "line": 2, }, "start": Object { - "column": 24, + "column": 28, "line": 2, }, }, "range": Array [ 40, - 48, + 45, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 32, + "column": 33, "line": 2, }, "start": Object { - "column": 26, + "column": 30, "line": 2, }, }, "range": Array [ 42, - 48, + 45, ], - "type": "TSStringKeyword", + "type": "TSAnyKeyword", }, }, }, ], "range": Array [ - 25, - 95, + 17, + 49, ], "type": "FunctionExpression", }, @@ -84677,23 +86803,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, "range": Array [ - 14, - 97, + 10, + 51, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 1, }, "start": Object { @@ -84701,17 +86827,17 @@ Object { "line": 1, }, }, - "name": "Greeter", + "name": "Foo", "range": Array [ 6, - 13, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, @@ -84720,7 +86846,7 @@ Object { }, "range": Array [ 0, - 97, + 51, ], "superClass": null, "type": "ClassDeclaration", @@ -84730,7 +86856,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 4, }, "start": Object { "column": 0, @@ -84739,7 +86865,7 @@ Object { }, "range": Array [ 0, - 98, + 52, ], "sourceType": "module", "tokens": Array [ @@ -84764,7 +86890,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 1, }, "start": Object { @@ -84774,25 +86900,25 @@ Object { }, "range": Array [ 6, - 13, + 9, ], "type": "Identifier", - "value": "Greeter", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 11, "line": 1, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, "range": Array [ - 14, - 15, + 10, + 11, ], "type": "Punctuator", "value": "{", @@ -84800,35 +86926,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 20, - 25, + 14, + 17, ], "type": "Identifier", - "value": "greet", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 6, "line": 2, }, "start": Object { - "column": 9, + "column": 5, "line": 2, }, }, "range": Array [ - 25, - 26, + 17, + 18, ], "type": "Punctuator", "value": "(", @@ -84836,17 +86962,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 7, "line": 2, }, "start": Object { - "column": 10, + "column": 6, "line": 2, }, }, "range": Array [ - 26, - 27, + 18, + 19, ], "type": "Punctuator", "value": "@", @@ -84854,89 +86980,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 27, - 35, - ], - "type": "Identifier", - "value": "required", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, + "column": 14, "line": 2, }, "start": Object { - "column": 20, + "column": 7, "line": 2, }, }, "range": Array [ - 36, - 40, + 19, + 26, ], "type": "Identifier", - "value": "name", + "value": "special", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 15, "line": 2, }, "start": Object { - "column": 24, + "column": 14, "line": 2, }, }, "range": Array [ - 40, - 41, + 26, + 27, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 19, "line": 2, }, "start": Object { - "column": 26, + "column": 15, "line": 2, }, }, "range": Array [ - 42, - 48, + 27, + 31, ], - "type": "Identifier", - "value": "string", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 20, "line": 2, }, "start": Object { - "column": 32, + "column": 19, "line": 2, }, }, "range": Array [ - 48, - 49, + 31, + 32, ], "type": "Punctuator", "value": ")", @@ -84944,17 +87052,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 22, "line": 2, }, "start": Object { - "column": 34, + "column": 21, "line": 2, }, }, "range": Array [ - 50, - 51, + 33, + 34, ], "type": "Punctuator", "value": "{", @@ -84962,143 +87070,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 26, + "line": 2, }, "start": Object { - "column": 8, - "line": 3, + "column": 23, + "line": 2, }, }, "range": Array [ - 60, - 66, + 35, + 38, ], - "type": "Keyword", - "value": "return", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 28, + "line": 2, }, "start": Object { - "column": 15, - "line": 3, + "column": 27, + "line": 2, }, }, "range": Array [ - 67, - 75, + 39, + 40, ], - "type": "String", - "value": "\\"Hello \\"", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 3, + "column": 29, + "line": 2, }, "start": Object { - "column": 24, - "line": 3, + "column": 28, + "line": 2, }, }, "range": Array [ - 76, - 77, + 40, + 41, ], "type": "Punctuator", - "value": "+", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 3, + "column": 33, + "line": 2, }, "start": Object { - "column": 26, - "line": 3, + "column": 30, + "line": 2, }, }, "range": Array [ - 78, - 82, + 42, + 45, ], "type": "Identifier", - "value": "name", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 3, + "column": 34, + "line": 2, }, "start": Object { - "column": 31, - "line": 3, + "column": 33, + "line": 2, }, }, "range": Array [ - 83, - 84, + 45, + 46, ], "type": "Punctuator", - "value": "+", + "value": ")", }, Object { "loc": Object { "end": Object { "column": 36, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 85, - 88, - ], - "type": "String", - "value": "\\"!\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 3, + "line": 2, }, "start": Object { - "column": 36, - "line": 3, + "column": 35, + "line": 2, }, }, "range": Array [ - 88, - 89, + 47, + 48, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 37, + "line": 2, }, - "start": Object { - "column": 4, - "line": 4, + "start": Object { + "column": 36, + "line": 2, }, }, "range": Array [ - 94, - 95, + 48, + 49, ], "type": "Punctuator", "value": "}", @@ -85107,16 +87197,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, - "line": 5, + "line": 3, }, }, "range": Array [ - 96, - 97, + 50, + 51, ], "type": "Punctuator", "value": "}", @@ -85126,7 +87216,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-rest-element-decorator.src 1`] = ` Object { "body": Array [ Object { @@ -85137,165 +87227,55 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 16, + "column": 5, "line": 2, }, "start": Object { - "column": 11, + "column": 2, "line": 2, }, }, - "name": "greet", + "name": "bar", "range": Array [ - 33, - 38, + 14, + 17, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 26, - 108, + 14, + 48, ], - "static": true, + "static": false, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [ - Object { - "argument": Object { - "left": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 80, - 88, - ], - "raw": "\\"Hello \\"", - "type": "Literal", - "value": "Hello ", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 80, - 95, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "name": "name", - "range": Array [ - 91, - 95, - ], - "type": "Identifier", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 80, - 101, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 98, - 101, - ], - "raw": "\\"!\\"", - "type": "Literal", - "value": "!", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 73, - 102, - ], - "type": "ReturnStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 2, }, "start": Object { - "column": 41, + "column": 34, "line": 2, }, }, "range": Array [ - 63, - 108, + 46, + 48, ], "type": "BlockStatement", }, @@ -85304,108 +87284,163 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 2, }, "start": Object { - "column": 16, + "column": 5, "line": 2, }, }, "params": Array [ Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 36, + 39, + ], + "type": "Identifier", + }, "decorators": Array [ Object { "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 26, + "column": 20, "line": 2, }, "start": Object { - "column": 18, + "column": 7, "line": 2, }, }, - "name": "required", "range": Array [ - 40, - 48, + 19, + 32, ], - "type": "Identifier", + "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 26, + "column": 20, "line": 2, }, "start": Object { - "column": 17, + "column": 6, "line": 2, }, }, "range": Array [ - 39, - 48, + 18, + 32, ], "type": "Decorator", }, ], "loc": Object { "end": Object { - "column": 39, + "column": 32, "line": 2, }, "start": Object { - "column": 27, + "column": 6, "line": 2, }, }, - "name": "name", "range": Array [ - 49, - 61, + 18, + 44, ], - "type": "Identifier", + "type": "RestElement", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 39, + "column": 32, "line": 2, }, "start": Object { - "column": 31, + "column": 27, "line": 2, }, }, "range": Array [ - 53, - 61, + 39, + 44, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 39, + "column": 32, "line": 2, }, "start": Object { - "column": 33, + "column": 29, "line": 2, }, }, "range": Array [ - 55, - 61, + 41, + 44, ], - "type": "TSStringKeyword", + "type": "TSAnyKeyword", }, }, }, ], "range": Array [ - 38, - 108, + 17, + 48, ], "type": "FunctionExpression", }, @@ -85414,23 +87449,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { - "column": 20, + "column": 10, "line": 1, }, }, "range": Array [ - 20, - 110, + 10, + 50, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 19, + "column": 9, "line": 1, }, "start": Object { @@ -85438,17 +87473,17 @@ Object { "line": 1, }, }, - "name": "StaticGreeter", + "name": "Foo", "range": Array [ 6, - 19, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, @@ -85457,7 +87492,7 @@ Object { }, "range": Array [ 0, - 110, + 50, ], "superClass": null, "type": "ClassDeclaration", @@ -85467,7 +87502,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 4, }, "start": Object { "column": 0, @@ -85476,7 +87511,7 @@ Object { }, "range": Array [ 0, - 111, + 51, ], "sourceType": "module", "tokens": Array [ @@ -85501,7 +87536,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 9, "line": 1, }, "start": Object { @@ -85511,25 +87546,25 @@ Object { }, "range": Array [ 6, - 19, + 9, ], "type": "Identifier", - "value": "StaticGreeter", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 11, "line": 1, }, "start": Object { - "column": 20, + "column": 10, "line": 1, }, }, "range": Array [ - 20, - 21, + 10, + 11, ], "type": "Punctuator", "value": "{", @@ -85537,53 +87572,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 26, - 32, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, + "column": 5, "line": 2, }, "start": Object { - "column": 11, + "column": 2, "line": 2, }, }, "range": Array [ - 33, - 38, + 14, + 17, ], "type": "Identifier", - "value": "greet", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 6, "line": 2, }, "start": Object { - "column": 16, + "column": 5, "line": 2, }, }, "range": Array [ - 38, - 39, + 17, + 18, ], "type": "Punctuator", "value": "(", @@ -85591,17 +87608,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 7, "line": 2, }, "start": Object { - "column": 17, + "column": 6, "line": 2, }, }, "range": Array [ - 39, - 40, + 18, + 19, ], "type": "Punctuator", "value": "@", @@ -85609,89 +87626,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 40, - 48, - ], - "type": "Identifier", - "value": "required", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, + "column": 14, "line": 2, }, "start": Object { - "column": 27, + "column": 7, "line": 2, }, }, "range": Array [ - 49, - 53, + 19, + 26, ], "type": "Identifier", - "value": "name", + "value": "special", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 15, "line": 2, }, "start": Object { - "column": 31, + "column": 14, "line": 2, }, }, "range": Array [ - 53, - 54, + 26, + 27, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 19, "line": 2, }, "start": Object { - "column": 33, + "column": 15, "line": 2, }, }, "range": Array [ - 55, - 61, + 27, + 31, ], - "type": "Identifier", - "value": "string", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 20, "line": 2, }, "start": Object { - "column": 39, + "column": 19, "line": 2, }, }, "range": Array [ - 61, - 62, + 31, + 32, ], "type": "Punctuator", "value": ")", @@ -85699,161 +87698,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, + "column": 24, "line": 2, }, "start": Object { - "column": 41, + "column": 21, "line": 2, }, }, "range": Array [ - 63, - 64, + 33, + 36, ], "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 73, - 79, - ], - "type": "Keyword", - "value": "return", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 27, + "line": 2, }, "start": Object { - "column": 15, - "line": 3, + "column": 24, + "line": 2, }, }, "range": Array [ - 80, - 88, + 36, + 39, ], - "type": "String", - "value": "\\"Hello \\"", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 3, + "column": 28, + "line": 2, }, "start": Object { - "column": 24, - "line": 3, + "column": 27, + "line": 2, }, }, "range": Array [ - 89, - 90, + 39, + 40, ], "type": "Punctuator", - "value": "+", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 3, + "column": 32, + "line": 2, }, "start": Object { - "column": 26, - "line": 3, + "column": 29, + "line": 2, }, }, "range": Array [ - 91, - 95, + 41, + 44, ], "type": "Identifier", - "value": "name", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 3, + "column": 33, + "line": 2, }, "start": Object { - "column": 31, - "line": 3, + "column": 32, + "line": 2, }, }, "range": Array [ - 96, - 97, + 44, + 45, ], "type": "Punctuator", - "value": "+", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 98, - 101, - ], - "type": "String", - "value": "\\"!\\"", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 3, + "column": 35, + "line": 2, }, "start": Object { - "column": 36, - "line": 3, + "column": 34, + "line": 2, }, }, "range": Array [ - 101, - 102, + 46, + 47, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 2, }, "start": Object { - "column": 4, - "line": 4, + "column": 35, + "line": 2, }, }, "range": Array [ - 107, - 108, + 47, + 48, ], "type": "Punctuator", "value": "}", @@ -85862,16 +87825,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, - "line": 5, + "line": 3, }, }, "range": Array [ - 109, - 110, + 49, + 50, ], "type": "Punctuator", "value": "}", @@ -89263,6 +91226,233 @@ Object { } `; +exports[`typescript fixtures/errorRecovery/decorator-on-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "b", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 19, + ], + "type": "FunctionDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "Identifier", + "value": "dec", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 5, + 13, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/errorRecovery/decorator-on-interface-declaration.src 1`] = ` Object { "body": Array [ diff --git a/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-array-pattern-decorator.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-array-pattern-decorator.src.ts new file mode 100644 index 00000000000..81dfc005fc9 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-array-pattern-decorator.src.ts @@ -0,0 +1,3 @@ +class Foo { + bar(@special(true) [ bar ]: any) {} +} diff --git a/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-object-pattern-decorator.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-object-pattern-decorator.src.ts new file mode 100644 index 00000000000..dc9133b3dea --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-object-pattern-decorator.src.ts @@ -0,0 +1,3 @@ +class Foo { + bar(@special(true) { bar }: any) {} +} diff --git a/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-rest-element-decorator.src.ts b/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-rest-element-decorator.src.ts new file mode 100644 index 00000000000..35b2ac60bc9 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/decorators/parameter-decorators/parameter-rest-element-decorator.src.ts @@ -0,0 +1,3 @@ +class Foo { + bar(@special(true) ...foo: any) {} +} diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-function.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-function.src.ts new file mode 100644 index 00000000000..72ed3035b15 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/decorator-on-function.src.ts @@ -0,0 +1,2 @@ +@dec +function b(){} diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 6f9465c1513..eb2e69a60ec 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -282,18 +282,19 @@ export class Converter { */ private convertParameters( parameters: ts.NodeArray - ): (es.TSParameterProperty | es.RestElement | es.AssignmentPattern)[] { + ): es.Parameter[] { if (!parameters || !parameters.length) { return []; } return parameters.map(param => { - const convertedParam = this.convertChild(param); - if (!param.decorators || !param.decorators.length) { - return convertedParam; + const convertedParam = this.convertChild(param) as es.Parameter; + + if (param.decorators && param.decorators.length) { + convertedParam.decorators = param.decorators.map(el => + this.convertChild(el) + ); } - return Object.assign(convertedParam, { - decorators: param.decorators.map(el => this.convertChild(el)) - }); + return convertedParam; }); } diff --git a/packages/typescript-estree/src/typedefs.ts b/packages/typescript-estree/src/typedefs.ts index f5fecea9ef7..a9a100e6462 100644 --- a/packages/typescript-estree/src/typedefs.ts +++ b/packages/typescript-estree/src/typedefs.ts @@ -351,7 +351,13 @@ export type ObjectLiteralElementLike = | RestElement | SpreadElement | TSAbstractMethodDefinition; -export type Parameter = AssignmentPattern | RestElement | TSParameterProperty; +export type Parameter = + | AssignmentPattern + | RestElement + | ArrayPattern + | ObjectPattern + | Identifier + | TSParameterProperty; export type PrimaryExpression = | ArrayExpression | ArrayPattern @@ -541,6 +547,7 @@ export interface ArrayPattern extends BaseNode { elements: Expression[]; typeAnnotation?: TSTypeAnnotation; optional?: boolean; + decorators?: Decorator[]; } export interface ArrowFunctionExpression extends BaseNode { @@ -565,6 +572,7 @@ export interface AssignmentPattern extends BaseNode { right?: Expression; typeAnnotation?: TSTypeAnnotation; optional?: boolean; + decorators?: Decorator[]; } export interface AwaitExpression extends BaseNode { @@ -715,6 +723,7 @@ export interface Identifier extends BaseNode { name: string; typeAnnotation?: TSTypeAnnotation; optional?: boolean; + decorators?: Decorator[]; } export interface IfStatement extends BaseNode { @@ -875,6 +884,7 @@ export interface ObjectPattern extends BaseNode { properties: ObjectLiteralElementLike[]; typeAnnotation?: TSTypeAnnotation; optional?: boolean; + decorators?: Decorator[]; } export interface Program extends BaseNode { @@ -901,6 +911,7 @@ export interface RestElement extends BaseNode { typeAnnotation?: TSTypeAnnotation; optional?: boolean; value?: AssignmentPattern; + decorators?: Decorator[]; } export interface ReturnStatement extends BaseNode { @@ -1218,6 +1229,7 @@ export interface TSParameterProperty extends BaseNode { static?: boolean; export?: boolean; parameter: AssignmentPattern | BindingName | RestElement; + decorators?: Decorator[]; } export interface TSParenthesizedType extends BaseNode { diff --git a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts index e92f68f968f..e8dcf0aca78 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -396,7 +396,15 @@ tester.addFixturePatternConfig('typescript/decorators/method-decorators', { fileType: 'ts' }); tester.addFixturePatternConfig('typescript/decorators/parameter-decorators', { - fileType: 'ts' + fileType: 'ts', + ignore: [ + /** + * babel does not support decorators on array and rest parameters + * TODO: report this to babel + */ + 'parameter-array-pattern-decorator', + 'parameter-rest-element-decorator' + ] }); tester.addFixturePatternConfig('typescript/decorators/property-decorators', { fileType: 'ts' diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap index 842757edb3d..dde844c7e15 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap @@ -2236,6 +2236,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/method-decorators/method-decorator-static-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-array-pattern-decorator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -2246,6 +2248,10 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-object-pattern-decorator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-rest-element-decorator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -2299,6 +2305,15 @@ Object { } `; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/decorator-on-function.src 1`] = ` +Object { + "column": 0, + "index": 0, + "lineNumber": 1, + "message": "Decorators are not valid here.", +} +`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/decorator-on-interface-declaration.src 1`] = ` Object { "column": 0, diff --git a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap index b9d07faaa47..d1040b3b295 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -81613,7 +81613,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-constructor.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-array-pattern-decorator.src 1`] = ` Object { "body": Array [ Object { @@ -81624,198 +81624,55 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 15, + "column": 5, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, - "name": "constructor", + "name": "bar", "range": Array [ - 20, - 31, + 14, + 17, ], "type": "Identifier", }, - "kind": "constructor", + "kind": "method", "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 37, + "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 20, - 113, + 14, + 49, ], "static": false, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [ - Object { - "expression": Object { - "left": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 81, - 85, - ], - "type": "ThisExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 13, - "line": 3, - }, - }, - "name": "title", - "range": Array [ - 86, - 91, - ], - "type": "Identifier", - }, - "range": Array [ - 81, - 91, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 33, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "operator": "=", - "range": Array [ - 81, - 106, - ], - "right": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 33, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "name": "config", - "range": Array [ - 94, - 100, - ], - "type": "Identifier", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 3, - }, - }, - "name": "title", - "range": Array [ - 101, - 106, - ], - "type": "Identifier", - }, - "range": Array [ - 94, - 106, - ], - "type": "MemberExpression", - }, - "type": "AssignmentExpression", - }, - "loc": Object { - "end": Object { - "column": 34, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 81, - 107, - ], - "type": "ExpressionStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 37, + "line": 2, }, "start": Object { - "column": 55, + "column": 35, "line": 2, }, }, "range": Array [ - 71, - 113, + 47, + 49, ], "type": "BlockStatement", }, @@ -81824,11 +81681,11 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 37, + "line": 2, }, "start": Object { - "column": 15, + "column": 5, "line": 2, }, }, @@ -81841,146 +81698,148 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 19, "line": 2, }, "start": Object { - "column": 24, + "column": 15, "line": 2, }, }, - "name": "APP_CONFIG", "range": Array [ - 40, - 50, + 27, + 31, ], - "type": "Identifier", + "raw": "true", + "type": "Literal", + "value": true, }, ], "callee": Object { "loc": Object { "end": Object { - "column": 23, + "column": 14, "line": 2, }, "start": Object { - "column": 17, + "column": 7, "line": 2, }, }, - "name": "Inject", + "name": "special", "range": Array [ - 33, - 39, + 19, + 26, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 35, + "column": 20, "line": 2, }, "start": Object { - "column": 17, + "column": 7, "line": 2, }, }, "range": Array [ - 33, - 51, + 19, + 32, ], "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 35, + "column": 20, "line": 2, }, "start": Object { - "column": 16, + "column": 6, "line": 2, }, }, "range": Array [ + 18, 32, - 51, ], "type": "Decorator", }, ], + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + ], "loc": Object { "end": Object { - "column": 53, + "column": 33, "line": 2, }, "start": Object { - "column": 36, + "column": 21, "line": 2, }, }, - "name": "config", "range": Array [ - 52, - 69, + 33, + 45, ], - "type": "Identifier", + "type": "ArrayPattern", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 53, + "column": 33, "line": 2, }, "start": Object { - "column": 42, + "column": 28, "line": 2, }, }, "range": Array [ - 58, - 69, + 40, + 45, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 53, + "column": 33, "line": 2, }, "start": Object { - "column": 44, + "column": 30, "line": 2, }, }, "range": Array [ - 60, - 69, + 42, + 45, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 53, - "line": 2, - }, - "start": Object { - "column": 44, - "line": 2, - }, - }, - "name": "AppConfig", - "range": Array [ - 60, - 69, - ], - "type": "Identifier", - }, + "type": "TSAnyKeyword", }, }, }, ], "range": Array [ - 31, - 113, + 17, + 49, ], "type": "FunctionExpression", }, @@ -81989,23 +81848,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, "range": Array [ - 14, - 115, + 10, + 51, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 1, }, "start": Object { @@ -82013,17 +81872,17 @@ Object { "line": 1, }, }, - "name": "Service", + "name": "Foo", "range": Array [ 6, - 13, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, @@ -82032,7 +81891,7 @@ Object { }, "range": Array [ 0, - 115, + 51, ], "superClass": null, "type": "ClassDeclaration", @@ -82041,7 +81900,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 4, }, "start": Object { "column": 0, @@ -82050,7 +81909,7 @@ Object { }, "range": Array [ 0, - 116, + 52, ], "sourceType": "script", "tokens": Array [ @@ -82075,7 +81934,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 1, }, "start": Object { @@ -82085,25 +81944,25 @@ Object { }, "range": Array [ 6, - 13, + 9, ], "type": "Identifier", - "value": "Service", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 11, "line": 1, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, "range": Array [ - 14, - 15, + 10, + 11, ], "type": "Punctuator", "value": "{", @@ -82111,35 +81970,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 5, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 20, - 31, + 14, + 17, ], "type": "Identifier", - "value": "constructor", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 6, "line": 2, }, "start": Object { - "column": 15, + "column": 5, "line": 2, }, }, "range": Array [ - 31, - 32, + 17, + 18, ], "type": "Punctuator", "value": "(", @@ -82147,17 +82006,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 7, "line": 2, }, "start": Object { - "column": 16, + "column": 6, "line": 2, }, }, "range": Array [ - 32, - 33, + 18, + 19, ], "type": "Punctuator", "value": "@", @@ -82165,35 +82024,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 14, "line": 2, }, "start": Object { - "column": 17, + "column": 7, "line": 2, }, }, "range": Array [ - 33, - 39, + 19, + 26, ], "type": "Identifier", - "value": "Inject", + "value": "special", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 15, "line": 2, }, "start": Object { - "column": 23, + "column": 14, "line": 2, }, }, "range": Array [ - 39, - 40, + 26, + 27, ], "type": "Punctuator", "value": "(", @@ -82201,35 +82060,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 19, "line": 2, }, "start": Object { - "column": 24, + "column": 15, "line": 2, }, }, "range": Array [ - 40, - 50, + 27, + 31, ], - "type": "Identifier", - "value": "APP_CONFIG", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 20, "line": 2, }, "start": Object { - "column": 34, + "column": 19, "line": 2, }, }, "range": Array [ - 50, - 51, + 31, + 32, ], "type": "Punctuator", "value": ")", @@ -82237,251 +82096,2241 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, + "column": 22, "line": 2, }, "start": Object { - "column": 36, + "column": 21, "line": 2, }, }, "range": Array [ - 52, - 58, + 33, + 34, ], - "type": "Identifier", - "value": "config", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 26, "line": 2, }, "start": Object { - "column": 42, + "column": 23, "line": 2, }, }, "range": Array [ - 58, - 59, + 35, + 38, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 53, + "column": 28, "line": 2, }, "start": Object { - "column": 44, + "column": 27, "line": 2, }, }, "range": Array [ - 60, - 69, + 39, + 40, ], - "type": "Identifier", - "value": "AppConfig", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 54, + "column": 29, "line": 2, }, "start": Object { - "column": 53, + "column": 28, "line": 2, }, }, "range": Array [ - 69, - 70, + 40, + 41, ], "type": "Punctuator", - "value": ")", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 56, + "column": 33, "line": 2, }, "start": Object { - "column": 55, + "column": 30, "line": 2, }, }, "range": Array [ - 71, - 72, + 42, + 45, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 34, + "line": 2, }, "start": Object { - "column": 8, - "line": 3, + "column": 33, + "line": 2, }, }, "range": Array [ - 81, - 85, + 45, + 46, ], - "type": "Keyword", - "value": "this", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 36, + "line": 2, }, "start": Object { - "column": 12, - "line": 3, + "column": 35, + "line": 2, }, }, "range": Array [ - 85, - 86, + 47, + 48, ], "type": "Punctuator", - "value": ".", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 37, + "line": 2, }, "start": Object { - "column": 13, - "line": 3, + "column": 36, + "line": 2, }, }, "range": Array [ - 86, - 91, + 48, + 49, ], - "type": "Identifier", - "value": "title", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 1, "line": 3, }, "start": Object { - "column": 19, + "column": 0, "line": 3, }, }, "range": Array [ - 92, - 93, + 50, + 51, ], "type": "Punctuator", - "value": "=", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-constructor.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 3, - }, + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 113, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 85, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "title", + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + }, + "range": Array [ + 81, + 91, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "operator": "=", + "range": Array [ + 81, + 106, + ], + "right": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "name": "config", + "range": Array [ + 94, + 100, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "name": "title", + "range": Array [ + 101, + 106, + ], + "type": "Identifier", + }, + "range": Array [ + 94, + 106, + ], + "type": "MemberExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 107, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 55, + "line": 2, + }, + }, + "range": Array [ + 71, + 113, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "APP_CONFIG", + "range": Array [ + 40, + 50, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "Inject", + "range": Array [ + 33, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 33, + 51, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 51, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "name": "config", + "range": Array [ + 52, + 69, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 58, + 69, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 60, + 69, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "name": "AppConfig", + "range": Array [ + 60, + 69, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 31, + 113, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 115, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Service", + "range": Array [ + 6, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 115, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 116, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 13, + ], + "type": "Identifier", + "value": "Service", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 33, + 39, + ], + "type": "Identifier", + "value": "Inject", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 50, + ], + "type": "Identifier", + "value": "APP_CONFIG", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 52, + 58, + ], + "type": "Identifier", + "value": "config", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 60, + 69, + ], + "type": "Identifier", + "value": "AppConfig", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 2, + }, + "start": Object { + "column": 55, + "line": 2, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 85, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + "value": "title", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 94, + 100, + ], + "type": "Identifier", + "value": "config", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 101, + 106, + ], + "type": "Identifier", + "value": "title", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 50, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 48, + 50, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 33, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 21, + 28, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 34, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 34, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 35, + 46, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 19, + 50, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 52, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "Identifier", + "value": "special", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 33, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 63, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 61, + 63, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 42, + 46, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 34, + 41, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 34, + 47, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 33, + 47, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 48, + 59, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 51, + 59, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 32, + 63, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 65, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "StaticFoo", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 66, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, "start": Object { - "column": 21, - "line": 3, + "column": 6, + "line": 1, }, }, "range": Array [ - 94, - 100, + 6, + 15, ], "type": "Identifier", - "value": "config", + "value": "StaticFoo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "Identifier", + "value": "special", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { "column": 28, - "line": 3, + "line": 2, }, "start": Object { - "column": 27, - "line": 3, + "column": 24, + "line": 2, }, }, "range": Array [ - 100, - 101, + 42, + 46, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, ], "type": "Punctuator", - "value": ".", + "value": ")", }, Object { "loc": Object { "end": Object { "column": 33, - "line": 3, + "line": 2, }, "start": Object { - "column": 28, - "line": 3, + "column": 30, + "line": 2, }, }, "range": Array [ - 101, - 106, + 48, + 51, ], "type": "Identifier", - "value": "title", + "value": "baz", }, Object { "loc": Object { "end": Object { "column": 34, - "line": 3, + "line": 2, }, "start": Object { "column": 33, - "line": 3, + "line": 2, }, }, "range": Array [ - 106, - 107, + 51, + 52, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 61, + 62, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 45, + "line": 2, }, "start": Object { - "column": 4, - "line": 4, + "column": 44, + "line": 2, }, }, "range": Array [ - 112, - 113, + 62, + 63, ], "type": "Punctuator", "value": "}", @@ -82490,16 +84339,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, - "line": 5, + "line": 3, }, }, "range": Array [ - 114, - 115, + 64, + 65, ], "type": "Punctuator", "value": "}", @@ -82509,7 +84358,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-instance-member.src 1`] = ` Object { "body": Array [ Object { @@ -82520,7 +84369,7 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 2, }, "start": Object { @@ -82528,18 +84377,18 @@ Object { "line": 2, }, }, - "name": "bar", + "name": "greet", "range": Array [ - 16, - 19, + 20, + 25, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { "column": 4, @@ -82547,28 +84396,138 @@ Object { }, }, "range": Array [ - 16, - 50, + 20, + 95, ], "static": false, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [], + "body": Array [ + Object { + "argument": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 67, + 75, + ], + "raw": "\\"Hello \\"", + "type": "Literal", + "value": "Hello ", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 67, + 82, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "name", + "range": Array [ + 78, + 82, + ], + "type": "Identifier", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 67, + 88, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 85, + 88, + ], + "raw": "\\"!\\"", + "type": "Literal", + "value": "!", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 60, + 89, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 36, + "column": 34, "line": 2, }, }, "range": Array [ - 48, 50, + 95, ], "type": "BlockStatement", }, @@ -82577,11 +84536,11 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 7, + "column": 9, "line": 2, }, }, @@ -82590,133 +84549,95 @@ Object { "decorators": Array [ Object { "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 29, - 33, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "special", - "range": Array [ - 21, - 28, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 22, + "column": 19, "line": 2, }, "start": Object { - "column": 9, + "column": 11, "line": 2, }, }, + "name": "required", "range": Array [ - 21, - 34, + 27, + 35, ], - "type": "CallExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 22, + "column": 19, "line": 2, }, "start": Object { - "column": 8, + "column": 10, "line": 2, }, }, "range": Array [ - 20, - 34, + 26, + 35, ], "type": "Decorator", }, ], "loc": Object { "end": Object { - "column": 34, + "column": 32, "line": 2, }, "start": Object { - "column": 23, + "column": 20, "line": 2, }, }, - "name": "baz", + "name": "name", "range": Array [ - 35, - 46, + 36, + 48, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 34, + "column": 32, "line": 2, }, "start": Object { - "column": 26, + "column": 24, "line": 2, }, }, "range": Array [ - 38, - 46, + 40, + 48, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 34, + "column": 32, "line": 2, }, "start": Object { - "column": 28, + "column": 26, "line": 2, }, }, "range": Array [ - 40, - 46, + 42, + 48, ], - "type": "TSNumberKeyword", + "type": "TSStringKeyword", }, }, }, ], "range": Array [ - 19, - 50, + 25, + 95, ], "type": "FunctionExpression", }, @@ -82725,23 +84646,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { - "column": 10, + "column": 14, "line": 1, }, }, "range": Array [ - 10, - 52, + 14, + 97, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 1, }, "start": Object { @@ -82749,17 +84670,17 @@ Object { "line": 1, }, }, - "name": "Foo", + "name": "Greeter", "range": Array [ 6, - 9, + 13, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, @@ -82768,7 +84689,7 @@ Object { }, "range": Array [ 0, - 52, + 97, ], "superClass": null, "type": "ClassDeclaration", @@ -82777,7 +84698,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 6, }, "start": Object { "column": 0, @@ -82786,7 +84707,7 @@ Object { }, "range": Array [ 0, - 53, + 98, ], "sourceType": "script", "tokens": Array [ @@ -82811,7 +84732,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 1, }, "start": Object { @@ -82821,25 +84742,25 @@ Object { }, "range": Array [ 6, - 9, + 13, ], "type": "Identifier", - "value": "Foo", + "value": "Greeter", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 15, "line": 1, }, "start": Object { - "column": 10, + "column": 14, "line": 1, }, }, "range": Array [ - 10, - 11, + 14, + 15, ], "type": "Punctuator", "value": "{", @@ -82847,7 +84768,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 2, }, "start": Object { @@ -82856,26 +84777,26 @@ Object { }, }, "range": Array [ - 16, - 19, + 20, + 25, ], "type": "Identifier", - "value": "bar", + "value": "greet", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 2, }, "start": Object { - "column": 7, + "column": 9, "line": 2, }, }, "range": Array [ - 19, - 20, + 25, + 26, ], "type": "Punctuator", "value": "(", @@ -82883,17 +84804,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 2, }, "start": Object { - "column": 8, + "column": 10, "line": 2, }, }, "range": Array [ - 20, - 21, + 26, + 27, ], "type": "Punctuator", "value": "@", @@ -82901,71 +84822,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 19, "line": 2, }, "start": Object { - "column": 9, + "column": 11, "line": 2, }, }, "range": Array [ - 21, - 28, + 27, + 35, ], "type": "Identifier", - "value": "special", + "value": "required", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 24, "line": 2, }, "start": Object { - "column": 16, + "column": 20, "line": 2, }, }, "range": Array [ - 28, - 29, + 36, + 40, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 32, "line": 2, }, "start": Object { - "column": 17, + "column": 26, "line": 2, }, }, "range": Array [ - 29, - 33, + 42, + 48, ], - "type": "Boolean", - "value": "true", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 33, "line": 2, }, "start": Object { - "column": 21, + "column": 32, "line": 2, }, }, "range": Array [ - 33, - 34, + 48, + 49, ], "type": "Punctuator", "value": ")", @@ -82973,107 +84912,161 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, + "column": 35, "line": 2, }, "start": Object { - "column": 23, + "column": 34, "line": 2, }, }, "range": Array [ - 35, - 38, + 50, + 51, ], - "type": "Identifier", - "value": "baz", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 14, + "line": 3, }, "start": Object { - "column": 26, - "line": 2, + "column": 8, + "line": 3, }, }, "range": Array [ - 38, - 39, + 60, + 66, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 67, + 75, + ], + "type": "String", + "value": "\\"Hello \\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 76, + 77, ], "type": "Punctuator", - "value": ":", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 2, + "column": 30, + "line": 3, }, "start": Object { - "column": 28, - "line": 2, + "column": 26, + "line": 3, }, }, "range": Array [ - 40, - 46, + 78, + 82, ], "type": "Identifier", - "value": "number", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 2, + "column": 32, + "line": 3, }, "start": Object { - "column": 34, - "line": 2, + "column": 31, + "line": 3, }, }, "range": Array [ - 46, - 47, + 83, + 84, ], "type": "Punctuator", - "value": ")", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 85, + 88, + ], + "type": "String", + "value": "\\"!\\"", }, Object { "loc": Object { "end": Object { "column": 37, - "line": 2, + "line": 3, }, "start": Object { "column": 36, - "line": 2, + "line": 3, }, }, "range": Array [ - 48, - 49, + 88, + 89, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 37, - "line": 2, + "column": 4, + "line": 4, }, }, "range": Array [ - 49, - 50, + 94, + 95, ], "type": "Punctuator", "value": "}", @@ -83082,16 +85075,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 3, + "line": 5, }, }, "range": Array [ - 51, - 52, + 96, + 97, ], "type": "Punctuator", "value": "}", @@ -83101,7 +85094,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = ` Object { "body": Array [ Object { @@ -83112,7 +85105,7 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 2, }, "start": Object { @@ -83120,18 +85113,18 @@ Object { "line": 2, }, }, - "name": "bar", + "name": "greet", "range": Array [ - 29, - 32, + 33, + 38, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 45, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { "column": 4, @@ -83139,28 +85132,138 @@ Object { }, }, "range": Array [ - 22, - 63, + 26, + 108, ], "static": true, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [], + "body": Array [ + Object { + "argument": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 80, + 88, + ], + "raw": "\\"Hello \\"", + "type": "Literal", + "value": "Hello ", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 80, + 95, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "name", + "range": Array [ + 91, + 95, + ], + "type": "Identifier", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 80, + 101, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 98, + 101, + ], + "raw": "\\"!\\"", + "type": "Literal", + "value": "!", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 73, + 102, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { - "column": 45, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 43, + "column": 41, "line": 2, }, }, "range": Array [ - 61, 63, + 108, ], "type": "BlockStatement", }, @@ -83169,11 +85272,11 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 45, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 14, + "column": 16, "line": 2, }, }, @@ -83182,133 +85285,95 @@ Object { "decorators": Array [ Object { "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "range": Array [ - 42, - 46, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "special", - "range": Array [ - 34, - 41, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 29, + "column": 26, "line": 2, }, "start": Object { - "column": 16, + "column": 18, "line": 2, }, }, + "name": "required", "range": Array [ - 34, - 47, + 40, + 48, ], - "type": "CallExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 29, + "column": 26, "line": 2, }, "start": Object { - "column": 15, + "column": 17, "line": 2, }, }, "range": Array [ - 33, - 47, + 39, + 48, ], "type": "Decorator", }, ], "loc": Object { "end": Object { - "column": 41, + "column": 39, "line": 2, }, "start": Object { - "column": 30, + "column": 27, "line": 2, }, }, - "name": "baz", + "name": "name", "range": Array [ - 48, - 59, + 49, + 61, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 39, "line": 2, }, "start": Object { - "column": 33, + "column": 31, "line": 2, }, }, "range": Array [ - 51, - 59, + 53, + 61, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 39, "line": 2, }, "start": Object { - "column": 35, + "column": 33, "line": 2, }, }, "range": Array [ - 53, - 59, + 55, + 61, ], - "type": "TSNumberKeyword", + "type": "TSStringKeyword", }, }, }, ], "range": Array [ - 32, - 63, + 38, + 108, ], "type": "FunctionExpression", }, @@ -83317,23 +85382,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { - "column": 16, + "column": 20, "line": 1, }, }, "range": Array [ - 16, - 65, + 20, + 110, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 15, + "column": 19, "line": 1, }, "start": Object { @@ -83341,17 +85406,17 @@ Object { "line": 1, }, }, - "name": "StaticFoo", + "name": "StaticGreeter", "range": Array [ 6, - 15, + 19, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, @@ -83360,7 +85425,7 @@ Object { }, "range": Array [ 0, - 65, + 110, ], "superClass": null, "type": "ClassDeclaration", @@ -83369,7 +85434,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 6, }, "start": Object { "column": 0, @@ -83378,7 +85443,7 @@ Object { }, "range": Array [ 0, - 66, + 111, ], "sourceType": "script", "tokens": Array [ @@ -83403,7 +85468,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 19, "line": 1, }, "start": Object { @@ -83413,25 +85478,25 @@ Object { }, "range": Array [ 6, - 15, + 19, ], "type": "Identifier", - "value": "StaticFoo", + "value": "StaticGreeter", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 21, "line": 1, }, "start": Object { - "column": 16, + "column": 20, "line": 1, }, }, "range": Array [ - 16, - 17, + 20, + 21, ], "type": "Punctuator", "value": "{", @@ -83448,8 +85513,8 @@ Object { }, }, "range": Array [ - 22, - 28, + 26, + 32, ], "type": "Keyword", "value": "static", @@ -83457,7 +85522,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 2, }, "start": Object { @@ -83466,26 +85531,26 @@ Object { }, }, "range": Array [ - 29, - 32, + 33, + 38, ], "type": "Identifier", - "value": "bar", + "value": "greet", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 2, }, "start": Object { - "column": 14, + "column": 16, "line": 2, }, }, "range": Array [ - 32, - 33, + 38, + 39, ], "type": "Punctuator", "value": "(", @@ -83493,17 +85558,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 18, "line": 2, }, "start": Object { - "column": 15, + "column": 17, "line": 2, }, }, "range": Array [ - 33, - 34, + 39, + 40, ], "type": "Punctuator", "value": "@", @@ -83511,71 +85576,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 26, "line": 2, }, "start": Object { - "column": 16, + "column": 18, "line": 2, }, }, "range": Array [ - 34, - 41, + 40, + 48, ], "type": "Identifier", - "value": "special", + "value": "required", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 31, "line": 2, }, "start": Object { - "column": 23, + "column": 27, "line": 2, }, }, "range": Array [ - 41, - 42, + 49, + 53, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 39, "line": 2, }, "start": Object { - "column": 24, + "column": 33, "line": 2, }, }, "range": Array [ - 42, - 46, + 55, + 61, ], - "type": "Boolean", - "value": "true", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 40, "line": 2, }, "start": Object { - "column": 28, + "column": 39, "line": 2, }, }, "range": Array [ - 46, - 47, + 61, + 62, ], "type": "Punctuator", "value": ")", @@ -83583,107 +85666,161 @@ Object { Object { "loc": Object { "end": Object { - "column": 33, + "column": 42, "line": 2, }, "start": Object { - "column": 30, + "column": 41, "line": 2, }, }, "range": Array [ - 48, - 51, + 63, + 64, ], - "type": "Identifier", - "value": "baz", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 2, + "column": 14, + "line": 3, }, "start": Object { - "column": 33, - "line": 2, + "column": 8, + "line": 3, }, }, "range": Array [ - 51, - 52, + 73, + 79, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 80, + 88, + ], + "type": "String", + "value": "\\"Hello \\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 89, + 90, ], "type": "Punctuator", - "value": ":", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 41, - "line": 2, + "column": 30, + "line": 3, }, "start": Object { - "column": 35, - "line": 2, + "column": 26, + "line": 3, }, }, "range": Array [ - 53, - 59, + 91, + 95, ], "type": "Identifier", - "value": "number", + "value": "name", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 2, + "column": 32, + "line": 3, }, "start": Object { - "column": 41, - "line": 2, + "column": 31, + "line": 3, }, }, "range": Array [ - 59, - 60, + 96, + 97, ], "type": "Punctuator", - "value": ")", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 44, - "line": 2, + "column": 36, + "line": 3, }, "start": Object { - "column": 43, - "line": 2, + "column": 33, + "line": 3, }, }, "range": Array [ - 61, - 62, + 98, + 101, + ], + "type": "String", + "value": "\\"!\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 101, + 102, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 45, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 44, - "line": 2, + "column": 4, + "line": 4, }, }, "range": Array [ - 62, - 63, + 107, + 108, ], "type": "Punctuator", "value": "}", @@ -83692,16 +85829,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 3, + "line": 5, }, }, "range": Array [ - 64, - 65, + 109, + 110, ], "type": "Punctuator", "value": "}", @@ -83711,7 +85848,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-instance-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-object-pattern-decorator.src 1`] = ` Object { "body": Array [ Object { @@ -83722,165 +85859,55 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, - "name": "greet", + "name": "bar", "range": Array [ - 20, - 25, + 14, + 17, ], "type": "Identifier", }, "kind": "method", "loc": Object { - "end": Object { - "column": 5, - "line": 4, + "end": Object { + "column": 37, + "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 20, - 95, + 14, + 49, ], "static": false, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [ - Object { - "argument": Object { - "left": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 67, - 75, - ], - "raw": "\\"Hello \\"", - "type": "Literal", - "value": "Hello ", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 67, - 82, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "name": "name", - "range": Array [ - 78, - 82, - ], - "type": "Identifier", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 67, - 88, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 85, - 88, - ], - "raw": "\\"!\\"", - "type": "Literal", - "value": "!", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 60, - 89, - ], - "type": "ReturnStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 37, + "line": 2, }, "start": Object { - "column": 34, + "column": 35, "line": 2, }, }, "range": Array [ - 50, - 95, + 47, + 49, ], "type": "BlockStatement", }, @@ -83889,11 +85916,11 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 37, + "line": 2, }, "start": Object { - "column": 9, + "column": 5, "line": 2, }, }, @@ -83902,95 +85929,191 @@ Object { "decorators": Array [ Object { "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 2, }, "start": Object { - "column": 11, + "column": 7, "line": 2, }, }, - "name": "required", "range": Array [ - 27, - 35, + 19, + 32, ], - "type": "Identifier", + "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 2, }, "start": Object { - "column": 10, + "column": 6, "line": 2, }, }, "range": Array [ - 26, - 35, + 18, + 32, ], "type": "Decorator", }, ], "loc": Object { "end": Object { - "column": 32, + "column": 33, "line": 2, }, "start": Object { - "column": 20, + "column": 21, "line": 2, }, }, - "name": "name", + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 35, + 38, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + }, + ], "range": Array [ - 36, - 48, + 33, + 45, ], - "type": "Identifier", + "type": "ObjectPattern", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 32, + "column": 33, "line": 2, }, "start": Object { - "column": 24, + "column": 28, "line": 2, }, }, "range": Array [ 40, - 48, + 45, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 32, + "column": 33, "line": 2, }, "start": Object { - "column": 26, + "column": 30, "line": 2, }, }, "range": Array [ 42, - 48, + 45, ], - "type": "TSStringKeyword", + "type": "TSAnyKeyword", }, }, }, ], "range": Array [ - 25, - 95, + 17, + 49, ], "type": "FunctionExpression", }, @@ -83999,23 +86122,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, "range": Array [ - 14, - 97, + 10, + 51, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 1, }, "start": Object { @@ -84023,17 +86146,17 @@ Object { "line": 1, }, }, - "name": "Greeter", + "name": "Foo", "range": Array [ 6, - 13, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, @@ -84042,7 +86165,7 @@ Object { }, "range": Array [ 0, - 97, + 51, ], "superClass": null, "type": "ClassDeclaration", @@ -84051,7 +86174,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 4, }, "start": Object { "column": 0, @@ -84060,7 +86183,7 @@ Object { }, "range": Array [ 0, - 98, + 52, ], "sourceType": "script", "tokens": Array [ @@ -84085,7 +86208,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 1, }, "start": Object { @@ -84095,25 +86218,25 @@ Object { }, "range": Array [ 6, - 13, + 9, ], "type": "Identifier", - "value": "Greeter", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 11, "line": 1, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, "range": Array [ - 14, - 15, + 10, + 11, ], "type": "Punctuator", "value": "{", @@ -84121,35 +86244,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 20, - 25, + 14, + 17, ], "type": "Identifier", - "value": "greet", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 6, "line": 2, }, "start": Object { - "column": 9, + "column": 5, "line": 2, }, }, "range": Array [ - 25, - 26, + 17, + 18, ], "type": "Punctuator", "value": "(", @@ -84157,17 +86280,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 7, "line": 2, }, "start": Object { - "column": 10, + "column": 6, "line": 2, }, }, "range": Array [ - 26, - 27, + 18, + 19, ], "type": "Punctuator", "value": "@", @@ -84175,89 +86298,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 27, - 35, - ], - "type": "Identifier", - "value": "required", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, + "column": 14, "line": 2, }, "start": Object { - "column": 20, + "column": 7, "line": 2, }, }, "range": Array [ - 36, - 40, + 19, + 26, ], "type": "Identifier", - "value": "name", + "value": "special", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 15, "line": 2, }, "start": Object { - "column": 24, + "column": 14, "line": 2, }, }, "range": Array [ - 40, - 41, + 26, + 27, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 19, "line": 2, }, "start": Object { - "column": 26, + "column": 15, "line": 2, }, }, "range": Array [ - 42, - 48, + 27, + 31, ], - "type": "Identifier", - "value": "string", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 20, "line": 2, }, "start": Object { - "column": 32, + "column": 19, "line": 2, }, }, "range": Array [ - 48, - 49, + 31, + 32, ], "type": "Punctuator", "value": ")", @@ -84265,17 +86370,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 22, "line": 2, }, "start": Object { - "column": 34, + "column": 21, "line": 2, }, }, "range": Array [ - 50, - 51, + 33, + 34, ], "type": "Punctuator", "value": "{", @@ -84283,143 +86388,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 26, + "line": 2, }, "start": Object { - "column": 8, - "line": 3, + "column": 23, + "line": 2, }, }, "range": Array [ - 60, - 66, + 35, + 38, ], - "type": "Keyword", - "value": "return", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 28, + "line": 2, }, "start": Object { - "column": 15, - "line": 3, + "column": 27, + "line": 2, }, }, "range": Array [ - 67, - 75, + 39, + 40, ], - "type": "String", - "value": "\\"Hello \\"", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 3, + "column": 29, + "line": 2, }, "start": Object { - "column": 24, - "line": 3, + "column": 28, + "line": 2, }, }, "range": Array [ - 76, - 77, + 40, + 41, ], "type": "Punctuator", - "value": "+", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 3, + "column": 33, + "line": 2, }, "start": Object { - "column": 26, - "line": 3, + "column": 30, + "line": 2, }, }, "range": Array [ - 78, - 82, + 42, + 45, ], "type": "Identifier", - "value": "name", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 3, + "column": 34, + "line": 2, }, "start": Object { - "column": 31, - "line": 3, + "column": 33, + "line": 2, }, }, "range": Array [ - 83, - 84, + 45, + 46, ], "type": "Punctuator", - "value": "+", + "value": ")", }, Object { "loc": Object { "end": Object { "column": 36, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 85, - 88, - ], - "type": "String", - "value": "\\"!\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 3, + "line": 2, }, "start": Object { - "column": 36, - "line": 3, + "column": 35, + "line": 2, }, }, "range": Array [ - 88, - 89, + 47, + 48, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 37, + "line": 2, }, "start": Object { - "column": 4, - "line": 4, + "column": 36, + "line": 2, }, }, "range": Array [ - 94, - 95, + 48, + 49, ], "type": "Punctuator", "value": "}", @@ -84428,16 +86515,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, - "line": 5, + "line": 3, }, }, "range": Array [ - 96, - 97, + 50, + 51, ], "type": "Punctuator", "value": "}", @@ -84447,7 +86534,7 @@ Object { } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/decorators/parameter-decorators/parameter-rest-element-decorator.src 1`] = ` Object { "body": Array [ Object { @@ -84458,165 +86545,55 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 16, + "column": 5, "line": 2, }, "start": Object { - "column": 11, + "column": 2, "line": 2, }, }, - "name": "greet", + "name": "bar", "range": Array [ - 33, - 38, + 14, + 17, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 26, - 108, + 14, + 48, ], - "static": true, + "static": false, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [ - Object { - "argument": Object { - "left": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 80, - 88, - ], - "raw": "\\"Hello \\"", - "type": "Literal", - "value": "Hello ", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 80, - 95, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "name": "name", - "range": Array [ - 91, - 95, - ], - "type": "Identifier", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 80, - 101, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 98, - 101, - ], - "raw": "\\"!\\"", - "type": "Literal", - "value": "!", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 73, - 102, - ], - "type": "ReturnStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 2, }, "start": Object { - "column": 41, + "column": 34, "line": 2, }, }, "range": Array [ - 63, - 108, + 46, + 48, ], "type": "BlockStatement", }, @@ -84625,108 +86602,163 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 2, }, "start": Object { - "column": 16, + "column": 5, "line": 2, }, }, "params": Array [ Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 36, + 39, + ], + "type": "Identifier", + }, "decorators": Array [ Object { "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 26, + "column": 20, "line": 2, }, "start": Object { - "column": 18, + "column": 7, "line": 2, }, }, - "name": "required", "range": Array [ - 40, - 48, + 19, + 32, ], - "type": "Identifier", + "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 26, + "column": 20, "line": 2, }, "start": Object { - "column": 17, + "column": 6, "line": 2, }, }, "range": Array [ - 39, - 48, + 18, + 32, ], "type": "Decorator", }, ], "loc": Object { "end": Object { - "column": 39, + "column": 32, "line": 2, }, "start": Object { - "column": 27, + "column": 6, "line": 2, }, }, - "name": "name", "range": Array [ - 49, - 61, + 18, + 44, ], - "type": "Identifier", + "type": "RestElement", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 39, + "column": 32, "line": 2, }, "start": Object { - "column": 31, + "column": 27, "line": 2, }, }, "range": Array [ - 53, - 61, + 39, + 44, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 39, + "column": 32, "line": 2, }, "start": Object { - "column": 33, + "column": 29, "line": 2, }, }, "range": Array [ - 55, - 61, + 41, + 44, ], - "type": "TSStringKeyword", + "type": "TSAnyKeyword", }, }, }, ], "range": Array [ - 38, - 108, + 17, + 48, ], "type": "FunctionExpression", }, @@ -84735,23 +86767,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { - "column": 20, + "column": 10, "line": 1, }, }, "range": Array [ - 20, - 110, + 10, + 50, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 19, + "column": 9, "line": 1, }, "start": Object { @@ -84759,17 +86791,17 @@ Object { "line": 1, }, }, - "name": "StaticGreeter", + "name": "Foo", "range": Array [ 6, - 19, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, @@ -84778,7 +86810,7 @@ Object { }, "range": Array [ 0, - 110, + 50, ], "superClass": null, "type": "ClassDeclaration", @@ -84787,7 +86819,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 4, }, "start": Object { "column": 0, @@ -84796,7 +86828,7 @@ Object { }, "range": Array [ 0, - 111, + 51, ], "sourceType": "script", "tokens": Array [ @@ -84821,7 +86853,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 9, "line": 1, }, "start": Object { @@ -84831,25 +86863,25 @@ Object { }, "range": Array [ 6, - 19, + 9, ], "type": "Identifier", - "value": "StaticGreeter", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 11, "line": 1, }, "start": Object { - "column": 20, + "column": 10, "line": 1, }, }, "range": Array [ - 20, - 21, + 10, + 11, ], "type": "Punctuator", "value": "{", @@ -84857,53 +86889,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 26, - 32, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, + "column": 5, "line": 2, }, "start": Object { - "column": 11, + "column": 2, "line": 2, }, }, "range": Array [ - 33, - 38, + 14, + 17, ], "type": "Identifier", - "value": "greet", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 6, "line": 2, }, "start": Object { - "column": 16, + "column": 5, "line": 2, }, }, "range": Array [ - 38, - 39, + 17, + 18, ], "type": "Punctuator", "value": "(", @@ -84911,17 +86925,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 7, "line": 2, }, "start": Object { - "column": 17, + "column": 6, "line": 2, }, }, "range": Array [ - 39, - 40, + 18, + 19, ], "type": "Punctuator", "value": "@", @@ -84929,89 +86943,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 40, - 48, - ], - "type": "Identifier", - "value": "required", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, + "column": 14, "line": 2, }, "start": Object { - "column": 27, + "column": 7, "line": 2, }, }, "range": Array [ - 49, - 53, + 19, + 26, ], "type": "Identifier", - "value": "name", + "value": "special", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 15, "line": 2, }, "start": Object { - "column": 31, + "column": 14, "line": 2, }, }, "range": Array [ - 53, - 54, + 26, + 27, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 19, "line": 2, }, "start": Object { - "column": 33, + "column": 15, "line": 2, }, }, "range": Array [ - 55, - 61, + 27, + 31, ], - "type": "Identifier", - "value": "string", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 20, "line": 2, }, "start": Object { - "column": 39, + "column": 19, "line": 2, }, }, "range": Array [ - 61, - 62, + 31, + 32, ], "type": "Punctuator", "value": ")", @@ -85019,161 +87015,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, + "column": 24, "line": 2, }, "start": Object { - "column": 41, + "column": 21, "line": 2, }, }, "range": Array [ - 63, - 64, + 33, + 36, ], "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 73, - 79, - ], - "type": "Keyword", - "value": "return", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 27, + "line": 2, }, "start": Object { - "column": 15, - "line": 3, + "column": 24, + "line": 2, }, }, "range": Array [ - 80, - 88, + 36, + 39, ], - "type": "String", - "value": "\\"Hello \\"", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 3, + "column": 28, + "line": 2, }, "start": Object { - "column": 24, - "line": 3, + "column": 27, + "line": 2, }, }, "range": Array [ - 89, - 90, + 39, + 40, ], "type": "Punctuator", - "value": "+", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 3, + "column": 32, + "line": 2, }, "start": Object { - "column": 26, - "line": 3, + "column": 29, + "line": 2, }, }, "range": Array [ - 91, - 95, + 41, + 44, ], "type": "Identifier", - "value": "name", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 3, + "column": 33, + "line": 2, }, "start": Object { - "column": 31, - "line": 3, + "column": 32, + "line": 2, }, }, "range": Array [ - 96, - 97, + 44, + 45, ], "type": "Punctuator", - "value": "+", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 98, - 101, - ], - "type": "String", - "value": "\\"!\\"", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 3, + "column": 35, + "line": 2, }, "start": Object { - "column": 36, - "line": 3, + "column": 34, + "line": 2, }, }, "range": Array [ - 101, - 102, + 46, + 47, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 36, + "line": 2, }, "start": Object { - "column": 4, - "line": 4, + "column": 35, + "line": 2, }, }, "range": Array [ - 107, - 108, + 47, + 48, ], "type": "Punctuator", "value": "}", @@ -85182,16 +87142,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, - "line": 5, + "line": 3, }, }, "range": Array [ - 109, - 110, + 49, + 50, ], "type": "Punctuator", "value": "}", @@ -88574,6 +90534,232 @@ Object { } `; +exports[`typescript fixtures/errorRecovery/decorator-on-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "b", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 19, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "Identifier", + "value": "dec", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 5, + 13, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/errorRecovery/decorator-on-interface-declaration.src 1`] = ` Object { "body": Array [