Get rid of workspace.deleteVariable

This commit is contained in:
Rachel Fenichel
2017-12-05 13:44:08 -08:00
parent 1ce46ab88b
commit 61db23c78a
6 changed files with 59 additions and 72 deletions

View File

@@ -467,12 +467,13 @@ Blockly.Blocks['procedures_mutatorarg'] = {
if (source && source.workspace && source.workspace.options &&
source.workspace.options.parentWorkspace) {
var workspace = source.workspace.options.parentWorkspace;
var variable = workspace.getVariable(newText);
var variableType = '';
var variable = workspace.getVariable(newText, variableType);
// If there is a case change, rename the variable.
if (variable && variable.name !== newText) {
workspace.renameVariableById(variable.getId(), newText);
} else {
workspace.createVariable(newText);
workspace.createVariable(newText, variableType);
}
}
}