r4756@macbookpro: aamine | 2009-05-07 11:06:57 +0900

* net/loveruby/cflat/compiler/IRGenerator.java (BinaryOpNode): evaluate RIGHT before LEFT.
 


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4189 1b9489fe-b721-0410-924e-b54b9192deb8
This commit is contained in:
Minero Aoki 2009-05-08 10:41:00 +00:00
parent e57e42b188
commit e06185e56d
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Thu May 7 11:06:48 2009 Minero Aoki <aamine@loveruby.net>
* net/loveruby/cflat/compiler/IRGenerator.java (BinaryOpNode):
evaluate RIGHT before LEFT.
Thu May 7 10:31:12 2009 Minero Aoki <aamine@loveruby.net> Thu May 7 10:31:12 2009 Minero Aoki <aamine@loveruby.net>
* net/loveruby/cflat/compiler/IRGenerator.java: fix compile error. * net/loveruby/cflat/compiler/IRGenerator.java: fix compile error.

View File

@ -567,8 +567,8 @@ class IRGenerator implements ASTVisitor<Void, Expr> {
// #@@range/BinaryOp{ // #@@range/BinaryOp{
public Expr visit(BinaryOpNode node) { public Expr visit(BinaryOpNode node) {
Expr left = transformExpr(node.left());
Expr right = transformExpr(node.right()); Expr right = transformExpr(node.right());
Expr left = transformExpr(node.left());
if (node.operator().equals("+") || node.operator().equals("-")) { if (node.operator().equals("+") || node.operator().equals("-")) {
if (node.left().type().isDereferable()) { if (node.left().type().isDereferable()) {
right = new Bin(ptrDiffType(), Op.MUL, right = new Bin(ptrDiffType(), Op.MUL,