-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Babel 8] Create TSAbstract{Method,Property}Definition (#17014)
* add abstract class property / private tests * breaking: create TSAbstract{Method,Property}Definition * update test fixtures * move logic to estree plugin
- Loading branch information
Showing
28 changed files
with
612 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
7 changes: 7 additions & 0 deletions
7
packages/babel-parser/test/fixtures/estree/class-method/typescript-babel-7/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"plugins": [ | ||
"typescript", | ||
"estree" | ||
], | ||
"BABEL_8_BREAKING": false | ||
} |
73 changes: 73 additions & 0 deletions
73
packages/babel-parser/test/fixtures/estree/class-method/typescript-babel-7/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "ClassDeclaration", | ||
"start":0,"end":73,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, | ||
"abstract": true, | ||
"id": { | ||
"type": "Identifier", | ||
"start":15,"end":30,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":30},"identifierName":"TSAbstractClass"}, | ||
"name": "TSAbstractClass" | ||
}, | ||
"superClass": null, | ||
"body": { | ||
"type": "ClassBody", | ||
"start":31,"end":73,"loc":{"start":{"line":1,"column":31},"end":{"line":3,"column":1}}, | ||
"body": [ | ||
{ | ||
"type": "MethodDefinition", | ||
"start":35,"end":71,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":38}}, | ||
"abstract": true, | ||
"static": false, | ||
"key": { | ||
"type": "Identifier", | ||
"start":44,"end":47,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":14},"identifierName":"foo"}, | ||
"name": "foo" | ||
}, | ||
"computed": false, | ||
"kind": "method", | ||
"value": { | ||
"type": "FunctionExpression", | ||
"start":47,"end":71,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":38}}, | ||
"id": null, | ||
"generator": false, | ||
"async": false, | ||
"expression": false, | ||
"params": [ | ||
{ | ||
"type": "Identifier", | ||
"start":48,"end":60,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":27},"identifierName":"name"}, | ||
"name": "name", | ||
"typeAnnotation": { | ||
"type": "TSTypeAnnotation", | ||
"start":52,"end":60,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":27}}, | ||
"typeAnnotation": { | ||
"type": "TSStringKeyword", | ||
"start":54,"end":60,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":27}} | ||
} | ||
} | ||
} | ||
], | ||
"returnType": { | ||
"type": "TSTypeAnnotation", | ||
"start":61,"end":70,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":37}}, | ||
"typeAnnotation": { | ||
"type": "TSBooleanKeyword", | ||
"start":63,"end":70,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":37}} | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/babel-parser/test/fixtures/estree/class-method/typescript/input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
abstract class TSAbstractClass { | ||
abstract foo(name: string): boolean; | ||
} |
8 changes: 6 additions & 2 deletions
8
packages/babel-parser/test/fixtures/estree/class-method/typescript/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
{ | ||
"plugins": ["typescript", "estree"] | ||
} | ||
"plugins": [ | ||
"typescript", | ||
"estree" | ||
], | ||
"BABEL_8_BREAKING": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...er/test/fixtures/estree/class-private-method/typescript-invalid-abstract-babel-7/input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
abstract class TSAbstractClass { | ||
abstract #foo(name: string): boolean; | ||
} |
7 changes: 7 additions & 0 deletions
7
...est/fixtures/estree/class-private-method/typescript-invalid-abstract-babel-7/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"plugins": [ | ||
"typescript", | ||
"estree" | ||
], | ||
"BABEL_8_BREAKING": false | ||
} |
Oops, something went wrong.