}
}
+ public boolean isValue() {
+ FieldDescriptor tmpfd=fd;
+ if (tmpfd instanceof ArrayDescriptor)
+ tmpfd=((ArrayDescriptor)tmpfd).getField();
+ return (tmpfd.getPtr()||(tmpfd.getType() instanceof ReservedTypeDescriptor));
+ }
+
boolean typechecked=false;
public TypeDescriptor typecheck(SemanticAnalyzer sa) {
if (typechecked)
return null;
}
+ public boolean isValue() {
+ return false;
+ }
+
public int[] getRepairs(boolean negated) {
System.out.println(this.getClass().getName());
throw new Error("Unrecognized EXPR");
}
public static boolean isInt(Expr e) {
+ if (e==null)
+ return false;
if ((e instanceof IntegerLiteralExpr)||
((e instanceof OpExpr)&&(((OpExpr)e).opcode==Opcode.NOP)&&(((OpExpr)e).getLeftExpr() instanceof IntegerLiteralExpr)))
return true;
(isInt(left)&&(opcode==Opcode.RND))) {
this.opcode=Opcode.NOP;
this.right=null;
- int lint=getInt(left);
- int rint=getInt(right);
+ int lint=isInt(left)?getInt(left):0;
+ int rint=isInt(right)?getInt(right):0;
int value=0;
if (opcode==Opcode.ADD) {
value=lint+rint;
}
public Updates(Expr lexpr, Expr rexpr, Opcode op, boolean negate) {
+ if (!lexpr.isValue())
+ System.out.println("Building invalid update");
leftexpr=lexpr;
type=Updates.EXPR;
if (negate) {
}
public Updates(Expr lexpr, Expr rexpr) {
+ if (!lexpr.isValue())
+ System.out.println("Building invalid update");
leftexpr=lexpr;
rightexpr=rexpr;
type=Updates.EXPR;
}
public Updates(Expr lexpr, int rpos) {
+ if (!lexpr.isValue())
+ System.out.println("Building invalid update");
leftexpr=lexpr;
rightposition=rpos;
type=Updates.POSITION;
return vd;
}
+ public boolean isValue() {
+ return vd.isGlobal();
+ }
+
public void generate(CodeWriter writer, VarDescriptor dest) {
// #TBD#: bit of a hack, really should have been type checked properly