mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Use instanceof to distinguish between blocks and workspaces.
This commit is contained in:
parent
3f0b2961a1
commit
75e06de477
1 changed files with 2 additions and 2 deletions
|
@ -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.<string>} 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 ' +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue