mirror of
https://github.com/google/blockly.git
synced 2026-01-10 02:17:09 +01:00
Fix indentation for function blocks with return statements (#1362)
* fix indentation for the return statement in function blocks that return a value * Fix hard-coded autoindent, and swap it for Blockly.PHP.INDENT * Fix hard-coded 2 spaces indent and use language-appropriate global indent
This commit is contained in:
committed by
Rachel Fenichel
parent
5c00256e96
commit
97ce5b3e4f
@@ -61,7 +61,7 @@ Blockly.Python['procedures_defreturn'] = function(block) {
|
||||
var returnValue = Blockly.Python.valueToCode(block, 'RETURN',
|
||||
Blockly.Python.ORDER_NONE) || '';
|
||||
if (returnValue) {
|
||||
returnValue = ' return ' + returnValue + '\n';
|
||||
returnValue = Blockly.Python.INDENT + 'return ' + returnValue + '\n';
|
||||
} else if (!branch) {
|
||||
branch = Blockly.Python.PASS;
|
||||
}
|
||||
@@ -117,9 +117,9 @@ Blockly.Python['procedures_ifreturn'] = function(block) {
|
||||
if (block.hasReturnValue_) {
|
||||
var value = Blockly.Python.valueToCode(block, 'VALUE',
|
||||
Blockly.Python.ORDER_NONE) || 'None';
|
||||
code += ' return ' + value + '\n';
|
||||
code += Blockly.Python.INDENT + 'return ' + value + '\n';
|
||||
} else {
|
||||
code += ' return\n';
|
||||
code += Blockly.Python.INDENT + 'return\n';
|
||||
}
|
||||
return code;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user