mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Prevent imported local variables from being duplicated on the stage.
This commit is contained in:
parent
f07c70938a
commit
d126f799d8
1 changed files with 7 additions and 1 deletions
|
@ -255,7 +255,13 @@ class Blocks {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'var_create':
|
case 'var_create':
|
||||||
stage.createVariable(e.varId, e.varName);
|
// New variables being created by the user are all global.
|
||||||
|
// Check if this variable exists on the current target or stage.
|
||||||
|
// If not, create it on the stage.
|
||||||
|
// TODO create global and local variables when UI provides a way.
|
||||||
|
if (!optRuntime.getEditingTarget().lookupVariableById(e.varId)) {
|
||||||
|
stage.createVariable(e.varId, e.varName);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'var_rename':
|
case 'var_rename':
|
||||||
stage.renameVariable(e.varId, e.newName);
|
stage.renameVariable(e.varId, e.newName);
|
||||||
|
|
Loading…
Reference in a new issue