-
-
Notifications
You must be signed in to change notification settings - Fork 45
fix: Giving local declarations unique names if they clash with global declarations, and vice-versa + 'strict' the default naming scheme in pipelines #2000
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
Conversation
|
pkg.pr.new packages benchmark commit |
| return this | ||
| .#usedFunctionScopeNamesStack[ | ||
| this.#usedFunctionScopeNamesStack.length - 1 | ||
| ]; |
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.
nit
| return this | |
| .#usedFunctionScopeNamesStack[ | |
| this.#usedFunctionScopeNamesStack.length - 1 | |
| ]; | |
| return this.#usedFunctionScopeNamesStack.at(-1); |
cieplypolar
left a comment
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.
Looks good 🎄
| if (global) { | ||
| this.#usedNames.add(name); | ||
| } else { | ||
| this.usedFunctionScopeNames?.add(name); |
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.
I don't like the fact that the function scope stack can be empty. I’d prefer to add an invariant (it is never empty) or a comment explaining why this state is possible
| makeValid(primer: string): string { | ||
| if (isValidIdentifier(primer)) { | ||
| if (isValidIdentifier(primer) && !this.#usedNames.has(primer)) { | ||
| this.usedFunctionScopeNames?.add(primer); |
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.
same as above
No description provided.