mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-13 22:11:14 -04:00
Merge 505c3f7565
into f207757ef0
This commit is contained in:
commit
ba92eb7884
2 changed files with 4 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue