set type of right hand side

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@372 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 25d7ed801b
commit 407e22750e
  1. 7
      jode/jode/flow/CreateAssignExpression.java

@ -19,6 +19,7 @@
package jode.flow; package jode.flow;
import jode.expr.*; import jode.expr.*;
import jode.Type;
public class CreateAssignExpression { public class CreateAssignExpression {
@ -91,6 +92,7 @@ public class CreateAssignExpression {
} }
int opIndex; int opIndex;
Expression rightHandSide; Expression rightHandSide;
Type rhsType;
if (expr.getOperator() instanceof ConvertOperator if (expr.getOperator() instanceof ConvertOperator
&& expr.getSubExpressions()[0] instanceof ComplexExpression && expr.getSubExpressions()[0] instanceof ComplexExpression
@ -120,6 +122,7 @@ public class CreateAssignExpression {
|| !store.matches((Operator) loadExpr)) || !store.matches((Operator) loadExpr))
return false; return false;
rightHandSide = expr.getSubExpressions()[1]; rightHandSide = expr.getSubExpressions()[1];
rhsType = binop.getOperandType(1);
} else { } else {
/* For String += the situation is more complex. /* For String += the situation is more complex.
* what is marked as load(stack) * rightHandSide above is * what is marked as load(stack) * rightHandSide above is
@ -142,6 +145,8 @@ public class CreateAssignExpression {
|| !store.matches((Operator) simple)) || !store.matches((Operator) simple))
return false; return false;
rhsType = lastExpr.getOperator().getOperandType(1);
/* ... and remove it. */ /* ... and remove it. */
if (lastExpr.getParent() != null) { if (lastExpr.getParent() != null) {
ComplexExpression ce = (ComplexExpression)lastExpr.getParent(); ComplexExpression ce = (ComplexExpression)lastExpr.getParent();
@ -158,7 +163,7 @@ public class CreateAssignExpression {
dup.removeBlock(); dup.removeBlock();
ib.setInstruction(rightHandSide); ib.setInstruction(rightHandSide);
store.makeOpAssign(store.OPASSIGN_OP+opIndex); store.makeOpAssign(store.OPASSIGN_OP+opIndex, rhsType);
if (isAssignOp) if (isAssignOp)
store.makeNonVoid(); store.makeNonVoid();

Loading…
Cancel
Save