rvalueType reworked, didn't work since setLValueType is overloaded

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@326 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 45b0e6a131
commit 3094724277
  1. 16
      jode/jode/expr/StoreInstruction.java

@ -30,13 +30,12 @@ public abstract class StoreInstruction extends Operator
public StoreInstruction(Type type, int operator) { public StoreInstruction(Type type, int operator) {
super(Type.tVoid, operator); super(Type.tVoid, operator);
lvalueType = type; lvalueType = type;
rvalueType = type; rvalueType = Type.tUnknown;
lvCasts = lvalueType.toString(); lvCasts = lvalueType.toString();
} }
public void makeOpAssign(int operator) { public void makeOpAssign(int operator) {
setOperatorIndex(operator); setOperatorIndex(operator);
rvalueType = Type.tUnknown;
} }
public Type getType() { public Type getType() {
@ -95,9 +94,13 @@ public abstract class StoreInstruction extends Operator
} }
public Type getOperandType(int i) { public Type getOperandType(int i) {
if (i == getLValueOperandCount()) if (i == getLValueOperandCount()) {
return rvalueType; if (getOperatorIndex() == ASSIGN_OP)
/* In a direct assignment, lvalueType is rvalueType */
return getLValueType();
else else
return rvalueType;
} else
return getLValueOperandType(i); return getLValueOperandType(i);
} }
@ -105,10 +108,11 @@ public abstract class StoreInstruction extends Operator
int count = getLValueOperandCount(); int count = getLValueOperandCount();
if (count > 0) if (count > 0)
setLValueOperandType(t); setLValueOperandType(t);
rvalueType = rvalueType.intersection(t[count]);
if (getOperatorIndex() == ASSIGN_OP) if (getOperatorIndex() == ASSIGN_OP)
/* In a direct assignment, lvalueType is rvalueType */ /* In a direct assignment, lvalueType is rvalueType */
setLValueType(rvalueType); setLValueType(t[count]);
else
rvalueType = rvalueType.intersection(t[count]);
} }
public int getOperandCount() { public int getOperandCount() {

Loading…
Cancel
Save