mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
Procedure block renames variable in mutator if there is a case change.
This commit is contained in:
@@ -443,7 +443,14 @@ Blockly.Blocks['procedures_mutatorarg'] = {
|
||||
var source = this.sourceBlock_;
|
||||
if (source && source.workspace && source.workspace.options &&
|
||||
source.workspace.options.parentWorkspace) {
|
||||
source.workspace.options.parentWorkspace.createVariable(newText);
|
||||
var workspace = source.workspace.options.parentWorkspace;
|
||||
var variable = workspace.getVariable(newText);
|
||||
// If there is a case change, rename the variable.
|
||||
if (variable && variable.name !== newText) {
|
||||
workspace.renameVariableById(variable.getId(), newText);
|
||||
} else {
|
||||
workspace.createVariable(newText);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user