diff --git a/core/generator.js b/core/generator.js index 053095f27..e73adfe52 100644 --- a/core/generator.js +++ b/core/generator.js @@ -351,7 +351,7 @@ Blockly.Generator.prototype.injectId = function(msg, block) { /** * Comma-separated list of reserved words. * @type {string} - * @private + * @protected */ Blockly.Generator.prototype.RESERVED_WORDS_ = ''; @@ -370,7 +370,7 @@ Blockly.Generator.prototype.addReservedWords = function(words) { * legitimately appear in a function definition (or comment), and it must * not confuse the regular expression parser. * @type {string} - * @private + * @protected */ Blockly.Generator.prototype.FUNCTION_NAME_PLACEHOLDER_ = '{leCUI8hutHZI4480Dc}'; @@ -411,7 +411,7 @@ Blockly.Generator.prototype.variableDB_; * @param {!Array.} code A list of statements. Use ' ' for indents. * @return {string} The actual name of the new function. This may differ * from desiredName if the former has already been taken by the user. - * @private + * @protected */ Blockly.Generator.prototype.provideFunction_ = function(desiredName, code) { if (!this.definitions_[desiredName]) { diff --git a/core/names.js b/core/names.js index c18f5ab34..daa7edb73 100644 --- a/core/names.js +++ b/core/names.js @@ -76,7 +76,6 @@ Blockly.Names.prototype.reset = function() { /** * Set the variable map that maps from variable name to variable object. * @param {!Blockly.VariableMap} map The map to track. - * @package */ Blockly.Names.prototype.setVariableMap = function(map) { this.variableMap_ = map; @@ -84,7 +83,8 @@ Blockly.Names.prototype.setVariableMap = function(map) { /** * Get the name for a user-defined variable, based on its ID. - * This should only be used for variables of type Blockly.Variables.NAME_TYPE. + * This should only be used for variables of type + * Blockly.VARIABLE_CATEGORY_NAME. * @param {string} id The ID to look up in the variable map. * @return {?string} The name of the referenced variable, or null if there was * no variable map or the variable was not found in the map. @@ -113,7 +113,6 @@ Blockly.Names.prototype.getNameForUserVariable_ = function(id) { * @param {string} type The type of entity in Blockly * ('VARIABLE', 'PROCEDURE', 'BUILTIN', etc...). * @return {string} An entity name that is legal in the exported language. - * @suppress {deprecated} Suppress deprecated Blockly.Variables.NAME_TYPE. */ Blockly.Names.prototype.getName = function(name, type) { if (type == Blockly.VARIABLE_CATEGORY_NAME) { diff --git a/generators/dart/loops.js b/generators/dart/loops.js index 3f362162b..9d10afd8e 100644 --- a/generators/dart/loops.js +++ b/generators/dart/loops.js @@ -43,7 +43,7 @@ Blockly.Dart['controls_repeat_ext'] = function(block) { 'count', Blockly.VARIABLE_CATEGORY_NAME); var endVar = repeats; if (!repeats.match(/^\w+$/) && !Blockly.isNumber(repeats)) { - var endVar = Blockly.Dart.variableDB_.getDistinctName( + endVar = Blockly.Dart.variableDB_.getDistinctName( 'repeat_end', Blockly.VARIABLE_CATEGORY_NAME); code += 'var ' + endVar + ' = ' + repeats + ';\n'; } @@ -102,13 +102,13 @@ Blockly.Dart['controls_for'] = function(block) { // Cache non-trivial values to variables to prevent repeated look-ups. var startVar = argument0; if (!argument0.match(/^\w+$/) && !Blockly.isNumber(argument0)) { - var startVar = Blockly.Dart.variableDB_.getDistinctName( + startVar = Blockly.Dart.variableDB_.getDistinctName( variable0 + '_start', Blockly.VARIABLE_CATEGORY_NAME); code += 'var ' + startVar + ' = ' + argument0 + ';\n'; } var endVar = argument1; if (!argument1.match(/^\w+$/) && !Blockly.isNumber(argument1)) { - var endVar = Blockly.Dart.variableDB_.getDistinctName( + endVar = Blockly.Dart.variableDB_.getDistinctName( variable0 + '_end', Blockly.VARIABLE_CATEGORY_NAME); code += 'var ' + endVar + ' = ' + argument1 + ';\n'; } diff --git a/generators/javascript/lists.js b/generators/javascript/lists.js index 84e0cfea6..d799f6331 100644 --- a/generators/javascript/lists.js +++ b/generators/javascript/lists.js @@ -252,7 +252,7 @@ Blockly.JavaScript['lists_setIndex'] = function(block) { * @param {string} listName Name of the list, used to calculate length. * @param {string} where The method of indexing, selected by dropdown in Blockly * @param {string=} opt_at The optional offset when indexing from start/end. - * @return {string} Index expression. + * @return {string|undefined} Index expression. * @private */ Blockly.JavaScript.lists.getIndex_ = function(listName, where, opt_at) { diff --git a/generators/javascript/loops.js b/generators/javascript/loops.js index 711d8904e..9f0068087 100644 --- a/generators/javascript/loops.js +++ b/generators/javascript/loops.js @@ -43,7 +43,7 @@ Blockly.JavaScript['controls_repeat_ext'] = function(block) { 'count', Blockly.VARIABLE_CATEGORY_NAME); var endVar = repeats; if (!repeats.match(/^\w+$/) && !Blockly.isNumber(repeats)) { - var endVar = Blockly.JavaScript.variableDB_.getDistinctName( + endVar = Blockly.JavaScript.variableDB_.getDistinctName( 'repeat_end', Blockly.VARIABLE_CATEGORY_NAME); code += 'var ' + endVar + ' = ' + repeats + ';\n'; } @@ -109,7 +109,7 @@ Blockly.JavaScript['controls_for'] = function(block) { } var endVar = argument1; if (!argument1.match(/^\w+$/) && !Blockly.isNumber(argument1)) { - var endVar = Blockly.JavaScript.variableDB_.getDistinctName( + endVar = Blockly.JavaScript.variableDB_.getDistinctName( variable0 + '_end', Blockly.VARIABLE_CATEGORY_NAME); code += 'var ' + endVar + ' = ' + argument1 + ';\n'; } diff --git a/generators/javascript/text.js b/generators/javascript/text.js index 8b1c162c5..d81dd15f4 100644 --- a/generators/javascript/text.js +++ b/generators/javascript/text.js @@ -171,7 +171,7 @@ Blockly.JavaScript['text_charAt'] = function(block) { * @param {string} stringName Name of the string, used to calculate length. * @param {string} where The method of indexing, selected by dropdown in Blockly * @param {string=} opt_at The optional offset when indexing from start/end. - * @return {string} Index expression. + * @return {string|undefined} Index expression. * @private */ Blockly.JavaScript.text.getIndex_ = function(stringName, where, opt_at) { diff --git a/generators/lua/lists.js b/generators/lua/lists.js index 24dbf2c76..d56141a8f 100644 --- a/generators/lua/lists.js +++ b/generators/lua/lists.js @@ -114,7 +114,7 @@ Blockly.Lua['lists_indexOf'] = function(block) { * @param {string} listName Name of the list, used to calculate length. * @param {string} where The method of indexing, selected by dropdown in Blockly * @param {string=} opt_at The optional offset when indexing from start/end. - * @return {string} Index expression. + * @return {string|undefined} Index expression. * @private */ Blockly.Lua.lists.getIndex_ = function(listName, where, opt_at) { @@ -374,6 +374,6 @@ Blockly.Lua['lists_reverse'] = function(block) { ' end', ' return reversed', 'end']); - var code = 'list_reverse(' + list + ')'; + var code = functionName + '(' + list + ')'; return [code, Blockly.Lua.ORDER_HIGH]; }; diff --git a/generators/php/loops.js b/generators/php/loops.js index bbd2c6695..dc8a1d241 100644 --- a/generators/php/loops.js +++ b/generators/php/loops.js @@ -43,7 +43,7 @@ Blockly.PHP['controls_repeat_ext'] = function(block) { 'count', Blockly.VARIABLE_CATEGORY_NAME); var endVar = repeats; if (!repeats.match(/^\w+$/) && !Blockly.isNumber(repeats)) { - var endVar = Blockly.PHP.variableDB_.getDistinctName( + endVar = Blockly.PHP.variableDB_.getDistinctName( 'repeat_end', Blockly.VARIABLE_CATEGORY_NAME); code += endVar + ' = ' + repeats + ';\n'; } @@ -108,7 +108,7 @@ Blockly.PHP['controls_for'] = function(block) { } var endVar = argument1; if (!argument1.match(/^\w+$/) && !Blockly.isNumber(argument1)) { - var endVar = Blockly.PHP.variableDB_.getDistinctName( + endVar = Blockly.PHP.variableDB_.getDistinctName( variable0 + '_end', Blockly.VARIABLE_CATEGORY_NAME); code += endVar + ' = ' + argument1 + ';\n'; } diff --git a/generators/python/math.js b/generators/python/math.js index bc7b379ec..1a003c479 100644 --- a/generators/python/math.js +++ b/generators/python/math.js @@ -76,7 +76,7 @@ Blockly.Python['math_single'] = function(block) { var arg; if (operator == 'NEG') { // Negation is a special case given its different operator precedence. - var code = Blockly.Python.valueToCode(block, 'NUM', + code = Blockly.Python.valueToCode(block, 'NUM', Blockly.Python.ORDER_UNARY_SIGN) || '0'; return ['-' + code, Blockly.Python.ORDER_UNARY_SIGN]; }