Make the potential variable map null when not needed

This commit is contained in:
Rachel Fenichel
2018-01-12 14:51:02 -08:00
parent a30ad6ff3a
commit b593d44379
6 changed files with 29 additions and 16 deletions

View File

@@ -95,7 +95,7 @@ Blockly.Workspace = function(opt_options) {
* @type {!Blockly.VariableMap}
* @private
*/
this.potentialVariableMap_ = new Blockly.VariableMap(this);
this.potentialVariableMap_ = null;
};
/**
@@ -197,7 +197,9 @@ Blockly.Workspace.prototype.clear = function() {
Blockly.Events.setGroup(false);
}
this.variableMap_.clear();
this.potentialVariableMap_.clear();
if (this.potentialVariableMap_) {
this.potentialVariableMap_.clear();
}
};
/* Begin functions that are just pass-throughs to the variable map. */
@@ -469,7 +471,15 @@ Blockly.Workspace.prototype.allInputsFilled = function(opt_shadowBlocksAreFilled
* @package
*/
Blockly.Workspace.prototype.getPotentialVariableMap = function() {
return this.isFlyout ? this.potentialVariableMap_ : null;
return this.potentialVariableMap_;
};
/**
* Create and store the potential variable map for this workspace.
* @package
*/
Blockly.Workspace.prototype.createPotentialVariableMap = function() {
this.potentialVariableMap_ = new Blockly.VariableMap(this);
};
/**