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:
Huáng Jùnliàng
2021-03-25 11:20:47 -04:00
committed by GitHub
parent 2ae19d01b1
commit 0067fd9e02
18 changed files with 501 additions and 16 deletions

View File

@@ -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": []
}
}