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:
@@ -57,13 +57,7 @@ export default class State {
|
||||
noArrowParamsConversionAt: number[] = [];
|
||||
|
||||
// Flags to track
|
||||
inParameters: boolean = false;
|
||||
maybeInArrowParameters: boolean = false;
|
||||
// This flag is used to track async arrow head across function declarations.
|
||||
// e.g. async (foo = function (await) {}) => {}
|
||||
// When parsing `await` in this expression, `maybeInAsyncArrowHead` is true
|
||||
// but `maybeInArrowParameters` is false
|
||||
maybeInAsyncArrowHead: boolean = false;
|
||||
inPipeline: boolean = false;
|
||||
inType: boolean = false;
|
||||
noAnonFunctionType: boolean = false;
|
||||
@@ -94,10 +88,6 @@ export default class State {
|
||||
// where @foo belongs to the outer class and @bar to the inner
|
||||
decoratorStack: Array<Array<N.Decorator>> = [[]];
|
||||
|
||||
// Positions to delayed-check that yield/await does not exist in default parameters.
|
||||
yieldPos: number = -1;
|
||||
awaitPos: number = -1;
|
||||
|
||||
// Comment store.
|
||||
comments: Array<N.Comment> = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user