From 1fa27fa04375caffd9e8df9494eb1f30e5a9ce33 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Fri, 12 Jan 2018 12:03:28 -0800 Subject: [PATCH] Update comments and remove unused functions --- blocks/procedures.js | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index 8f6e0541b..eb42047a7 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -280,7 +280,7 @@ Blockly.Blocks['procedures_defnoreturn'] = { }, /** * 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. Guaranteed to be the same type as the old @@ -308,6 +308,12 @@ Blockly.Blocks['procedures_defnoreturn'] = { this.displayRenamedVar_(oldName, newVar.name); } }, + /** + * 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. + * @package + */ updateVarName: function(variable) { var newName = variable.name; var change = false; @@ -736,25 +742,6 @@ Blockly.Blocks['procedures_callnoreturn'] = { } this.setProcedureParameters_(args, paramIds); }, - /** - * Notification that a variable is renaming. - * If the name 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. Guaranteed to be the same type as the old - * variable. - * @this Blockly.Block - */ - renameVarById: function(oldId, newId) { - var newVar = this.workspace.getVariableById(newId); - for (var i = 0; i < this.arguments_.length; i++) { - if (oldId == this.argumentVarModels_[i].getId()) { - this.arguments_[i] = newVar.name; - this.argumentVarModels_[i] = newVar; - this.getField('ARGNAME' + i).setValue(newVar.name); - } - } - }, /** * Return all variables referenced by this block. * @return {!Array.} List of variable models. @@ -872,7 +859,6 @@ Blockly.Blocks['procedures_callreturn'] = { updateShape_: Blockly.Blocks['procedures_callnoreturn'].updateShape_, mutationToDom: Blockly.Blocks['procedures_callnoreturn'].mutationToDom, domToMutation: Blockly.Blocks['procedures_callnoreturn'].domToMutation, - renameVarById: Blockly.Blocks['procedures_callnoreturn'].renameVarById, getVarModels: Blockly.Blocks['procedures_callnoreturn'].getVarModels, onchange: Blockly.Blocks['procedures_callnoreturn'].onchange, customContextMenu: