mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
Make the potential variable map null when not needed
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user