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:
Nicole Parrot
2017-10-17 18:20:11 -04:00
committed by Rachel Fenichel
parent 5c00256e96
commit 97ce5b3e4f
5 changed files with 16 additions and 16 deletions

View File

@@ -47,7 +47,7 @@ Blockly.Dart['procedures_defreturn'] = function(block) {
var returnValue = Blockly.Dart.valueToCode(block, 'RETURN',
Blockly.Dart.ORDER_NONE) || '';
if (returnValue) {
returnValue = ' return ' + returnValue + ';\n';
returnValue = Blockly.Dart.INDENT + 'return ' + returnValue + ';\n';
}
var returnType = returnValue ? 'dynamic' : 'void';
var args = [];
@@ -101,9 +101,9 @@ Blockly.Dart['procedures_ifreturn'] = function(block) {
if (block.hasReturnValue_) {
var value = Blockly.Dart.valueToCode(block, 'VALUE',
Blockly.Dart.ORDER_NONE) || 'null';
code += ' return ' + value + ';\n';
code += Blockly.Dart.INDENT + 'return ' + value + ';\n';
} else {
code += ' return;\n';
code += Blockly.Dart.INDENT + 'return;\n';
}
code += '}\n';
return code;