* net/loveruby/cflat/compiler/Simplifier.java (SwitchNode): missing end label.

git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4148 1b9489fe-b721-0410-924e-b54b9192deb8
This commit is contained in:
Minero Aoki 2009-04-26 07:10:29 +00:00
parent 9e9f65d6ce
commit 732ebf51d4
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Sun Apr 26 16:10:27 2009 Minero Aoki <aamine@loveruby.net>
* net/loveruby/cflat/compiler/Simplifier.java (SwitchNode):
missing end label.
Sun Apr 26 15:48:10 2009 Minero Aoki <aamine@loveruby.net>
* net/loveruby/cflat/ast/FuncallNode.java: make a static funcall

View File

@ -180,13 +180,18 @@ class Simplifier implements ASTVisitor<Void, ExprNode> {
}
public Void visit(SwitchNode node) {
Label endLabel = new Label();
stmts.add(node);
node.setCond(transform(node.cond()));
pushBreak(endLabel);
for (CaseNode c : node.cases()) {
label(c.beginLabel());
transform(c.body());
jump(node.endLabel());
jump(endLabel);
}
popBreak();
label(endLabel);
return null;
}
@ -198,6 +203,7 @@ class Simplifier implements ASTVisitor<Void, ExprNode> {
Label begLabel = new Label();
Label bodyLabel = new Label();
Label endLabel = new Label();
label(begLabel);
branch(transform(node.cond()), bodyLabel, endLabel);
label(bodyLabel);