Commit ecd1981e authored by 皮皮蟹's avatar 皮皮蟹 Committed by Evan W. Patton

Add default statement for empty variable block (#1391)

Fixes #1390
parent da5227b4
......@@ -136,14 +136,15 @@ Blockly.Yail['local_variable'] = function(block,isExpression) {
// [lyn, 01/15/2013] Added to fix bug in local declaration expressions:
if(isExpression){
if(!block.getInputTargetBlock("RETURN")){
code += Blockly.Yail.YAIL_SPACER + "0";
code += Blockly.Yail.YAIL_SPACER + "0";
} else {
code += Blockly.Yail.YAIL_SPACER + Blockly.Yail.valueToCode(block, 'RETURN', Blockly.Yail.ORDER_NONE);
code += Blockly.Yail.YAIL_SPACER + Blockly.Yail.valueToCode(block, 'RETURN', Blockly.Yail.ORDER_NONE);
}
} else {
code += Blockly.Yail.YAIL_SPACER + Blockly.Yail.statementToCode(block, 'STACK', Blockly.Yail.ORDER_NONE);
code += Blockly.Yail.YAIL_SPACER +
(Blockly.Yail.statementToCode(block, 'STACK', Blockly.Yail.ORDER_NONE) || Blockly.Yail.YAIL_FALSE);
}
code += Blockly.Yail.YAIL_SPACER + Blockly.Yail.YAIL_CLOSE_COMBINATION;
code += Blockly.Yail.YAIL_SPACER + Blockly.Yail.YAIL_CLOSE_COMBINATION;
if(!isExpression){
return code;
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment