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:
Huáng Jùnliàng
2020-10-26 11:42:02 -04:00
committed by GitHub
parent faaebfe91f
commit 2782a549e9
63 changed files with 1533 additions and 200 deletions

View File

@@ -8,6 +8,7 @@ import StatementParser from "./statement";
import { SCOPE_PROGRAM } from "../util/scopeflags";
import ScopeHandler from "../util/scope";
import ClassScopeHandler from "../util/class-scope";
import ExpressionScopeHandler from "../util/expression-scope";
import ProductionParameterHandler, {
PARAM_AWAIT,
PARAM,
@@ -34,6 +35,7 @@ export default class Parser extends StatementParser {
this.scope = new ScopeHandler(this.raise.bind(this), this.inModule);
this.prodParam = new ProductionParameterHandler();
this.classScope = new ClassScopeHandler(this.raise.bind(this));
this.expressionScope = new ExpressionScopeHandler(this.raise.bind(this));
this.plugins = pluginsMap(this.options.plugins);
this.filename = options.sourceFilename;
}