mirror of
https://github.com/google/blockly.git
synced 2026-01-10 10:27:08 +01:00
Merge branch 'develop' into merge-develop-to-goog_module
This commit is contained in:
@@ -24,6 +24,7 @@ const Workspace = goog.requireType('Blockly.Workspace');
|
||||
const dialog = goog.require('Blockly.dialog');
|
||||
const idGenerator = goog.require('Blockly.utils.idGenerator');
|
||||
const object = goog.require('Blockly.utils.object');
|
||||
const utils = goog.require('Blockly.utils');
|
||||
/** @suppress {extraRequire} */
|
||||
goog.require('Blockly.Events.VarDelete');
|
||||
/** @suppress {extraRequire} */
|
||||
@@ -151,9 +152,7 @@ VariableMap.prototype.renameVariableWithConflict_ = function(
|
||||
// Finally delete the original variable, which is now unreferenced.
|
||||
Events.fire(new (Events.get(Events.VAR_DELETE))(variable));
|
||||
// And remove it from the list.
|
||||
const variableList = this.getVariablesOfType(type);
|
||||
const variableIndex = variableList.indexOf(variable);
|
||||
this.variableMap_[type].splice(variableIndex, 1);
|
||||
Blockly.utils.arrayRemove(this.getVariablesOfType(type), variable);
|
||||
};
|
||||
|
||||
/* End functions for renaming variables. */
|
||||
@@ -206,9 +205,11 @@ VariableMap.prototype.createVariable = function(name, opt_type, opt_id) {
|
||||
* @param {!VariableModel} variable Variable to delete.
|
||||
*/
|
||||
VariableMap.prototype.deleteVariable = function(variable) {
|
||||
const variableId = variable.getId();
|
||||
const variableList = this.variableMap_[variable.type];
|
||||
for (let i = 0, tempVar; (tempVar = variableList[i]); i++) {
|
||||
if (tempVar.getId() == variable.getId()) {
|
||||
for (let i = 0; i < variableList.length; i++) {
|
||||
const tempVar = variableList[i];
|
||||
if (tempVar.getId() == variableId) {
|
||||
variableList.splice(i, 1);
|
||||
Events.fire(new (Events.get(Events.VAR_DELETE))(variable));
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user