Skip to content

Commit 6ca15a7

Browse files
committed
refactor: Naming cleanup
1 parent 8cf6c0d commit 6ca15a7

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

packages/typegpu/src/nameRegistry.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,7 @@ abstract class NameRegistryImpl implements NameRegistry {
483483
}
484484

485485
makeValid(primer: string): string {
486-
if (
487-
isValidIdentifier(primer) &&
488-
!this.#usedNames.has(primer) &&
489-
!this.#isUsedInBlocksBefore(primer)
490-
) {
486+
if (isValidIdentifier(primer) && !this.isUsed(primer)) {
491487
this.#usedBlockScopeNames?.add(primer);
492488
return primer;
493489
}

packages/typegpu/src/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,12 @@ export interface ResolutionCtx {
324324
*/
325325
withRenamed<T>(item: object, name: string | undefined, callback: () => T): T;
326326

327+
/**
328+
* It takes a resource instead of a primer solely because it needs to
329+
* pass the resource to a potential namespace listener.
330+
*
331+
* TODO: Remove namespace listeners, then accept a primer instead of a resource.
332+
*/
327333
getUniqueName(resource: object): string;
328334
makeNameValid(name: string): string;
329335
}

0 commit comments

Comments
 (0)