コード例 #1
0
 public static void writeIf(If if1, CGenerator cgen) throws IOException {
   cgen.current.app("if (");
   if1.getCondition().accept(cgen);
   cgen.current.app(")");
   NodeList<Line> body = if1.getBody();
   cgen.current.openBlock();
   body.accept(cgen);
   cgen.current.closeBlock();
 }
コード例 #2
0
 public static void writeElse(Else else1, CGenerator cgen) throws IOException {
   cgen.current.app("else ");
   NodeList<Line> body = else1.getBody();
   if (body.size() == 1 && (body.get(0).getStatement() instanceof If)) {
     body.get(0).getStatement().accept(cgen);
   } else {
     cgen.current.openBlock();
     body.accept(cgen);
     cgen.current.closeBlock();
   }
 }