From 832df810c1873bb47efe5099633285d3ed483cf5 Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Sun, 9 Oct 2016 13:11:21 -0500 Subject: [PATCH] Stops duplicating on rename of old ID to old ID. --- core/workspace.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/workspace.js b/core/workspace.js index 89912a724..805790869 100644 --- a/core/workspace.js +++ b/core/workspace.js @@ -251,9 +251,9 @@ Blockly.Workspace.prototype.renameVariable = function(oldName, newName) { this.variableList[variableIndex] = newName; } else if (variableIndex != -1 && newVariableIndex != -1) { // Renaming one existing variable to another existing variable. - this.variableList.splice(variableIndex, 1); - // The case might have changed. + // The case might have changed, so we update the destination ID. this.variableList[newVariableIndex] = newName; + this.variableList.splice(variableIndex, 1); } else { this.variableList.push(newName); console.log('Tried to rename an non-existent variable.');