Skip to content
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

Merged
merged 1 commit into from
Jun 5, 2017

Conversation

jridgewell
Copy link
Member

@jridgewell jridgewell commented Jun 4, 2017

Q A
Patch: Bug Fix? No
Major: Breaking Change? No
Minor: New Feature? No
Deprecations? No
Spec Compliancy? No
Tests Added/Pass? No
Fixed Tickets
License MIT
Doc PR
Dependency Changes

MemberExpression, ObjectMethod, and ObjectProperty, and ClassMethod's property validators recreated their validating closure every time.

@jridgewell jridgewell added the PR: Polish 💅 A type of pull request used for our changelog categories label Jun 4, 2017
@mention-bot
Copy link

@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.

@codecov
Copy link

codecov bot commented Jun 4, 2017

Codecov Report

Merging #5821 into 7.0 will decrease coverage by <.01%.
The diff coverage is 91.66%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
packages/babel-types/src/definitions/es2015.js 96.66% <83.33%> (+0.51%) ⬆️
packages/babel-types/src/definitions/core.js 98.52% <94.44%> (+0.31%) ⬆️
packages/babel-helper-call-delegate/src/index.js 64% <0%> (-4%) ⬇️
packages/babel-traverse/src/path/modification.js 72.11% <0%> (-0.97%) ⬇️
packages/babel-traverse/src/path/context.js 85.34% <0%> (-0.87%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e55653...eaaa09e. Read the comment docs.

},
validate: (function () {
const normal = assertNodeType("Identifier");
const computed = assertNodeType("Expression");
Copy link
Member

@hzoo hzoo Jun 5, 2017

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'

Copy link
Member

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)

@hzoo hzoo merged commit 53e3f0d into babel:7.0 Jun 5, 2017
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: perf outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Polish 💅 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants