fix: disallow expression after binding identifier of (#11355)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -59,7 +59,10 @@ tt.name.updateContext = function(prevType) {
|
||||
let allowed = false;
|
||||
if (prevType !== tt.dot) {
|
||||
if (
|
||||
(this.state.value === "of" && !this.state.exprAllowed) ||
|
||||
(this.state.value === "of" &&
|
||||
!this.state.exprAllowed &&
|
||||
prevType !== tt._function &&
|
||||
prevType !== tt._class) ||
|
||||
(this.state.value === "yield" && this.prodParam.hasYield)
|
||||
) {
|
||||
allowed = true;
|
||||
|
||||
Reference in New Issue
Block a user