diff --git a/packages/babel-parser/src/plugins/typescript/index.js b/packages/babel-parser/src/plugins/typescript/index.js index 02833cee0d0a..4126a0f1908b 100644 --- a/packages/babel-parser/src/plugins/typescript/index.js +++ b/packages/babel-parser/src/plugins/typescript/index.js @@ -159,13 +159,13 @@ export default (superClass: Class): Class => // TODO: Would be nice to avoid lookahead. Want a hasLineBreakUpNext() method... this.next(); return ( - !this.hasPrecedingLineBreak() && - !this.match(tt.parenL) && - !this.match(tt.parenR) && - !this.match(tt.colon) && - !this.match(tt.eq) && - !this.match(tt.question) && - !this.match(tt.bang) + (this.match(tt.bracketL) || + this.match(tt.braceL) || + this.match(tt.star) || + this.match(tt.ellipsis) || + this.match(tt.hash) || + this.isLiteralPropertyName()) && + !this.hasPrecedingLineBreak() ); } diff --git a/packages/babel-parser/test/fixtures/typescript/class/generator-method-with-modifiers/input.ts b/packages/babel-parser/test/fixtures/typescript/class/generator-method-with-modifiers/input.ts new file mode 100644 index 000000000000..1c2dc64b991c --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/generator-method-with-modifiers/input.ts @@ -0,0 +1,9 @@ +class C { + private *a() {} + public *b() {} + static *c() {} + abstract *d() {} + readonly *e() {} + declare *f() {} + protected *g() {} +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/generator-method-with-modifiers/output.json b/packages/babel-parser/test/fixtures/typescript/class/generator-method-with-modifiers/output.json new file mode 100644 index 000000000000..a02324333114 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/generator-method-with-modifiers/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start":0,"end":139,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":139,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":139,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":139,"loc":{"start":{"line":1,"column":8},"end":{"line":9,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}}, + "accessibility": "private", + "static": false, + "kind": "method", + "key": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":25,"end":27,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":17}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start":30,"end":44,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, + "accessibility": "public", + "static": false, + "kind": "method", + "key": { + "type": "Identifier", + "start":38,"end":39,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":42,"end":44,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":16}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start":47,"end":61,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":16}}, + "static": true, + "kind": "method", + "key": { + "type": "Identifier", + "start":55,"end":56,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":11},"identifierName":"c"}, + "name": "c" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":59,"end":61,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":16}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start":64,"end":80,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":18}}, + "abstract": true, + "static": false, + "kind": "method", + "key": { + "type": "Identifier", + "start":74,"end":75,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":13},"identifierName":"d"}, + "name": "d" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":78,"end":80,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":18}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start":83,"end":99,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":18}}, + "readonly": true, + "static": false, + "kind": "method", + "key": { + "type": "Identifier", + "start":93,"end":94,"loc":{"start":{"line":6,"column":12},"end":{"line":6,"column":13},"identifierName":"e"}, + "name": "e" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":97,"end":99,"loc":{"start":{"line":6,"column":16},"end":{"line":6,"column":18}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start":102,"end":117,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":17}}, + "declare": true, + "static": false, + "kind": "method", + "key": { + "type": "Identifier", + "start":111,"end":112,"loc":{"start":{"line":7,"column":11},"end":{"line":7,"column":12},"identifierName":"f"}, + "name": "f" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":115,"end":117,"loc":{"start":{"line":7,"column":15},"end":{"line":7,"column":17}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start":120,"end":137,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":19}}, + "accessibility": "protected", + "static": false, + "kind": "method", + "key": { + "type": "Identifier", + "start":131,"end":132,"loc":{"start":{"line":8,"column":13},"end":{"line":8,"column":14},"identifierName":"g"}, + "name": "g" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":135,"end":137,"loc":{"start":{"line":8,"column":17},"end":{"line":8,"column":19}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/method-modifier-name-with-type-parameters/input.ts b/packages/babel-parser/test/fixtures/typescript/class/method-modifier-name-with-type-parameters/input.ts new file mode 100644 index 000000000000..ce489644016d --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/method-modifier-name-with-type-parameters/input.ts @@ -0,0 +1,9 @@ +class C { + declare() {} + readonly() {} + abstract() {} + static() {} + private() {} + public() {} + protected() {} +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/method-modifier-name-with-type-parameters/output.json b/packages/babel-parser/test/fixtures/typescript/class/method-modifier-name-with-type-parameters/output.json new file mode 100644 index 000000000000..c242a1291f45 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/method-modifier-name-with-type-parameters/output.json @@ -0,0 +1,260 @@ +{ + "type": "File", + "start":0,"end":139,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":139,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":139,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":139,"loc":{"start":{"line":1,"column":8},"end":{"line":9,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":12,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}}, + "static": false, + "key": { + "type": "Identifier", + "start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9},"identifierName":"declare"}, + "name": "declare" + }, + "computed": false, + "kind": "method", + "typeParameters": { + "type": "TSTypeParameterDeclaration", + "start":19,"end":22,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12}}, + "params": [ + { + "type": "TSTypeParameter", + "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, + "name": "T" + } + ] + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":25,"end":27,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":17}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start":30,"end":46,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":18}}, + "static": false, + "key": { + "type": "Identifier", + "start":30,"end":38,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":10},"identifierName":"readonly"}, + "name": "readonly" + }, + "computed": false, + "kind": "method", + "typeParameters": { + "type": "TSTypeParameterDeclaration", + "start":38,"end":41,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":13}}, + "params": [ + { + "type": "TSTypeParameter", + "start":39,"end":40,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":12}}, + "name": "T" + } + ] + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":44,"end":46,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":18}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start":49,"end":65,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":18}}, + "static": false, + "key": { + "type": "Identifier", + "start":49,"end":57,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":10},"identifierName":"abstract"}, + "name": "abstract" + }, + "computed": false, + "kind": "method", + "typeParameters": { + "type": "TSTypeParameterDeclaration", + "start":57,"end":60,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":13}}, + "params": [ + { + "type": "TSTypeParameter", + "start":58,"end":59,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":12}}, + "name": "T" + } + ] + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":63,"end":65,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":18}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start":68,"end":82,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":16}}, + "kind": "method", + "computed": false, + "key": { + "type": "Identifier", + "start":68,"end":74,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":8},"identifierName":"static"}, + "name": "static" + }, + "static": false, + "typeParameters": { + "type": "TSTypeParameterDeclaration", + "start":74,"end":77,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":11}}, + "params": [ + { + "type": "TSTypeParameter", + "start":75,"end":76,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":10}}, + "name": "T" + } + ] + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":80,"end":82,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":16}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start":85,"end":100,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":17}}, + "static": false, + "key": { + "type": "Identifier", + "start":85,"end":92,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":9},"identifierName":"private"}, + "name": "private" + }, + "computed": false, + "kind": "method", + "typeParameters": { + "type": "TSTypeParameterDeclaration", + "start":92,"end":95,"loc":{"start":{"line":6,"column":9},"end":{"line":6,"column":12}}, + "params": [ + { + "type": "TSTypeParameter", + "start":93,"end":94,"loc":{"start":{"line":6,"column":10},"end":{"line":6,"column":11}}, + "name": "T" + } + ] + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":98,"end":100,"loc":{"start":{"line":6,"column":15},"end":{"line":6,"column":17}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start":103,"end":117,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":16}}, + "static": false, + "key": { + "type": "Identifier", + "start":103,"end":109,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":8},"identifierName":"public"}, + "name": "public" + }, + "computed": false, + "kind": "method", + "typeParameters": { + "type": "TSTypeParameterDeclaration", + "start":109,"end":112,"loc":{"start":{"line":7,"column":8},"end":{"line":7,"column":11}}, + "params": [ + { + "type": "TSTypeParameter", + "start":110,"end":111,"loc":{"start":{"line":7,"column":9},"end":{"line":7,"column":10}}, + "name": "T" + } + ] + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":115,"end":117,"loc":{"start":{"line":7,"column":14},"end":{"line":7,"column":16}}, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start":120,"end":137,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":19}}, + "static": false, + "key": { + "type": "Identifier", + "start":120,"end":129,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":11},"identifierName":"protected"}, + "name": "protected" + }, + "computed": false, + "kind": "method", + "typeParameters": { + "type": "TSTypeParameterDeclaration", + "start":129,"end":132,"loc":{"start":{"line":8,"column":11},"end":{"line":8,"column":14}}, + "params": [ + { + "type": "TSTypeParameter", + "start":130,"end":131,"loc":{"start":{"line":8,"column":12},"end":{"line":8,"column":13}}, + "name": "T" + } + ] + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":135,"end":137,"loc":{"start":{"line":8,"column":17},"end":{"line":8,"column":19}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/method-with-modifiers-asi/input.ts b/packages/babel-parser/test/fixtures/typescript/class/method-with-modifiers-asi/input.ts new file mode 100644 index 000000000000..a3d99dfeaf24 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/method-with-modifiers-asi/input.ts @@ -0,0 +1,4 @@ +class C { + public + private() {} +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/method-with-modifiers-asi/output.json b/packages/babel-parser/test/fixtures/typescript/class/method-with-modifiers-asi/output.json new file mode 100644 index 000000000000..d25704bcc8a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/method-with-modifiers-asi/output.json @@ -0,0 +1,63 @@ +{ + "type": "File", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"}, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":8,"end":35,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassProperty", + "start":12,"end":18,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8}}, + "static": false, + "key": { + "type": "Identifier", + "start":12,"end":18,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":8},"identifierName":"public"}, + "name": "public" + }, + "computed": false, + "value": null + }, + { + "type": "ClassMethod", + "start":21,"end":33,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, + "static": false, + "key": { + "type": "Identifier", + "start":21,"end":28,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":9},"identifierName":"private"}, + "name": "private" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":31,"end":33,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/modifier-name-parameters/input.ts b/packages/babel-parser/test/fixtures/typescript/class/modifier-name-parameters/input.ts new file mode 100644 index 000000000000..1d969dfdb11d --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/modifier-name-parameters/input.ts @@ -0,0 +1,4 @@ +class Foo { + constructor(private, public, static) { + } +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/modifier-name-parameters/output.json b/packages/babel-parser/test/fixtures/typescript/class/modifier-name-parameters/output.json new file mode 100644 index 000000000000..e4fbfd42cf1c --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/modifier-name-parameters/output.json @@ -0,0 +1,67 @@ +{ + "type": "File", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":58,"loc":{"start":{"line":1,"column":10},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":14,"end":56,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":3}}, + "static": false, + "key": { + "type": "Identifier", + "start":14,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":26,"end":33,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":21},"identifierName":"private"}, + "name": "private" + }, + { + "type": "Identifier", + "start":35,"end":41,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":29},"identifierName":"public"}, + "name": "public" + }, + { + "type": "Identifier", + "start":43,"end":49,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":37},"identifierName":"static"}, + "name": "static" + } + ], + "body": { + "type": "BlockStatement", + "start":51,"end":56,"loc":{"start":{"line":2,"column":39},"end":{"line":3,"column":3}}, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/input.ts b/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/input.ts index 412241a32780..4ad952e28c82 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/input.ts +++ b/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/input.ts @@ -1,3 +1,6 @@ class C { constructor(public []) {} } +class D { + constructor(public {}) {} +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/output.json b/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/output.json index a2d22a5968a1..08e9c163117a 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/output.json @@ -1,12 +1,13 @@ { "type": "File", - "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "errors": [ - "SyntaxError: A parameter property may not be declared using a binding pattern. (2:16)" + "SyntaxError: A parameter property may not be declared using a binding pattern. (2:16)", + "SyntaxError: A parameter property may not be declared using a binding pattern. (5:16)" ], "program": { "type": "Program", - "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, "sourceType": "module", "interpreter": null, "body": [ @@ -58,6 +59,55 @@ } ] } + }, + { + "type": "ClassDeclaration", + "start":42,"end":83,"loc":{"start":{"line":4,"column":0},"end":{"line":6,"column":1}}, + "id": { + "type": "Identifier", + "start":48,"end":49,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":7},"identifierName":"D"}, + "name": "D" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":50,"end":83,"loc":{"start":{"line":4,"column":8},"end":{"line":6,"column":1}}, + "body": [ + { + "type": "ClassMethod", + "start":56,"end":81,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":29}}, + "static": false, + "key": { + "type": "Identifier", + "start":56,"end":67,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":15},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "TSParameterProperty", + "start":68,"end":77,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":25}}, + "accessibility": "public", + "parameter": { + "type": "ObjectPattern", + "start":75,"end":77,"loc":{"start":{"line":5,"column":23},"end":{"line":5,"column":25}}, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start":79,"end":81,"loc":{"start":{"line":5,"column":27},"end":{"line":5,"column":29}}, + "body": [], + "directives": [] + } + } + ] + } } ], "directives": [] diff --git a/scripts/parser-tests/typescript/allowlist.txt b/scripts/parser-tests/typescript/allowlist.txt index 5f2c7aa4754a..19d7b5c76619 100644 --- a/scripts/parser-tests/typescript/allowlist.txt +++ b/scripts/parser-tests/typescript/allowlist.txt @@ -399,7 +399,6 @@ sourceMapValidationDecorators.ts sourceMapValidationStatements.ts staticIndexer.ts strictModeReservedWord.ts -strictModeReservedWordInClassDeclaration.ts superCallFromClassThatHasNoBaseType1.ts symbolLinkDeclarationEmitModuleNames.ts symbolMergeValueAndImportedType.ts