Do not register ambient classes to the TS scope (#10352)

This commit is contained in:
Nicolò Ribaudo
2019-08-21 00:22:47 +02:00
committed by Brian Ng
parent 11ed2e2bf5
commit 15aa511b8e
10 changed files with 468 additions and 8 deletions

View File

@@ -20,6 +20,7 @@ import {
SCOPE_OTHER,
SCOPE_SIMPLE_CATCH,
SCOPE_SUPER,
type BindingTypes,
} from "../util/scopeflags";
const loopLabel = { kind: "loop" },
@@ -1611,11 +1612,12 @@ export default class StatementParser extends ExpressionParser {
node: N.Class,
isStatement: boolean,
optionalId: ?boolean,
bindingType: BindingTypes = BIND_CLASS,
): void {
if (this.match(tt.name)) {
node.id = this.parseIdentifier();
if (isStatement) {
this.checkLVal(node.id, BIND_CLASS, undefined, "class name");
this.checkLVal(node.id, bindingType, undefined, "class name");
}
} else {
if (optionalId || !isStatement) {