fix: Fix bug that could caused variable map to be left in an inconsistent state. (#9339)

This commit is contained in:
Aaron Dodson
2025-09-02 12:39:16 -07:00
committed by GitHub
parent 55f5d648a8
commit 9b60088d4b
2 changed files with 12 additions and 1 deletions

View File

@@ -112,7 +112,11 @@ export class VariableMap
const oldType = variable.getType();
if (oldType === newType) return variable;
this.variableMap.get(variable.getType())?.delete(variable.getId());
const oldTypeVariables = this.variableMap.get(oldType);
oldTypeVariables?.delete(variable.getId());
if (oldTypeVariables?.size === 0) {
this.variableMap.delete(oldType);
}
variable.setType(newType);
const newTypeVariables =
this.variableMap.get(newType) ??