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

refactor: re-use reserved names set #4304

Merged
merged 6 commits into from Dec 24, 2021

Conversation

dnalborczyk
Copy link
Contributor

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:

Description

@codecov
Copy link

codecov bot commented Dec 16, 2021

Codecov Report

Merging #4304 (e90781b) into master (a993426) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4304      +/-   ##
==========================================
- Coverage   98.44%   98.44%   -0.01%     
==========================================
  Files         205      205              
  Lines        7316     7314       -2     
  Branches     2084     2084              
==========================================
- Hits         7202     7200       -2     
  Misses         55       55              
  Partials       59       59              
Impacted Files Coverage Δ
src/utils/generateCodeSnippets.ts 97.29% <ø> (ø)
src/utils/safeName.ts 100.00% <ø> (ø)
src/utils/RESERVED_NAMES.ts 100.00% <100.00%> (ø)
src/utils/exportNames.ts 100.00% <100.00%> (ø)
src/utils/identifierHelpers.ts 100.00% <100.00%> (ø)

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 a993426...e90781b. Read the comment docs.

'uneval'
]);

export default BUILTINS;
Copy link
Member

Choose a reason for hiding this comment

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

Actually looking at what we use this for, i.e. generating "safe" variable names, I do not think we need to keep global variables in this list. Their use is already tracked so that generated variable names are deconflicted. Looking at what is left then, I wonder if we could not just merge that into the RESERVED_WORDS list (I actually only see NaN)


const blacklisted = new Set(reservedWords.concat(builtins));
const blacklisted = new Set([...RESERVED_WORDS, ...BUILTINS]);
Copy link
Member

Choose a reason for hiding this comment

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

If you follow my suggestion of just merging the lists, then we do not need this awkwardly named variable any more. But please tell me if you think I am overlooking something.

@lukastaegert lukastaegert merged commit edb7982 into rollup:master Dec 24, 2021
@dnalborczyk dnalborczyk deleted the reserved-words branch December 27, 2021 02:16
@dnalborczyk
Copy link
Contributor Author

@lukastaegert sorry, just saw this, makes sense to me. 👍

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