mirror of
https://github.com/google/blockly.git
synced 2026-01-10 10:27:08 +01:00
fix: Fix bug that could caused variable map to be left in an inconsistent state. (#9339)
This commit is contained in:
@@ -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) ??
|
||||
|
||||
Reference in New Issue
Block a user