Disallow await before exponential (#12441)
* refactor: move unary exponential check to parseMaybeUnary * fix: disallow await before exponential * add test cases
This commit is contained in:
@@ -0,0 +1 @@
|
||||
async () => (await 5) ** 6;
|
||||
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BinaryExpression",
|
||||
"start":12,"end":26,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":26}},
|
||||
"left": {
|
||||
"type": "ParenthesizedExpression",
|
||||
"start":12,"end":21,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":21}},
|
||||
"expression": {
|
||||
"type": "AwaitExpression",
|
||||
"start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}},
|
||||
"argument": {
|
||||
"type": "NumericLiteral",
|
||||
"start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}},
|
||||
"extra": {
|
||||
"rawValue": 5,
|
||||
"raw": "5"
|
||||
},
|
||||
"value": 5
|
||||
}
|
||||
}
|
||||
},
|
||||
"operator": "**",
|
||||
"right": {
|
||||
"type": "NumericLiteral",
|
||||
"start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}},
|
||||
"extra": {
|
||||
"rawValue": 6,
|
||||
"raw": "6"
|
||||
},
|
||||
"value": 6
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user