r4898@macbookpro: aamine | 2009-05-24 11:57:29 +0900

* net/loveruby/cflat/compiler/IRGenerator.java (If): refactoring: increase readability.
 


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4237 1b9489fe-b721-0410-924e-b54b9192deb8
This commit is contained in:
Minero Aoki 2009-05-24 02:57:48 +00:00
parent ad7af66f8b
commit e27f329f98
2 changed files with 18 additions and 11 deletions

View File

@ -1,3 +1,8 @@
Sun May 24 11:58:15 2009 Minero Aoki <aamine@loveruby.net>
* net/loveruby/cflat/compiler/IRGenerator.java (If): refactoring:
increase readability.
Sun May 24 02:08:47 2009 Minero Aoki <aamine@loveruby.net>
* utilize final field.

View File

@ -180,20 +180,22 @@ class IRGenerator implements ASTVisitor<Void, Expr> {
Label thenLabel = new Label();
Label elseLabel = new Label();
Label endLabel = new Label();
cjump(node.location(),
transformExpr(node.cond()),
thenLabel,
node.elseBody() == null ? endLabel : elseLabel);
label(thenLabel);
transformStmt(node.thenBody());
jump(endLabel);
if (node.elseBody() != null) {
Expr cond = transformExpr(node.cond());
if (node.elseBody() == null) {
cjump(node.location(), cond, thenLabel, endLabel);
label(thenLabel);
transformStmt(node.thenBody());
label(endLabel);
}
else {
cjump(node.location(), cond, thenLabel, elseLabel);
label(thenLabel);
transformStmt(node.thenBody());
jump(endLabel);
label(elseLabel);
transformStmt(node.elseBody());
jump(endLabel);
label(endLabel);
}
label(endLabel);
return null;
}
// #@@}