software-mansion / software-mansion/TypeGPU
[RFC] nameRegistry bug?
Open
@cieplypolar is already working on this.
Since Jan 22, 2026.
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 122
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 34
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.