Resolve warnings in generator code (#3350)

This commit is contained in:
Sam El-Husseini
2019-10-28 09:35:40 -07:00
committed by GitHub
parent fa5f256a3f
commit 64c52efb5b
34 changed files with 81 additions and 80 deletions

View File

@@ -95,7 +95,7 @@ Blockly.Dart['lists_getIndex'] = function(block) {
// Closure, which accesses and modifies 'list'.
function cacheList() {
var listVar = Blockly.Dart.variableDB_.getDistinctName(
'tmp_list', Blockly.Variables.NAME_TYPE);
'tmp_list', Blockly.VARIABLE_CATEGORY_NAME);
var code = 'List ' + listVar + ' = ' + list + ';\n';
list = listVar;
return code;
@@ -112,7 +112,7 @@ Blockly.Dart['lists_getIndex'] = function(block) {
// We can use multiple statements.
var code = cacheList();
var xVar = Blockly.Dart.variableDB_.getDistinctName(
'tmp_x', Blockly.Variables.NAME_TYPE);
'tmp_x', Blockly.VARIABLE_CATEGORY_NAME);
code += 'int ' + xVar + ' = new Math.Random().nextInt(' + list +
'.length);\n';
code += list + '.removeAt(' + xVar + ');\n';
@@ -211,7 +211,7 @@ Blockly.Dart['lists_getIndex'] = function(block) {
if (mode == 'REMOVE') {
// We can use multiple statements.
var xVar = Blockly.Dart.variableDB_.getDistinctName(
'tmp_x', Blockly.Variables.NAME_TYPE);
'tmp_x', Blockly.VARIABLE_CATEGORY_NAME);
var code = 'int ' + xVar + ' = new Math.Random().nextInt(' + list +
'.length);\n';
code += list + '.removeAt(' + xVar + ');\n';
@@ -259,7 +259,7 @@ Blockly.Dart['lists_setIndex'] = function(block) {
return '';
}
var listVar = Blockly.Dart.variableDB_.getDistinctName(
'tmp_list', Blockly.Variables.NAME_TYPE);
'tmp_list', Blockly.VARIABLE_CATEGORY_NAME);
var code = 'List ' + listVar + ' = ' + list + ';\n';
list = listVar;
return code;
@@ -308,7 +308,7 @@ Blockly.Dart['lists_setIndex'] = function(block) {
'import \'dart:math\' as Math;';
var code = cacheList();
var xVar = Blockly.Dart.variableDB_.getDistinctName(
'tmp_x', Blockly.Variables.NAME_TYPE);
'tmp_x', Blockly.VARIABLE_CATEGORY_NAME);
code += 'int ' + xVar +
' = new Math.Random().nextInt(' + list + '.length);\n';
if (mode == 'SET') {