Refactor private name tokenizing (#13256)

* add benchmark

* refactor: create tt.privateName token for private names

* add backward compat privateName = hash + name to Babel 7

* perf: get private name SV from token value

* chore: tweak benchmark file

* chore: update test fixtures

* convert tt.privateName to PrivateIdentifier

* perf: avoid most isPrivateName call

* Update packages/babel-parser/src/parser/expression.js

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>

* perf: use inlinable codePointAtPos

* make prettier happy

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
This commit is contained in:
Huáng Jùnliàng
2021-05-06 09:46:09 -04:00
committed by GitHub
parent 278193b6f7
commit a387973821
24 changed files with 551 additions and 210 deletions

View File

@@ -210,7 +210,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
this.match(tt.braceL) ||
this.match(tt.star) ||
this.match(tt.ellipsis) ||
this.match(tt.hash) ||
this.match(tt.privateName) ||
this.isLiteralPropertyName()) &&
!this.hasPrecedingLineBreak()
);