Refactor yield await classification (#12230)
* fix: incomplete ParamKind declaration * refactor: add expression scope handler * test: update test262 allowlist * chore: cleanup * fix: push expression scope for function body * fix: push new expression scope for initializer and static block * test: add more test cases * fix flow error * refactor: remove unecessary expression scope * fix: parameter initializer error should not cross expression scope boundary * chore: cleanup outdated comments * fix: do not record async arrow error on ParameterDeclaration * Update packages/babel-parser/src/util/expression-scope.js Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> * polish: clear ancestry declaration error on validate Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
@@ -1649,11 +1649,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
}
|
||||
|
||||
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
|
||||
const oldYieldPos = this.state.yieldPos;
|
||||
const oldAwaitPos = this.state.awaitPos;
|
||||
this.state.maybeInArrowParameters = true;
|
||||
this.state.yieldPos = -1;
|
||||
this.state.awaitPos = -1;
|
||||
|
||||
const res: ?N.ArrowFunctionExpression = this.tsTryParseAndCatch(() => {
|
||||
const node: N.ArrowFunctionExpression = this.startNodeAt(
|
||||
@@ -1669,8 +1665,6 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
});
|
||||
|
||||
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
|
||||
this.state.yieldPos = oldYieldPos;
|
||||
this.state.awaitPos = oldAwaitPos;
|
||||
|
||||
if (!res) {
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user