-
-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
I am not sure if the condition in makeValid method is sufficient.
makeValid(primer: string): string {
if (isValidIdentifier(primer) && !this.#usedNames.has(primer)) {
this.usedFunctionScopeNames?.add(primer);
return primer;
}
return this.makeUnique(primer, false);
}In the resolution of a forOf loop, I need to check if an identifier is free by calling ctx.getById method
let index = 'i'; // it will be valid name, no need to call this.ctx.makeNameValid
while (ctx.getById(index) !== null) {
index += 'i';
}If we were checking the function scope in the makeValid method, the while loop could be replaced with a single call to makeNameValid
Please tell me if I am correct.
Metadata
Metadata
Assignees
Labels
No labels