Lint corrections.

This commit is contained in:
Neil Fraser
2015-07-02 19:41:10 -07:00
parent d1f6bdb173
commit d819db2acf
6 changed files with 16 additions and 8 deletions

View File

@@ -169,7 +169,8 @@ Blockly.PHP['lists_getIndex'] = function(block) {
var code = 'array_slice(' + list + ', -' + at + ', 1)[0]';
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
} else if (mode == 'GET_REMOVE' || mode == 'REMOVE') {
code = 'array_splice(' + list + ', count(' + list + ') - ' + at + ', 1)[0]';
code = 'array_splice(' + list +
', count(' + list + ') - ' + at + ', 1)[0]';
if (mode == 'GET_REMOVE') {
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
} else if (mode == 'REMOVE') {
@@ -366,6 +367,6 @@ Blockly.PHP['lists_split'] = function(block) {
} else {
throw 'Unknown mode: ' + mode;
}
var code = functionName + '('+ value_delim + ', ' + value_input + ')';
var code = functionName + '(' + value_delim + ', ' + value_input + ')';
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
};

View File

@@ -153,7 +153,8 @@ Blockly.PHP['controls_forEach'] = function(block) {
var branch = Blockly.PHP.statementToCode(block, 'DO');
branch = Blockly.PHP.addLoopTrap(branch, block.id);
var code = '';
code += 'foreach (' + argument0 + ' as ' + variable0 + ') {\n' + branch + '}\n';
code += 'foreach (' + argument0 + ' as ' + variable0 +
') {\n' + branch + '}\n';
return code;
};

View File

@@ -97,9 +97,10 @@ Blockly.PHP['text_indexOf'] = function(block) {
var code = operator + '(' + argument1 + ', ' + argument0 + ') + 1';
var functionName = Blockly.PHP.provideFunction_(
block.getFieldValue('END') == 'FIRST'?'text_indexOf':'text_lastIndexOf',
block.getFieldValue('END') == 'FIRST' ?
'text_indexOf' : 'text_lastIndexOf',
[ 'function ' + Blockly.PHP.FUNCTION_NAME_PLACEHOLDER_ +
'($text, $search) {',
'($text, $search) {',
' $pos = ' + operator + '($text, $search);',
' return $pos === false ? 0 : $pos + 1;',
'}']);