mirror of
https://github.com/google/blockly.git
synced 2026-03-16 10:10:10 +01:00
More code cleanup for review
This commit is contained in:
@@ -266,14 +266,19 @@ Blockly.VariableMap.prototype.deleteVariableById = function(id) {
|
||||
*/
|
||||
Blockly.VariableMap.prototype.deleteVariableInternal_ = function(variable,
|
||||
uses) {
|
||||
Blockly.Events.setGroup(true);
|
||||
var existingGroup = Blockly.Events.getGroup();
|
||||
if (!existingGroup) {
|
||||
Blockly.Events.setGroup(true);
|
||||
}
|
||||
try {
|
||||
for (var i = 0; i < uses.length; i++) {
|
||||
uses[i].dispose(true, false);
|
||||
}
|
||||
this.deleteVariable(variable);
|
||||
} finally {
|
||||
Blockly.Events.setGroup(false);
|
||||
if (!existingGroup) {
|
||||
Blockly.Events.setGroup(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -367,7 +367,7 @@ Blockly.Variables.generateVariableFieldXml_ = function(variableModel) {
|
||||
typeString = '\'\'';
|
||||
}
|
||||
var text = '<field name="VAR" id="' + variableModel.getId() +
|
||||
'" variabletype="' + typeString +
|
||||
'" variabletype="' + goog.string.htmlEscape(typeString) +
|
||||
'">' + goog.string.htmlEscape(variableModel.name) + '</field>';
|
||||
return text;
|
||||
};
|
||||
|
||||
@@ -928,17 +928,6 @@ Blockly.WorkspaceSvg.prototype.refreshToolboxSelection_ = function() {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Rename a variable by updating its name in the variable list.
|
||||
* @param {string} oldName Variable to rename.
|
||||
* @param {string} newName New variable name.
|
||||
* @package
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.renameVariable = function(oldName, newName) {
|
||||
Blockly.WorkspaceSvg.superClass_.renameVariable.call(this, oldName, newName);
|
||||
this.refreshToolboxSelection_();
|
||||
};
|
||||
|
||||
/**
|
||||
* Rename a variable by updating its name in the variable map. Update the
|
||||
* flyout to show the renamed variable immediately.
|
||||
@@ -951,17 +940,6 @@ Blockly.WorkspaceSvg.prototype.renameVariableById = function(id, newName) {
|
||||
this.refreshToolboxSelection_();
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete a variable by the passed in name. Update the flyout to show
|
||||
* immediately that the variable is deleted.
|
||||
* @param {string} name Name of variable to delete.
|
||||
* @package
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.deleteVariable = function(name) {
|
||||
Blockly.WorkspaceSvg.superClass_.deleteVariable.call(this, name);
|
||||
this.refreshToolboxSelection_();
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete a variable by the passed in ID. Update the flyout to show
|
||||
* immediately that the variable is deleted.
|
||||
|
||||
Reference in New Issue
Block a user