This commit is contained in:
Rachel Fenichel
2017-12-15 13:44:27 -08:00
parent a75ab878af
commit 66975c8f94
3 changed files with 20 additions and 7 deletions

View File

@@ -247,11 +247,21 @@ Blockly.VariableMap.prototype.getVariablesOfType = function(type) {
};
/**
* Return all variable types.
* Return all variable types. This list always contains the empty string.
* @return {!Array.<string>} List of variable types.
*/
Blockly.VariableMap.prototype.getVariableTypes = function() {
return Object.keys(this.variableMap_);
var types = Object.keys(this.variableMap_);
var hasEmpty = false;
for (var i = 0; i < types.length; i++) {
if (types[i] == '') {
hasEmpty = true;
}
}
if (!hasEmpty) {
types.push('');
}
return types;
};
/**