Merge pull request #731 from paulkaplan/fix-global-local-variable-creation

Prevent imported local variables from being duplicated on the stage.
This commit is contained in:
Paul Kaplan 2017-10-25 16:26:17 -04:00 committed by GitHub
commit 4f7d6e8f5c

View file

@ -255,7 +255,13 @@ class Blocks {
});
break;
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;
case 'var_rename':
stage.renameVariable(e.varId, e.newName);