mirror of
https://github.com/google/blockly.git
synced 2026-01-06 08:30:13 +01:00
Lint fixes.
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user