-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
babel-types: avoid recreating validator closures #5821
Conversation
@jridgewell, thanks for your PR! By analyzing the history of the files in this pull request, we identified @existentialism, @hzoo and @phantom10111 to be potential reviewers. |
55131af
to
2fae543
Compare
Codecov Report
@@ Coverage Diff @@
## 7.0 #5821 +/- ##
=========================================
- Coverage 84.91% 84.9% -0.01%
=========================================
Files 284 284
Lines 9930 9946 +16
Branches 2788 2788
=========================================
+ Hits 8432 8445 +13
- Misses 988 991 +3
Partials 510 510
Continue to review full report at Codecov.
|
2fae543
to
eaaa09e
Compare
}, | ||
validate: (function () { | ||
const normal = assertNodeType("Identifier"); | ||
const computed = assertNodeType("Expression"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably unnecessary but we could just hoist and reuse assertNodeType("Expression")
everywhere right? Or just precompute everything (I guess that's what prepack would do).
I was joking a while ago we could do a babel-plugin that computes things like t.isFunctionExpression()
-> node.type === 'FunctionExpression'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably measure all that stuff though (and would also cause more bugs)
MemberExpression
,ObjectMethod
, andObjectProperty
, andClassMethod
'sproperty
validators recreated their validating closure every time.