chore: tweaks

This commit is contained in:
daiwei 2025-09-03 13:59:56 +08:00
parent 40c4f590ec
commit 180308c6a3
2 changed files with 1 additions and 4 deletions

View File

@ -107,7 +107,6 @@ export class CodegenContext {
}
for (const [prefix, nums] of map) {
if (nums.size === 0) continue
this.nextIdMap.set(prefix, buildNextIdMap(nums))
}
}

View File

@ -124,9 +124,7 @@ export class TransformContext<T extends AllNode = AllNode> {
increaseId = (): number => {
// allocate an id that won't conflict with user-defined bindings when used
// as generated identifiers with n/x/r prefixes (e.g., n1, x1, r1).
const id = this.nextIdMap
? (this.nextIdMap.get(this.globalId) ?? this.globalId)
: this.globalId
const id = getNextId(this.nextIdMap, this.globalId)
// advance next
this.globalId = getNextId(this.nextIdMap, id + 1)
return id