Merge branch 'develop' into merge-develop-to-goog_module

This commit is contained in:
kozbial
2021-09-21 16:04:33 -07:00
265 changed files with 21385 additions and 7566 deletions

View File

@@ -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;