Skip to content

Commit

Permalink
fix(babel-parser): chain off optionally chained keys named cla… (#11198)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Vages committed Mar 3, 2020
1 parent 8f281f5 commit 2603c2e
Show file tree
Hide file tree
Showing 3 changed files with 476 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/babel-parser/src/tokenizer/index.js
Expand Up @@ -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));
}
Expand Down
@@ -0,0 +1,4 @@
foo?.class.bar
foo?.function.bar
foo?.bar?.class.bar
foo?.function?.bar

0 comments on commit 2603c2e

Please sign in to comment.