Fix scope checks with enabled flow plugin (#9719)

This commit is contained in:
Daniel Tschinder
2019-03-20 16:03:31 -07:00
committed by GitHub
parent 92fcd31eac
commit ab41cb2cda
3 changed files with 318 additions and 0 deletions

View File

@@ -10,9 +10,11 @@ import { types as tc } from "../tokenizer/context";
import * as charCodes from "charcodes";
import { isIteratorStart } from "../util/identifier";
import {
functionFlags,
type BindingTypes,
BIND_NONE,
BIND_LEXICAL,
SCOPE_ARROW,
SCOPE_OTHER,
} from "../util/scopeflags";
@@ -1776,8 +1778,11 @@ export default (superClass: Class<Parser>): Class<Parser> =>
true,
"arrow function parameters",
);
// Enter scope, as checkParams defines bindings
this.scope.enter(functionFlags(false, false) | SCOPE_ARROW);
// Use super's method to force the parameters to be checked
super.checkParams(node, false, true);
this.scope.exit();
} else {
arrows.push(node);
}