Lint fixes.

This commit is contained in:
Neil Fraser
2015-01-22 15:58:10 -08:00
parent f8365e9eba
commit 1c39a638e3
27 changed files with 71 additions and 2129 deletions

View File

@@ -28,14 +28,12 @@ goog.provide('Blockly.Python.loops');
goog.require('Blockly.Python');
Blockly.Python.LOOP_PASS = ' pass\n';
Blockly.Python['controls_repeat'] = function(block) {
// Repeat n times (internal number).
var repeats = parseInt(block.getFieldValue('TIMES'), 10);
var branch = Blockly.Python.statementToCode(block, 'DO');
branch = Blockly.Python.addLoopTrap(branch, block.id) ||
Blockly.Python.LOOP_PASS;
Blockly.Python.PASS;
var loopVar = Blockly.Python.variableDB_.getDistinctName(
'count', Blockly.Variables.NAME_TYPE);
var code = 'for ' + loopVar + ' in range(' + repeats + '):\n' + branch;
@@ -53,7 +51,7 @@ Blockly.Python['controls_repeat_ext'] = function(block) {
}
var branch = Blockly.Python.statementToCode(block, 'DO');
branch = Blockly.Python.addLoopTrap(branch, block.id) ||
Blockly.Python.LOOP_PASS;
Blockly.Python.PASS;
var loopVar = Blockly.Python.variableDB_.getDistinctName(
'count', Blockly.Variables.NAME_TYPE);
var code = 'for ' + loopVar + ' in range(' + repeats + '):\n' + branch;
@@ -68,7 +66,7 @@ Blockly.Python['controls_whileUntil'] = function(block) {
Blockly.Python.ORDER_NONE) || 'False';
var branch = Blockly.Python.statementToCode(block, 'DO');
branch = Blockly.Python.addLoopTrap(branch, block.id) ||
Blockly.Python.LOOP_PASS;
Blockly.Python.PASS;
if (until) {
argument0 = 'not ' + argument0;
}
@@ -87,7 +85,7 @@ Blockly.Python['controls_for'] = function(block) {
Blockly.Python.ORDER_NONE) || '1';
var branch = Blockly.Python.statementToCode(block, 'DO');
branch = Blockly.Python.addLoopTrap(branch, block.id) ||
Blockly.Python.LOOP_PASS;
Blockly.Python.PASS;
var code = '';
var range;
@@ -199,7 +197,7 @@ Blockly.Python['controls_forEach'] = function(block) {
Blockly.Python.ORDER_RELATIONAL) || '[]';
var branch = Blockly.Python.statementToCode(block, 'DO');
branch = Blockly.Python.addLoopTrap(branch, block.id) ||
Blockly.Python.LOOP_PASS;
Blockly.Python.PASS;
var code = 'for ' + variable0 + ' in ' + argument0 + ':\n' + branch;
return code;
};