mirror of
https://github.com/google/blockly.git
synced 2026-01-06 08:30:13 +01:00
Resolve warnings in generator code (#3350)
This commit is contained in:
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user