mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
Reduce unneeded parentheses in JS and Python.
This commit is contained in:
@@ -90,12 +90,8 @@ Blockly.Dart['lists_getIndex'] = function(block) {
|
||||
var where = block.getFieldValue('WHERE') || 'FROM_START';
|
||||
var at = Blockly.Dart.valueToCode(block, 'AT',
|
||||
Blockly.Dart.ORDER_UNARY_PREFIX) || '1';
|
||||
// Special case to avoid wrapping function calls in unneeded parenthesis.
|
||||
// func()[0] is prefered over (func())[0]
|
||||
var valueBlock = this.getInputTargetBlock('VALUE');
|
||||
var order = (valueBlock && valueBlock.type == 'procedures_callreturn') ?
|
||||
Blockly.Dart.ORDER_NONE : Blockly.Dart.ORDER_UNARY_POSTFIX;
|
||||
var list = Blockly.Dart.valueToCode(block, 'VALUE', order) || '[]';
|
||||
var list = Blockly.Dart.valueToCode(block, 'VALUE',
|
||||
Blockly.Dart.ORDER_UNARY_POSTFIX) || '[]';
|
||||
|
||||
if (where == 'FIRST') {
|
||||
if (mode == 'GET') {
|
||||
|
||||
Reference in New Issue
Block a user