new rvaluetype, lvaluetype != rvaluetype for non ASSIGN_OP

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@306 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 640afa8178
commit f19074f0ef
  1. 14
      jode/jode/expr/StoreInstruction.java

@ -25,13 +25,20 @@ public abstract class StoreInstruction extends Operator
public String lvCasts; public String lvCasts;
Type lvalueType; Type lvalueType;
Type rvalueType;
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;
lvCasts = lvalueType.toString(); lvCasts = lvalueType.toString();
} }
public void makeOpAssign(int operator) {
setOperatorIndex(operator);
rvalueType = Type.tUnknown;
}
public Type getType() { public Type getType() {
return type == Type.tVoid ? type : getLValueType(); return type == Type.tVoid ? type : getLValueType();
} }
@ -89,7 +96,7 @@ public abstract class StoreInstruction extends Operator
public Type getOperandType(int i) { public Type getOperandType(int i) {
if (i == getLValueOperandCount()) if (i == getLValueOperandCount())
return getLValueType(); return rvalueType;
else else
return getLValueOperandType(i); return getLValueOperandType(i);
} }
@ -98,7 +105,10 @@ public abstract class StoreInstruction extends Operator
int count = getLValueOperandCount(); int count = getLValueOperandCount();
if (count > 0) if (count > 0)
setLValueOperandType(t); setLValueOperandType(t);
setLValueType(t[count]); rvalueType = rvalueType.intersection(t[count]);
if (getOperatorIndex() == ASSIGN_OP)
/* In a direct assignment, lvalueType is rvalueType */
setLValueType(rvalueType);
} }
public int getOperandCount() { public int getOperandCount() {

Loading…
Cancel
Save