Huáng Jùnliàng 108564fdad
refactor: raise AwaitNotInAsyncContext when an AwaitExpression will be parsed (#12716)
* refactor: raise AwaitNotInAsyncContext when an AwaitExpression will be parsed

* tweak logic

* early exit when errors are before thrown error position

* fix: always return true in assert.throws callback

See https://nodejs.org/api/assert.html#assert_assert_throws_fn_error_message

* update test fixtures

* fix flow error
2021-02-01 10:46:43 -05:00

31 lines
976 B
JSON

{
"type": "File",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"errors": [
"SyntaxError: Unexpected reserved word 'await' (1:6)"
],
"program": {
"type": "Program",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ClassDeclaration",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"id": {
"type": "Identifier",
"start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"await"},
"name": "await"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}},
"body": []
}
}
],
"directives": []
}
}