fix(babel-parser): chain off optionally chained keys named cla… (#11198)

* fix(babel-parser): chain off optionally chained keys named class and function

Fixes #11197

* Extract override as variable to satisfy typechecker

Flow did not trust that curContext.override would be defined
This commit is contained in:
vages
2020-03-03 17:27:41 +00:00
committed by GitHub
parent 8f281f578d
commit 2603c2e227
3 changed files with 476 additions and 2 deletions

View File

@@ -233,8 +233,9 @@ export default class Tokenizer extends LocationParser {
return;
}
if (curContext.override) {
curContext.override(this);
const override = curContext?.override;
if (override) {
override(this);
} else {
this.getTokenFromCode(this.input.codePointAt(this.state.pos));
}