Respond to commit comments and make compressed blockly work again

This commit is contained in:
Rachel Fenichel
2018-01-10 17:02:02 -08:00
parent bd4e4daebb
commit a43b0e7010
3 changed files with 14 additions and 12 deletions

View File

@@ -705,6 +705,7 @@ Blockly.Block.prototype.getField = function(name) {
/**
* Return all variables referenced by this block.
* @return {!Array.<string>} List of variable names.
* @package
*/
Blockly.Block.prototype.getVars = function() {
var vars = [];
@@ -721,6 +722,7 @@ Blockly.Block.prototype.getVars = function() {
/**
* Return all variables referenced by this block.
* @return {!Array.<!Blockly.VariableModel>} List of variable models.
* @package
*/
Blockly.Block.prototype.getVarModels = function() {
var vars = [];
@@ -743,7 +745,7 @@ Blockly.Block.prototype.getVarModels = function() {
* Notification that a variable is renaming but keeping the same ID. If the
* variable is in use on this block, rerender to show the new name.
* @param {!Blockly.VariableModel} variable The variable being renamed.
* @public
* @package
*/
Blockly.Block.prototype.updateVarName = function(variable) {
for (var i = 0, input; input = this.inputList[i]; i++) {
@@ -758,7 +760,7 @@ Blockly.Block.prototype.updateVarName = function(variable) {
/**
* Notification that a variable is renaming.
* If the name matches one of this block's variables, rename it.
* If the ID matches one of this block's variables, rename it.
* @param {string} oldId ID of variable to rename.
* @param {string} newId ID of new variable. May be the same as oldId, but with
* an updated name.

View File

@@ -204,8 +204,7 @@ Blockly.FieldVariable.prototype.typeIsAllowed_ = function(type) {
* @private
*/
Blockly.FieldVariable.prototype.getVariableTypes_ = function() {
// TODO: Why does this happen every time, instead of once when the workspace
// is set? Do we expect the variable types to change that much?
// TODO (#1513): Try to avoid calling this every time the field is edited.
var variableTypes = this.variableTypes;
if (variableTypes === null || variableTypes === undefined) {
// If variableTypes is null, return all variable types.

View File

@@ -26,14 +26,6 @@
goog.provide('Blockly.Names');
/**
* Constant to separate developer variable names from user-defined variable
* names when running generators.
* A developer variable will be declared as a global in the generated code, but
* will never be shown to the user in the workspace or stored in the variable
* map.
*/
Blockly.Names.DEVELOPER_VARIABLE_TYPE = 'DEVELOPER_VARIABLE';
/**
* Class for a database of entity names (variables, functions, etc).
@@ -55,6 +47,15 @@ Blockly.Names = function(reservedWords, opt_variablePrefix) {
this.reset();
};
/**
* Constant to separate developer variable names from user-defined variable
* names when running generators.
* A developer variable will be declared as a global in the generated code, but
* will never be shown to the user in the workspace or stored in the variable
* map.
*/
Blockly.Names.DEVELOPER_VARIABLE_TYPE = 'DEVELOPER_VARIABLE';
/**
* When JavaScript (or most other languages) is generated, variable 'foo' and
* procedure 'foo' would collide. However, Blockly has no such problems since