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

Handle shadowed globals when they are JSX names #642

Merged

Conversation

matthieugicquel
Copy link
Contributor

The existing logic to identify shadowed globals was not used when the shadowed name is a JSX name, even though shadowing can happen in this case.

I encountered that while using sucrase so here's the change that makes this case work

@github-actions
Copy link

github-actions bot commented Aug 9, 2021

Benchmark results

Before this PR: 281 thousand lines per second
After this PR: 275.6 thousand lines per second

Measured change: 1.9% slower (7.31% slower to 1.24% faster)
Summary: Likely no significant difference

Copy link
Owner

@alangpierce alangpierce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, looks good to me!

@codecov
Copy link

codecov bot commented Aug 9, 2021

Codecov Report

Merging #642 (6188a2b) into main (bacc167) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #642      +/-   ##
==========================================
+ Coverage   82.58%   82.65%   +0.07%     
==========================================
  Files          56       56              
  Lines        5689     5928     +239     
  Branches     1343     1344       +1     
==========================================
+ Hits         4698     4900     +202     
- Misses        708      745      +37     
  Partials      283      283              
Impacted Files Coverage Δ
src/identifyShadowedGlobals.ts 88.09% <100.00%> (-0.80%) ⬇️
src/util/formatTokens.ts 70.58% <0.00%> (-10.06%) ⬇️
src/parser/util/identifier.ts 90.90% <0.00%> (-4.10%) ⬇️
src/util/shouldElideDefaultExport.ts 77.77% <0.00%> (-3.48%) ⬇️
src/util/getClassInfo.ts 87.85% <0.00%> (-1.85%) ⬇️
src/parser/plugins/jsx/index.ts 91.33% <0.00%> (-1.48%) ⬇️
src/parser/plugins/flow.ts 63.99% <0.00%> (-1.09%) ⬇️
src/parser/traverser/expression.ts 88.36% <0.00%> (-0.13%) ⬇️
src/Options.ts 100.00% <0.00%> (ø)
... and 20 more

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 bacc167...6188a2b. Read the comment docs.

@alangpierce alangpierce merged commit d48d82d into alangpierce:main Aug 9, 2021
@alangpierce
Copy link
Owner

Just released as sucrase@3.20.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants