From 3294ca5540b37492e3031619f54462e1c057cda8 Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Thu, 25 Aug 2022 16:13:28 +0000 Subject: [PATCH] refactor!: Removed backwards compatibility for getDeveloperVars(). --- core/variables.ts | 15 +-------------- tests/generators/unittest.js | 8 ++++---- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/core/variables.ts b/core/variables.ts index 16f762b1ad9..56768a79e6b 100644 --- a/core/variables.ts +++ b/core/variables.ts @@ -63,8 +63,6 @@ export function allUsedVarModels(ws: Workspace): VariableModel[] { return Array.from(variables.values()); } -const ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE: {[key: string]: boolean} = {}; - /** * Find all developer variables used by blocks in the workspace. * Developer variables are never shown to the user, but are declared as global @@ -81,18 +79,7 @@ export function allDeveloperVariables(workspace: Workspace): string[] { const blocks = workspace.getAllBlocks(false); const variables = new Set(); for (let i = 0, block; block = blocks[i]; i++) { - let getDeveloperVariables = block.getDeveloperVariables; - if (!getDeveloperVariables && (block as any).getDeveloperVars) { - // August 2018: getDeveloperVars() was deprecated and renamed - // getDeveloperVariables(). - getDeveloperVariables = (block as any).getDeveloperVars; - if (!ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE[block.type]) { - console.warn( - 'Function getDeveloperVars() deprecated. Use ' + - 'getDeveloperVariables() (block type \'' + block.type + '\')'); - ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE[block.type] = true; - } - } + const getDeveloperVariables = block.getDeveloperVariables; if (getDeveloperVariables) { const devVars = getDeveloperVariables(); for (let j = 0; j < devVars.length; j++) { diff --git a/tests/generators/unittest.js b/tests/generators/unittest.js index 18d3ce89539..9649dfaca97 100644 --- a/tests/generators/unittest.js +++ b/tests/generators/unittest.js @@ -20,7 +20,7 @@ Blockly.Blocks['unittest_main'] = { this.setTooltip('Executes the enclosed unit tests,\n' + 'then prints a summary.'); }, - getDeveloperVars: function() { + getDeveloperVariables: function() { return ['unittestResults']; } }; @@ -40,7 +40,7 @@ Blockly.Blocks['unittest_assertequals'] = { .appendField('expected'); this.setTooltip('Tests that "actual == expected".'); }, - getDeveloperVars: function() { + getDeveloperVariables: function() { return ['unittestResults']; } }; @@ -60,7 +60,7 @@ Blockly.Blocks['unittest_assertvalue'] = { [['true', 'TRUE'], ['false', 'FALSE'], ['null', 'NULL']]), 'EXPECTED'); this.setTooltip('Tests that the value is true, false, or null.'); }, - getDeveloperVars: function() { + getDeveloperVariables: function() { return ['unittestResults']; } }; @@ -76,7 +76,7 @@ Blockly.Blocks['unittest_fail'] = { .appendField('fail'); this.setTooltip('Records an error.'); }, - getDeveloperVars: function() { + getDeveloperVariables: function() { return ['unittestResults']; } };