Parser refactoring (#11871)
* refactor: parseMaybeUnary => parseUnary * refactor: extract shouldExitDescending method * refactor: add parseUpdate * refactor: avoid comparing with hardcoded token value * refactor: add ParseNewOrNewTarget * refactor: add parseCoverCallAndAsyncArrowHead * add parseBind * refactor: polish parseTaggedTemplateExpression interface * refactor: add parseMember method * refactor: add parseSuper method * refactor: add parseAsyncArrowUnaryFunction method * fix: disallow line break before async binding arrow * refactor: simplify tt.name logic * refactor: add parseDo method * refactor: misc * refactor: rename parseObjectMember by parsePropertyDefinition * refactor: unify set/get/async keyword parsing in ObjectMethod * refactor: misc * refactor: add parseArrayLike method * refactor: move fsharp epilogure and prologue inside parseObjectLike * fixup * refactor: rename parseFunctionExpression to parseFunctionOrFunctionSent * refactor: remove redundant logic * refactor: rename parseClassPropertyName by parseClassElementName * refactor: avoid unecessary lookahead when parsing tt._export * fix: export-default-from should support escaped async as export binding * address review comments * parseUnary -> parseMaybeUnary
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \"{\" (1:7)"
|
||||
}
|
||||
}
|
||||
2
packages/babel-parser/test/fixtures/es2017/async-functions/newline-before-arrow/input.js
vendored
Normal file
2
packages/babel-parser/test/fixtures/es2017/async-functions/newline-before-arrow/input.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
async x
|
||||
=> x
|
||||
39
packages/babel-parser/test/fixtures/es2017/async-functions/newline-before-arrow/output.json
vendored
Normal file
39
packages/babel-parser/test/fixtures/es2017/async-functions/newline-before-arrow/output.json
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}},
|
||||
"errors": [
|
||||
"SyntaxError: No line break is allowed before '=>' (2:2)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"},
|
||||
"name": "x"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "Identifier",
|
||||
"start":11,"end":12,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":4},"identifierName":"x"},
|
||||
"name": "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user