diff --git a/core/variable_model.js b/core/variable_model.js index bc097da8a..ce4c37c66 100644 --- a/core/variable_model.js +++ b/core/variable_model.js @@ -10,7 +10,8 @@ */ 'use strict'; -goog.provide('Blockly.VariableModel'); +goog.module('Blockly.VariableModel'); +goog.module.declareLegacyNamespace(); goog.require('Blockly.Events'); /** @suppress {extraRequire} */ @@ -34,7 +35,7 @@ goog.requireType('Blockly.Workspace'); * @see {Blockly.FieldVariable} * @constructor */ -Blockly.VariableModel = function(workspace, name, opt_type, opt_id) { +const VariableModel = function(workspace, name, opt_type, opt_id) { /** * The workspace the variable is in. * @type {!Blockly.Workspace} @@ -73,18 +74,20 @@ Blockly.VariableModel = function(workspace, name, opt_type, opt_id) { /** * @return {string} The ID for the variable. */ -Blockly.VariableModel.prototype.getId = function() { +VariableModel.prototype.getId = function() { return this.id_; }; /** * A custom compare function for the VariableModel objects. - * @param {Blockly.VariableModel} var1 First variable to compare. - * @param {Blockly.VariableModel} var2 Second variable to compare. + * @param {VariableModel} var1 First variable to compare. + * @param {VariableModel} var2 Second variable to compare. * @return {number} -1 if name of var1 is less than name of var2, 0 if equal, * and 1 if greater. * @package */ -Blockly.VariableModel.compareByName = function(var1, var2) { +VariableModel.compareByName = function(var1, var2) { return var1.name.localeCompare(var2.name, undefined, {sensitivity: 'base'}); }; + +exports = VariableModel; diff --git a/tests/deps.js b/tests/deps.js index 20fb4e48e..0e0a7f034 100644 --- a/tests/deps.js +++ b/tests/deps.js @@ -196,7 +196,7 @@ goog.addDependency('../../core/utils/toolbox.js', ['Blockly.utils.toolbox'], ['B goog.addDependency('../../core/utils/useragent.js', ['Blockly.utils.userAgent'], ['Blockly.utils.global']); goog.addDependency('../../core/utils/xml.js', ['Blockly.utils.xml'], []); goog.addDependency('../../core/variable_map.js', ['Blockly.VariableMap'], ['Blockly.Events', 'Blockly.Events.VarDelete', 'Blockly.Events.VarRename', 'Blockly.Msg', 'Blockly.utils', 'Blockly.utils.object']); -goog.addDependency('../../core/variable_model.js', ['Blockly.VariableModel'], ['Blockly.Events', 'Blockly.Events.VarCreate', 'Blockly.utils']); +goog.addDependency('../../core/variable_model.js', ['Blockly.VariableModel'], ['Blockly.Events', 'Blockly.Events.VarCreate', 'Blockly.utils'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/variables.js', ['Blockly.Variables'], ['Blockly.Blocks', 'Blockly.Msg', 'Blockly.VariableModel', 'Blockly.Xml', 'Blockly.internalConstants', 'Blockly.utils', 'Blockly.utils.xml']); goog.addDependency('../../core/variables_dynamic.js', ['Blockly.VariablesDynamic'], ['Blockly.Blocks', 'Blockly.Msg', 'Blockly.VariableModel', 'Blockly.Variables', 'Blockly.utils.xml']); goog.addDependency('../../core/warning.js', ['Blockly.Warning'], ['Blockly.Bubble', 'Blockly.Events', 'Blockly.Events.BubbleOpen', 'Blockly.Icon', 'Blockly.utils.Svg', 'Blockly.utils.dom', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});