|
|
@ -93,10 +93,9 @@ public class InstructionBlock extends InstructionContainer { |
|
|
|
* @return true if this block should be sorrounded by braces. |
|
|
|
* @return true if this block should be sorrounded by braces. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean needsBraces() { |
|
|
|
public boolean needsBraces() { |
|
|
|
return declare != null && !declare.isEmpty(); |
|
|
|
return isDeclaration || (declare != null && !declare.isEmpty()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Check if this is an local store instruction to a not yet declared |
|
|
|
* Check if this is an local store instruction to a not yet declared |
|
|
|
* variable. In that case mark this as declaration and return the |
|
|
|
* variable. In that case mark this as declaration and return the |
|
|
@ -134,14 +133,15 @@ public class InstructionBlock extends InstructionContainer { |
|
|
|
public void dumpInstruction(TabbedPrintWriter writer) |
|
|
|
public void dumpInstruction(TabbedPrintWriter writer) |
|
|
|
throws java.io.IOException |
|
|
|
throws java.io.IOException |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (isDeclaration) { |
|
|
|
if (instr.getType() != Type.tVoid) |
|
|
|
|
|
|
|
writer.print("PUSH "); |
|
|
|
|
|
|
|
else if (isDeclaration) { |
|
|
|
LocalInfo local = ((LocalStoreOperator) instr.getOperator()) |
|
|
|
LocalInfo local = ((LocalStoreOperator) instr.getOperator()) |
|
|
|
.getLocalInfo(); |
|
|
|
.getLocalInfo(); |
|
|
|
writer.println(local.getType().getHint() + " " + instr + ";"); |
|
|
|
writer.printType(local.getType().getHint()); |
|
|
|
} else { |
|
|
|
writer.print(" "); |
|
|
|
if (instr.getType() != Type.tVoid) |
|
|
|
} |
|
|
|
writer.print("PUSH "); |
|
|
|
instr.dumpExpression(writer); |
|
|
|
writer.println(instr.toString()+";"); |
|
|
|
writer.println(";"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|