forked from babel/babel
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ts: Check if param is assignable when parsing arrow return type (babe…
- Loading branch information
1 parent
c97f9c4
commit 0484086
Showing
13 changed files
with
405 additions
and
47 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
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
2 changes: 2 additions & 0 deletions
2
...babel-parser/test/fixtures/typescript/arrow-function/arrow-like-in-conditional-1/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,2 @@ | ||
// https://github.com/babel/babel/issues/11038 | ||
0 ? v => (sum += v) : v => 0; |
100 changes: 100 additions & 0 deletions
100
...el-parser/test/fixtures/typescript/arrow-function/arrow-like-in-conditional-1/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,100 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":29}}, | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":29}}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start":47,"end":76,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":29}}, | ||
"leadingComments": [ | ||
{ | ||
"type": "CommentLine", | ||
"value": " https://github.com/babel/babel/issues/11038", | ||
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}} | ||
} | ||
], | ||
"expression": { | ||
"type": "ConditionalExpression", | ||
"start":47,"end":75,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":28}}, | ||
"test": { | ||
"type": "NumericLiteral", | ||
"start":47,"end":48,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1}}, | ||
"extra": { | ||
"rawValue": 0, | ||
"raw": "0" | ||
}, | ||
"value": 0 | ||
}, | ||
"consequent": { | ||
"type": "ArrowFunctionExpression", | ||
"start":51,"end":66,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":19}}, | ||
"id": null, | ||
"generator": false, | ||
"async": false, | ||
"params": [ | ||
{ | ||
"type": "Identifier", | ||
"start":51,"end":52,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"v"}, | ||
"name": "v" | ||
} | ||
], | ||
"body": { | ||
"type": "AssignmentExpression", | ||
"start":57,"end":65,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":18}}, | ||
"extra": { | ||
"parenthesized": true, | ||
"parenStart": 56 | ||
}, | ||
"operator": "+=", | ||
"left": { | ||
"type": "Identifier", | ||
"start":57,"end":60,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13},"identifierName":"sum"}, | ||
"name": "sum" | ||
}, | ||
"right": { | ||
"type": "Identifier", | ||
"start":64,"end":65,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"v"}, | ||
"name": "v" | ||
} | ||
} | ||
}, | ||
"alternate": { | ||
"type": "ArrowFunctionExpression", | ||
"start":69,"end":75,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":28}}, | ||
"id": null, | ||
"generator": false, | ||
"async": false, | ||
"params": [ | ||
{ | ||
"type": "Identifier", | ||
"start":69,"end":70,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":23},"identifierName":"v"}, | ||
"name": "v" | ||
} | ||
], | ||
"body": { | ||
"type": "NumericLiteral", | ||
"start":74,"end":75,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":28}}, | ||
"extra": { | ||
"rawValue": 0, | ||
"raw": "0" | ||
}, | ||
"value": 0 | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
}, | ||
"comments": [ | ||
{ | ||
"type": "CommentLine", | ||
"value": " https://github.com/babel/babel/issues/11038", | ||
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}} | ||
} | ||
] | ||
} |
1 change: 1 addition & 0 deletions
1
...babel-parser/test/fixtures/typescript/arrow-function/arrow-like-in-conditional-2/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 @@ | ||
0 ? v => (sum = v) : v => 0; |
3 changes: 3 additions & 0 deletions
3
...l-parser/test/fixtures/typescript/arrow-function/arrow-like-in-conditional-2/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,3 @@ | ||
{ | ||
"throws": "Unexpected token, expected \":\" (1:27)" | ||
} |
1 change: 1 addition & 0 deletions
1
...babel-parser/test/fixtures/typescript/arrow-function/arrow-like-in-conditional-3/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 @@ | ||
0 ? v => (sum = v) : v => 0 : v => 0; |
Oops, something went wrong.