Misc cleanup.

This commit is contained in:
Neil Fraser 2016-01-15 15:36:06 -08:00
parent 4b0ed0d372
commit 36fe3994c9
11 changed files with 83 additions and 70 deletions

View file

@ -90,11 +90,8 @@ Blockly.FieldVariable.prototype.init = function(block) {
if (!this.getValue()) {
// Variables without names get uniquely named for this workspace.
if (block.isInFlyout) {
var workspace = block.workspace.targetWorkspace;
} else {
var workspace = block.workspace;
}
var workspace =
block.isInFlyout ? block.workspace.targetWorkspace : block.workspace;
this.setValue(Blockly.Variables.generateUniqueName(workspace));
}
Blockly.FieldVariable.superClass_.init.call(this, block);
@ -111,11 +108,10 @@ Blockly.FieldVariable.prototype.getValue = function() {
/**
* Set the variable name.
* @param {string} text New text.
* @param {string} newValue New text.
*/
Blockly.FieldVariable.prototype.setValue = function(text) {
this.value_ = text;
this.setText(text);
this.value_ = newValue;
this.setText(newValue);
};
/**