MCPcopy Create free account
hub / github.com/chibash/stone / translate

Method translate

src/chap14/ToJava.java:192–205  ·  view source on GitHub ↗
(TypeInfo result)

Source from the content-addressed store, hash-verified

190 @Reviser public static class IfEx extends IfStmnt {
191 public IfEx(List<ASTree> c) { super(c); }
192 public String translate(TypeInfo result) {
193 StringBuilder code = new StringBuilder();
194 code.append("if(");
195 code.append(((ASTreeEx)condition()).translate(null));
196 code.append("!=0){\n");
197 code.append(((ASTreeEx)thenBlock()).translate(result));
198 code.append("} else {\n");
199 ASTree elseBk = elseBlock();
200 if (elseBk != null)
201 code.append(((ASTreeEx)elseBk).translate(result));
202 else if (result != null)
203 code.append(returnZero(result));
204 return code.append("}\n").toString();
205 }
206 }
207 @Reviser public static class WhileEx extends WhileStmnt {
208 public WhileEx(List<ASTree> c) { super(c); }

Callers 8

translateExprMethod · 0.45
translateAssignMethod · 0.45
translateMethod · 0.45
translateMethod · 0.45
translateStmntMethod · 0.45
translateMethod · 0.45
translateMethod · 0.45
translateMethod · 0.45

Calls 6

thenBlockMethod · 0.80
elseBlockMethod · 0.80
returnZeroMethod · 0.80
appendMethod · 0.45
conditionMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected