Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Nicol貌 Ribaudo <nicolo.ribaudo@gmail.com>
- Loading branch information
Showing
41 changed files
with
989 additions
and
40 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
4 changes: 4 additions & 0 deletions
4
packages/babel-generator/test/fixtures/typescript/interface-method-kind/input.js
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,4 @@ | ||
interface Foo { | ||
get foo(); | ||
set bar(v); | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/babel-generator/test/fixtures/typescript/interface-method-kind/output.js
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,4 @@ | ||
interface Foo { | ||
get foo(); | ||
set bar(v); | ||
} |
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
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
6 changes: 6 additions & 0 deletions
6
packages/babel-parser/test/fixtures/typescript/interface/get-set-ambiguous/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,6 @@ | ||
interface Foo { | ||
get | ||
foo(): string; | ||
set | ||
bar(v); | ||
} |
86 changes: 86 additions & 0 deletions
86
packages/babel-parser/test/fixtures/typescript/interface/get-set-ambiguous/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,86 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "TSInterfaceDeclaration", | ||
"start":0,"end":56,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, | ||
"id": { | ||
"type": "Identifier", | ||
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"}, | ||
"name": "Foo" | ||
}, | ||
"body": { | ||
"type": "TSInterfaceBody", | ||
"start":14,"end":56,"loc":{"start":{"line":1,"column":14},"end":{"line":6,"column":1}}, | ||
"body": [ | ||
{ | ||
"type": "TSPropertySignature", | ||
"start":18,"end":21,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5}}, | ||
"key": { | ||
"type": "Identifier", | ||
"start":18,"end":21,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"get"}, | ||
"name": "get" | ||
}, | ||
"computed": false | ||
}, | ||
{ | ||
"type": "TSMethodSignature", | ||
"start":24,"end":38,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}}, | ||
"key": { | ||
"type": "Identifier", | ||
"start":24,"end":27,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"foo"}, | ||
"name": "foo" | ||
}, | ||
"computed": false, | ||
"parameters": [], | ||
"typeAnnotation": { | ||
"type": "TSTypeAnnotation", | ||
"start":29,"end":37,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":15}}, | ||
"typeAnnotation": { | ||
"type": "TSStringKeyword", | ||
"start":31,"end":37,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":15}} | ||
} | ||
}, | ||
"kind": "method" | ||
}, | ||
{ | ||
"type": "TSPropertySignature", | ||
"start":41,"end":44,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":5}}, | ||
"key": { | ||
"type": "Identifier", | ||
"start":41,"end":44,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":5},"identifierName":"set"}, | ||
"name": "set" | ||
}, | ||
"computed": false | ||
}, | ||
{ | ||
"type": "TSMethodSignature", | ||
"start":47,"end":54,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":9}}, | ||
"key": { | ||
"type": "Identifier", | ||
"start":47,"end":50,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":5},"identifierName":"bar"}, | ||
"name": "bar" | ||
}, | ||
"computed": false, | ||
"parameters": [ | ||
{ | ||
"type": "Identifier", | ||
"start":51,"end":52,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":7},"identifierName":"v"}, | ||
"name": "v" | ||
} | ||
], | ||
"kind": "method" | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...bel-parser/test/fixtures/typescript/interface/get-set-invalid-optional-parameter/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 @@ | ||
interface Foo { | ||
set bar(foo?: string); | ||
} |
58 changes: 58 additions & 0 deletions
58
...-parser/test/fixtures/typescript/interface/get-set-invalid-optional-parameter/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,58 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, | ||
"errors": [ | ||
"SyntaxError: A 'set' accessor cannot have an optional parameter. (3:1)" | ||
], | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "TSInterfaceDeclaration", | ||
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, | ||
"id": { | ||
"type": "Identifier", | ||
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"}, | ||
"name": "Foo" | ||
}, | ||
"body": { | ||
"type": "TSInterfaceBody", | ||
"start":14,"end":42,"loc":{"start":{"line":1,"column":14},"end":{"line":3,"column":1}}, | ||
"body": [ | ||
{ | ||
"type": "TSMethodSignature", | ||
"start":18,"end":40,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":24}}, | ||
"key": { | ||
"type": "Identifier", | ||
"start":22,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"bar"}, | ||
"name": "bar" | ||
}, | ||
"computed": false, | ||
"kind": "set", | ||
"parameters": [ | ||
{ | ||
"type": "Identifier", | ||
"start":26,"end":38,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":22},"identifierName":"foo"}, | ||
"name": "foo", | ||
"optional": true, | ||
"typeAnnotation": { | ||
"type": "TSTypeAnnotation", | ||
"start":30,"end":38,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":22}}, | ||
"typeAnnotation": { | ||
"type": "TSStringKeyword", | ||
"start":32,"end":38,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":22}} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/babel-parser/test/fixtures/typescript/interface/get-set-invalid-parameters/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,4 @@ | ||
interface Foo { | ||
get foo(param): string; | ||
set foo(); | ||
} |
Oops, something went wrong.