Block generator warnings (#3353)

This commit is contained in:
Sam El-Husseini
2019-10-28 16:20:25 -07:00
committed by GitHub
parent cbf867f441
commit 72c6aa8699
9 changed files with 17 additions and 18 deletions

View File

@@ -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';
}

View File

@@ -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) {

View File

@@ -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';
}

View File

@@ -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) {

View File

@@ -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];
};

View File

@@ -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';
}

View File

@@ -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];
}