[flow] Fix parsing of arrows in conditional exprs in parens (#13655)

This commit is contained in:
Nicolò Ribaudo 2021-08-10 20:46:38 +02:00 committed by GitHub
parent 9d0aa1ec9d
commit e721f61110
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 739 additions and 24 deletions

View File

@ -1911,24 +1911,21 @@ export default (superClass: Class<Parser>): Class<Parser> =>
): N.Expression {
if (!this.match(tt.question)) return expr;
// only use the expensive "tryParse" method if there is a question mark
// and if we come from inside parens
if (this.state.maybeInArrowParameters) {
const result = this.tryParse(() =>
super.parseConditional(expr, startPos, startLoc),
);
if (!result.node) {
if (result.error) {
/*:: invariant(refExpressionErrors != null) */
super.setOptionalParametersError(refExpressionErrors, result.error);
}
const nextCh = this.lookaheadCharCode();
// These tokens cannot start an expression, so if one of them follows
// ? then we are probably in an arrow function parameters list and we
// don't parse the conditional expression.
if (
nextCh === charCodes.comma || // (a?, b) => c
nextCh === charCodes.equalsTo || // (a? = b) => c
nextCh === charCodes.colon || // (a?: b) => c
nextCh === charCodes.rightParenthesis // (a?) => c
) {
/*:: invariant(refExpressionErrors != null) */
this.setOptionalParametersError(refExpressionErrors);
return expr;
}
if (result.error) this.state = result.failState;
return result.node;
}
this.expect(tt.question);

View File

@ -0,0 +1,11 @@
(a ? (b = c) : d => e); // a ? (b = c) : (d => e)
(a ? (b += c) : d => e); // a ? (b += c) : (d => e)
(a ? (b = c) : d => e : f); // a ? ((b = c): d => e) : f
(a ? (b += c) : d => e : f); // ((a ? (b += c) : (d => e)) : f)
(a ? b => (c = d) : e => f); // a ? (b => (c = d)) : (e => f)
(a ? b => (c += d) : e => f); // a ? (b => (c += d)) : (e => f)
(a ? b => (c = d) : e => f : g); // a ? (b => ((c = d): e => f)) : g
(a ? b => (c += d) : e => f : g); // ((a ? (b => (c += d)) : (e => f)) : g)

View File

@ -0,0 +1,712 @@
{
"type": "File",
"start":0,"end":496,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":75}},
"program": {
"type": "Program",
"start":0,"end":496,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":75}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}},
"expression": {
"type": "ConditionalExpression",
"start":1,"end":21,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":21}},
"test": {
"type": "Identifier",
"start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"},
"name": "a"
},
"consequent": {
"type": "AssignmentExpression",
"start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}},
"operator": "=",
"left": {
"type": "Identifier",
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"b"},
"name": "b"
},
"right": {
"type": "Identifier",
"start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"c"},
"name": "c"
},
"extra": {
"parenthesized": true,
"parenStart": 5
}
},
"alternate": {
"type": "ArrowFunctionExpression",
"start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Identifier",
"start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"d"},
"name": "d"
}
],
"body": {
"type": "Identifier",
"start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"e"},
"name": "e"
}
},
"extra": {
"parenthesized": true,
"parenStart": 0
}
},
"trailingComments": [
{
"type": "CommentLine",
"value": " a ? (b = c) : (d => e)",
"start":24,"end":49,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":49}}
}
]
},
{
"type": "ExpressionStatement",
"start":50,"end":74,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":24}},
"expression": {
"type": "ConditionalExpression",
"start":51,"end":72,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":22}},
"test": {
"type": "Identifier",
"start":51,"end":52,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":2},"identifierName":"a"},
"name": "a"
},
"consequent": {
"type": "AssignmentExpression",
"start":56,"end":62,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":12}},
"operator": "+=",
"left": {
"type": "Identifier",
"start":56,"end":57,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"b"},
"name": "b"
},
"right": {
"type": "Identifier",
"start":61,"end":62,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"c"},
"name": "c"
},
"extra": {
"parenthesized": true,
"parenStart": 55
}
},
"alternate": {
"type": "ArrowFunctionExpression",
"start":66,"end":72,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":22}},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Identifier",
"start":66,"end":67,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"d"},
"name": "d"
}
],
"body": {
"type": "Identifier",
"start":71,"end":72,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":22},"identifierName":"e"},
"name": "e"
}
},
"extra": {
"parenthesized": true,
"parenStart": 50
}
},
"trailingComments": [
{
"type": "CommentLine",
"value": " a ? (b += c) : (d => e)",
"start":75,"end":101,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":51}}
}
],
"leadingComments": [
{
"type": "CommentLine",
"value": " a ? (b = c) : (d => e)",
"start":24,"end":49,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":49}}
}
]
},
{
"type": "ExpressionStatement",
"start":103,"end":130,"loc":{"start":{"line":4,"column":0},"end":{"line":4,"column":27}},
"expression": {
"type": "ConditionalExpression",
"start":104,"end":128,"loc":{"start":{"line":4,"column":1},"end":{"line":4,"column":25}},
"test": {
"type": "Identifier",
"start":104,"end":105,"loc":{"start":{"line":4,"column":1},"end":{"line":4,"column":2},"identifierName":"a"},
"name": "a"
},
"consequent": {
"type": "ArrowFunctionExpression",
"start":108,"end":124,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":21}},
"predicate": null,
"returnType": {
"type": "TypeAnnotation",
"start":116,"end":119,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":16}},
"typeAnnotation": {
"type": "GenericTypeAnnotation",
"start":118,"end":119,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":16}},
"typeParameters": null,
"id": {
"type": "Identifier",
"start":118,"end":119,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":16},"identifierName":"d"},
"name": "d"
}
}
},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "AssignmentPattern",
"start":109,"end":114,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":11}},
"left": {
"type": "Identifier",
"start":109,"end":110,"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":7},"identifierName":"b"},
"name": "b"
},
"right": {
"type": "Identifier",
"start":113,"end":114,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":11},"identifierName":"c"},
"name": "c"
}
}
],
"body": {
"type": "Identifier",
"start":123,"end":124,"loc":{"start":{"line":4,"column":20},"end":{"line":4,"column":21},"identifierName":"e"},
"name": "e"
}
},
"alternate": {
"type": "Identifier",
"start":127,"end":128,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":25},"identifierName":"f"},
"name": "f"
},
"extra": {
"parenthesized": true,
"parenStart": 103
}
},
"trailingComments": [
{
"type": "CommentLine",
"value": " a ? ((b = c): d => e) : f",
"start":131,"end":159,"loc":{"start":{"line":4,"column":28},"end":{"line":4,"column":56}}
}
],
"leadingComments": [
{
"type": "CommentLine",
"value": " a ? (b += c) : (d => e)",
"start":75,"end":101,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":51}}
}
]
},
{
"type": "ExpressionStatement",
"start":160,"end":188,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":28}},
"expression": {
"type": "TypeCastExpression",
"start":161,"end":186,"loc":{"start":{"line":5,"column":1},"end":{"line":5,"column":26}},
"expression": {
"type": "ConditionalExpression",
"start":161,"end":182,"loc":{"start":{"line":5,"column":1},"end":{"line":5,"column":22}},
"test": {
"type": "Identifier",
"start":161,"end":162,"loc":{"start":{"line":5,"column":1},"end":{"line":5,"column":2},"identifierName":"a"},
"name": "a"
},
"consequent": {
"type": "AssignmentExpression",
"start":166,"end":172,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":12}},
"operator": "+=",
"left": {
"type": "Identifier",
"start":166,"end":167,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":7},"identifierName":"b"},
"name": "b"
},
"right": {
"type": "Identifier",
"start":171,"end":172,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":12},"identifierName":"c"},
"name": "c"
},
"extra": {
"parenthesized": true,
"parenStart": 165
}
},
"alternate": {
"type": "ArrowFunctionExpression",
"start":176,"end":182,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":22}},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Identifier",
"start":176,"end":177,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":17},"identifierName":"d"},
"name": "d"
}
],
"body": {
"type": "Identifier",
"start":181,"end":182,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":22},"identifierName":"e"},
"name": "e"
}
}
},
"typeAnnotation": {
"type": "TypeAnnotation",
"start":183,"end":186,"loc":{"start":{"line":5,"column":23},"end":{"line":5,"column":26}},
"typeAnnotation": {
"type": "GenericTypeAnnotation",
"start":185,"end":186,"loc":{"start":{"line":5,"column":25},"end":{"line":5,"column":26}},
"typeParameters": null,
"id": {
"type": "Identifier",
"start":185,"end":186,"loc":{"start":{"line":5,"column":25},"end":{"line":5,"column":26},"identifierName":"f"},
"name": "f"
}
}
},
"extra": {
"parenthesized": true,
"parenStart": 160
}
},
"trailingComments": [
{
"type": "CommentLine",
"value": " ((a ? (b += c) : (d => e)) : f)",
"start":189,"end":223,"loc":{"start":{"line":5,"column":29},"end":{"line":5,"column":63}}
}
],
"leadingComments": [
{
"type": "CommentLine",
"value": " a ? ((b = c): d => e) : f",
"start":131,"end":159,"loc":{"start":{"line":4,"column":28},"end":{"line":4,"column":56}}
}
]
},
{
"type": "ExpressionStatement",
"start":225,"end":253,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":28}},
"expression": {
"type": "ConditionalExpression",
"start":226,"end":251,"loc":{"start":{"line":7,"column":1},"end":{"line":7,"column":26}},
"test": {
"type": "Identifier",
"start":226,"end":227,"loc":{"start":{"line":7,"column":1},"end":{"line":7,"column":2},"identifierName":"a"},
"name": "a"
},
"consequent": {
"type": "ArrowFunctionExpression",
"start":230,"end":242,"loc":{"start":{"line":7,"column":5},"end":{"line":7,"column":17}},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Identifier",
"start":230,"end":231,"loc":{"start":{"line":7,"column":5},"end":{"line":7,"column":6},"identifierName":"b"},
"name": "b"
}
],
"body": {
"type": "AssignmentExpression",
"start":236,"end":241,"loc":{"start":{"line":7,"column":11},"end":{"line":7,"column":16}},
"operator": "=",
"left": {
"type": "Identifier",
"start":236,"end":237,"loc":{"start":{"line":7,"column":11},"end":{"line":7,"column":12},"identifierName":"c"},
"name": "c"
},
"right": {
"type": "Identifier",
"start":240,"end":241,"loc":{"start":{"line":7,"column":15},"end":{"line":7,"column":16},"identifierName":"d"},
"name": "d"
},
"extra": {
"parenthesized": true,
"parenStart": 235
}
}
},
"alternate": {
"type": "ArrowFunctionExpression",
"start":245,"end":251,"loc":{"start":{"line":7,"column":20},"end":{"line":7,"column":26}},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Identifier",
"start":245,"end":246,"loc":{"start":{"line":7,"column":20},"end":{"line":7,"column":21},"identifierName":"e"},
"name": "e"
}
],
"body": {
"type": "Identifier",
"start":250,"end":251,"loc":{"start":{"line":7,"column":25},"end":{"line":7,"column":26},"identifierName":"f"},
"name": "f"
}
},
"extra": {
"parenthesized": true,
"parenStart": 225
}
},
"trailingComments": [
{
"type": "CommentLine",
"value": " a ? (b => (c = d)) : (e => f)",
"start":254,"end":286,"loc":{"start":{"line":7,"column":29},"end":{"line":7,"column":61}}
}
],
"leadingComments": [
{
"type": "CommentLine",
"value": " ((a ? (b += c) : (d => e)) : f)",
"start":189,"end":223,"loc":{"start":{"line":5,"column":29},"end":{"line":5,"column":63}}
}
]
},
{
"type": "ExpressionStatement",
"start":287,"end":316,"loc":{"start":{"line":8,"column":0},"end":{"line":8,"column":29}},
"expression": {
"type": "ConditionalExpression",
"start":288,"end":314,"loc":{"start":{"line":8,"column":1},"end":{"line":8,"column":27}},
"test": {
"type": "Identifier",
"start":288,"end":289,"loc":{"start":{"line":8,"column":1},"end":{"line":8,"column":2},"identifierName":"a"},
"name": "a"
},
"consequent": {
"type": "ArrowFunctionExpression",
"start":292,"end":305,"loc":{"start":{"line":8,"column":5},"end":{"line":8,"column":18}},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Identifier",
"start":292,"end":293,"loc":{"start":{"line":8,"column":5},"end":{"line":8,"column":6},"identifierName":"b"},
"name": "b"
}
],
"body": {
"type": "AssignmentExpression",
"start":298,"end":304,"loc":{"start":{"line":8,"column":11},"end":{"line":8,"column":17}},
"operator": "+=",
"left": {
"type": "Identifier",
"start":298,"end":299,"loc":{"start":{"line":8,"column":11},"end":{"line":8,"column":12},"identifierName":"c"},
"name": "c"
},
"right": {
"type": "Identifier",
"start":303,"end":304,"loc":{"start":{"line":8,"column":16},"end":{"line":8,"column":17},"identifierName":"d"},
"name": "d"
},
"extra": {
"parenthesized": true,
"parenStart": 297
}
}
},
"alternate": {
"type": "ArrowFunctionExpression",
"start":308,"end":314,"loc":{"start":{"line":8,"column":21},"end":{"line":8,"column":27}},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Identifier",
"start":308,"end":309,"loc":{"start":{"line":8,"column":21},"end":{"line":8,"column":22},"identifierName":"e"},
"name": "e"
}
],
"body": {
"type": "Identifier",
"start":313,"end":314,"loc":{"start":{"line":8,"column":26},"end":{"line":8,"column":27},"identifierName":"f"},
"name": "f"
}
},
"extra": {
"parenthesized": true,
"parenStart": 287
}
},
"trailingComments": [
{
"type": "CommentLine",
"value": " a ? (b => (c += d)) : (e => f)",
"start":317,"end":350,"loc":{"start":{"line":8,"column":30},"end":{"line":8,"column":63}}
}
],
"leadingComments": [
{
"type": "CommentLine",
"value": " a ? (b => (c = d)) : (e => f)",
"start":254,"end":286,"loc":{"start":{"line":7,"column":29},"end":{"line":7,"column":61}}
}
]
},
{
"type": "ExpressionStatement",
"start":352,"end":384,"loc":{"start":{"line":10,"column":0},"end":{"line":10,"column":32}},
"expression": {
"type": "ConditionalExpression",
"start":353,"end":382,"loc":{"start":{"line":10,"column":1},"end":{"line":10,"column":30}},
"test": {
"type": "Identifier",
"start":353,"end":354,"loc":{"start":{"line":10,"column":1},"end":{"line":10,"column":2},"identifierName":"a"},
"name": "a"
},
"consequent": {
"type": "ArrowFunctionExpression",
"start":357,"end":378,"loc":{"start":{"line":10,"column":5},"end":{"line":10,"column":26}},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Identifier",
"start":357,"end":358,"loc":{"start":{"line":10,"column":5},"end":{"line":10,"column":6},"identifierName":"b"},
"name": "b"
}
],
"body": {
"type": "ArrowFunctionExpression",
"start":362,"end":378,"loc":{"start":{"line":10,"column":10},"end":{"line":10,"column":26}},
"predicate": null,
"returnType": {
"type": "TypeAnnotation",
"start":370,"end":373,"loc":{"start":{"line":10,"column":18},"end":{"line":10,"column":21}},
"typeAnnotation": {
"type": "GenericTypeAnnotation",
"start":372,"end":373,"loc":{"start":{"line":10,"column":20},"end":{"line":10,"column":21}},
"typeParameters": null,
"id": {
"type": "Identifier",
"start":372,"end":373,"loc":{"start":{"line":10,"column":20},"end":{"line":10,"column":21},"identifierName":"e"},
"name": "e"
}
}
},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "AssignmentPattern",
"start":363,"end":368,"loc":{"start":{"line":10,"column":11},"end":{"line":10,"column":16}},
"left": {
"type": "Identifier",
"start":363,"end":364,"loc":{"start":{"line":10,"column":11},"end":{"line":10,"column":12},"identifierName":"c"},
"name": "c"
},
"right": {
"type": "Identifier",
"start":367,"end":368,"loc":{"start":{"line":10,"column":15},"end":{"line":10,"column":16},"identifierName":"d"},
"name": "d"
}
}
],
"body": {
"type": "Identifier",
"start":377,"end":378,"loc":{"start":{"line":10,"column":25},"end":{"line":10,"column":26},"identifierName":"f"},
"name": "f"
}
}
},
"alternate": {
"type": "Identifier",
"start":381,"end":382,"loc":{"start":{"line":10,"column":29},"end":{"line":10,"column":30},"identifierName":"g"},
"name": "g"
},
"extra": {
"parenthesized": true,
"parenStart": 352
}
},
"trailingComments": [
{
"type": "CommentLine",
"value": " a ? (b => ((c = d): e => f)) : g",
"start":385,"end":420,"loc":{"start":{"line":10,"column":33},"end":{"line":10,"column":68}}
}
],
"leadingComments": [
{
"type": "CommentLine",
"value": " a ? (b => (c += d)) : (e => f)",
"start":317,"end":350,"loc":{"start":{"line":8,"column":30},"end":{"line":8,"column":63}}
}
]
},
{
"type": "ExpressionStatement",
"start":421,"end":454,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":33}},
"expression": {
"type": "TypeCastExpression",
"start":422,"end":452,"loc":{"start":{"line":11,"column":1},"end":{"line":11,"column":31}},
"expression": {
"type": "ConditionalExpression",
"start":422,"end":448,"loc":{"start":{"line":11,"column":1},"end":{"line":11,"column":27}},
"test": {
"type": "Identifier",
"start":422,"end":423,"loc":{"start":{"line":11,"column":1},"end":{"line":11,"column":2},"identifierName":"a"},
"name": "a"
},
"consequent": {
"type": "ArrowFunctionExpression",
"start":426,"end":439,"loc":{"start":{"line":11,"column":5},"end":{"line":11,"column":18}},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Identifier",
"start":426,"end":427,"loc":{"start":{"line":11,"column":5},"end":{"line":11,"column":6},"identifierName":"b"},
"name": "b"
}
],
"body": {
"type": "AssignmentExpression",
"start":432,"end":438,"loc":{"start":{"line":11,"column":11},"end":{"line":11,"column":17}},
"operator": "+=",
"left": {
"type": "Identifier",
"start":432,"end":433,"loc":{"start":{"line":11,"column":11},"end":{"line":11,"column":12},"identifierName":"c"},
"name": "c"
},
"right": {
"type": "Identifier",
"start":437,"end":438,"loc":{"start":{"line":11,"column":16},"end":{"line":11,"column":17},"identifierName":"d"},
"name": "d"
},
"extra": {
"parenthesized": true,
"parenStart": 431
}
}
},
"alternate": {
"type": "ArrowFunctionExpression",
"start":442,"end":448,"loc":{"start":{"line":11,"column":21},"end":{"line":11,"column":27}},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Identifier",
"start":442,"end":443,"loc":{"start":{"line":11,"column":21},"end":{"line":11,"column":22},"identifierName":"e"},
"name": "e"
}
],
"body": {
"type": "Identifier",
"start":447,"end":448,"loc":{"start":{"line":11,"column":26},"end":{"line":11,"column":27},"identifierName":"f"},
"name": "f"
}
}
},
"typeAnnotation": {
"type": "TypeAnnotation",
"start":449,"end":452,"loc":{"start":{"line":11,"column":28},"end":{"line":11,"column":31}},
"typeAnnotation": {
"type": "GenericTypeAnnotation",
"start":451,"end":452,"loc":{"start":{"line":11,"column":30},"end":{"line":11,"column":31}},
"typeParameters": null,
"id": {
"type": "Identifier",
"start":451,"end":452,"loc":{"start":{"line":11,"column":30},"end":{"line":11,"column":31},"identifierName":"g"},
"name": "g"
}
}
},
"extra": {
"parenthesized": true,
"parenStart": 421
}
},
"trailingComments": [
{
"type": "CommentLine",
"value": " ((a ? (b => (c += d)) : (e => f)) : g)",
"start":455,"end":496,"loc":{"start":{"line":11,"column":34},"end":{"line":11,"column":75}}
}
],
"leadingComments": [
{
"type": "CommentLine",
"value": " a ? (b => ((c = d): e => f)) : g",
"start":385,"end":420,"loc":{"start":{"line":10,"column":33},"end":{"line":10,"column":68}}
}
]
}
],
"directives": []
},
"comments": [
{
"type": "CommentLine",
"value": " a ? (b = c) : (d => e)",
"start":24,"end":49,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":49}}
},
{
"type": "CommentLine",
"value": " a ? (b += c) : (d => e)",
"start":75,"end":101,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":51}}
},
{
"type": "CommentLine",
"value": " a ? ((b = c): d => e) : f",
"start":131,"end":159,"loc":{"start":{"line":4,"column":28},"end":{"line":4,"column":56}}
},
{
"type": "CommentLine",
"value": " ((a ? (b += c) : (d => e)) : f)",
"start":189,"end":223,"loc":{"start":{"line":5,"column":29},"end":{"line":5,"column":63}}
},
{
"type": "CommentLine",
"value": " a ? (b => (c = d)) : (e => f)",
"start":254,"end":286,"loc":{"start":{"line":7,"column":29},"end":{"line":7,"column":61}}
},
{
"type": "CommentLine",
"value": " a ? (b => (c += d)) : (e => f)",
"start":317,"end":350,"loc":{"start":{"line":8,"column":30},"end":{"line":8,"column":63}}
},
{
"type": "CommentLine",
"value": " a ? (b => ((c = d): e => f)) : g",
"start":385,"end":420,"loc":{"start":{"line":10,"column":33},"end":{"line":10,"column":68}}
},
{
"type": "CommentLine",
"value": " ((a ? (b => (c += d)) : (e => f)) : g)",
"start":455,"end":496,"loc":{"start":{"line":11,"column":34},"end":{"line":11,"column":75}}
}
]
}

View File

@ -1,8 +1,3 @@
{
"sourceType": "module",
"plugins": [
"jsx",
"flow"
],
"throws": "Unexpected token (1:8)"
}
"throws": "Unexpected token (1:7)"
}

View File

@ -1,3 +1,3 @@
{
"throws": "Unexpected token (1:13)"
"throws": "Unexpected token (1:12)"
}

View File

@ -1,3 +1,3 @@
{
"throws": "Unexpected token, expected \",\" (1:65)"
"throws": "Unexpected token (1:65)"
}