From 75e06de477ff9770896139b29729d9c28a5dd294 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Wed, 13 Jul 2016 12:50:44 -0700 Subject: [PATCH] Use instanceof to distinguish between blocks and workspaces. --- core/variables.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/variables.js b/core/variables.js index d9af525cb..0049ed388 100644 --- a/core/variables.js +++ b/core/variables.js @@ -44,7 +44,7 @@ Blockly.Variables.NAME_TYPE = 'VARIABLE'; */ Blockly.Variables.allUsedVariables = function(root) { var blocks; - if (root.getDescendants) { + if (root instanceof Blockly.Block) { // Root is Block. blocks = root.getDescendants(); } else if (root.getAllBlocks) { @@ -82,7 +82,7 @@ Blockly.Variables.allUsedVariables = function(root) { * @return {!Array.} Array of variable names. */ Blockly.Variables.allVariables = function(root) { - if (root.getDescendants) { + if (root instanceof Blockly.Block) { // Root is Block. console.warn('Deprecated call to Blockly.Variables.allVariables ' + 'with a block instead of a workspace. You may want ' +