This commit is contained in:
Kouji Takao 2025-05-04 02:06:24 +00:00 committed by GitHub
commit ba92eb7884
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 5 deletions

View file

@ -996,7 +996,7 @@ class Blocks {
getAllVariableAndListReferences (optBlocks, optIncludeBroadcast) {
const blocks = optBlocks ? optBlocks : this._blocks;
const allReferences = Object.create(null);
for (const blockId in blocks) {
Object.keys(blocks).forEach(blockId => {
let varOrListField = null;
let varType = null;
if (blocks[blockId].fields.VARIABLE) {
@ -1028,7 +1028,7 @@ class Blocks {
];
}
}
}
});
return allReferences;
}

View file

@ -762,12 +762,11 @@ class Target extends EventEmitter {
}
// Rename any local variables that were missed above because they aren't
// referenced by any blocks
for (const id in unreferencedLocalVarIds) {
const varId = unreferencedLocalVarIds[id];
unreferencedLocalVarIds.forEach(varId => {
const name = this.variables[varId].name;
const type = this.variables[varId].type;
renameConflictingLocalVar(varId, name, type);
}
});
// Handle global var conflicts with existing global vars (e.g. a sprite is uploaded, and has
// blocks referencing some variable that the sprite does not own, and this
// variable conflicts with a global var)