fix: disallow expression after binding identifier of (#11355)

This commit is contained in:
Huáng Jùnliàng
2020-04-21 15:12:23 -04:00
committed by GitHub
parent d18d465cf3
commit fba64d439d
11 changed files with 174 additions and 1 deletions

View File

@@ -3456,4 +3456,18 @@ export default (superClass: Class<Parser>): Class<Parser> =>
});
return this.finishNode(node, "EnumDeclaration");
}
updateContext(prevType: TokenType): void {
if (
this.match(tt.name) &&
this.state.value === "of" &&
prevType === tt.name &&
this.input.slice(this.state.lastTokStart, this.state.lastTokEnd) ===
"interface"
) {
this.state.exprAllowed = false;
} else {
super.updateContext(prevType);
}
}
};