//Make sure the variable is declared as a parameter to the task
VarDescriptor vd=(VarDescriptor)td.getParameterTable().get(varname);
if (vd==null)
- throw new Error("Parameter "+varname+" in Flag Effects not declared");
+ throw new Error("Parameter "+varname+" in Flag Effects not declared in "+td);
fe.setVar(vd);
//Make sure it correspods to a class
(d instanceof FieldDescriptor)) {
nametable.add(vd);
} else
- throw new Error(vd.getSymbol()+" defined a second time");
+ throw new Error(vd.getSymbol()+" in "+md+" defined a second time");
if (dn.getExpression()!=null)
checkExpressionNode(md, nametable, dn.getExpression(), vd.getType());
}
else
fd=(FieldDescriptor) ltd.getClassDesc().getFieldTable().get(fieldname);
if (fd==null)
- throw new Error("Unknown field "+fieldname + " in "+fan.printNode(0));
+ throw new Error("Unknown field "+fieldname + " in "+fan.printNode(0)+" in "+md);
fan.setField(fd);
if (td!=null)
if (!typeutil.isSuperorType(td,fan.getType()))
String varname=nd.toString();
Descriptor d=(Descriptor)nametable.get(varname);
if (d==null) {
- throw new Error("Name "+varname+" undefined");
+ throw new Error("Name "+varname+" undefined in: "+md);
}
if (d instanceof VarDescriptor) {
nn.setVar(d);
throw new Error("Bad lside in "+an.printNode(0));
checkExpressionNode(md, nametable, an.getDest(), null);
+
/* We want parameter variables to tasks to be immutable */
if (md instanceof TaskDescriptor) {
if (an.getDest() instanceof NameNode) {
}
}
+ if (an.getDest().getType().isString()&&an.getOperation().getOp()==AssignOperation.PLUSEQ) {
+ //String add
+ ClassDescriptor stringcl=typeutil.getClass(TypeUtil.StringClass);
+ TypeDescriptor stringtd=new TypeDescriptor(stringcl);
+ NameDescriptor nd=new NameDescriptor("String");
+ NameDescriptor valuend=new NameDescriptor(nd, "valueOf");
+
+ if (!(an.getSrc().getType().isString()&&(an.getSrc() instanceof OpNode))) {
+ MethodInvokeNode rightmin=new MethodInvokeNode(valuend);
+ rightmin.addArgument(an.getSrc());
+ an.right=rightmin;
+ checkExpressionNode(md, nametable, an.getSrc(), null);
+ }
+ }
+
+
if (!postinc&&!typeutil.isSuperorType(an.getDest().getType(),an.getSrc().getType())) {
throw new Error("Type of rside ("+an.getSrc().getType()+") not compatible with type of lside ("+an.getDest().getType()+")"+an.printNode(0));
}
}
}
if (bestmd==null)
- throw new Error("No method found for "+con.printNode(0));
+ throw new Error("No method found for "+con.printNode(0)+" in "+md);
con.setConstructor(bestmd);
}
}
}
}
if (bestmd==null)
- throw new Error("No method found for :"+min.printNode(0));
+ throw new Error("No method found for :"+min.printNode(0)+" in class: " + classtolookin+" in "+md);
min.setMethod(bestmd);
if ((td!=null)&&(min.getType()!=null)&&!typeutil.isSuperorType(td, min.getType()))
on.setType(new TypeDescriptor(TypeDescriptor.BOOLEAN));
break;
+ case Operation.COMP:
+ // 5.6.2 Binary Numeric Promotion
+ //TODO unboxing of reference objects
+ if (ltd.isDouble())
+ throw new Error();
+ else if (ltd.isFloat())
+ throw new Error();
+ else if (ltd.isLong())
+ lefttype=new TypeDescriptor(TypeDescriptor.LONG);
+ else
+ lefttype=new TypeDescriptor(TypeDescriptor.INT);
+ on.setLeftType(lefttype);
+ on.setType(lefttype);
+ break;
+
case Operation.BIT_OR:
case Operation.BIT_XOR:
case Operation.BIT_AND:
TypeDescriptor stringtd=new TypeDescriptor(stringcl);
NameDescriptor nd=new NameDescriptor("String");
NameDescriptor valuend=new NameDescriptor(nd, "valueOf");
- MethodInvokeNode leftmin=new MethodInvokeNode(valuend);
- MethodInvokeNode rightmin=new MethodInvokeNode(valuend);
- leftmin.addArgument(on.getLeft());
- rightmin.addArgument(on.getRight());
- on.left=leftmin;
- on.right=rightmin;
- checkExpressionNode(md, nametable, on.getLeft(), null);
- checkExpressionNode(md, nametable, on.getRight(), null);
+ if (!(ltd.isString()&&(on.getLeft() instanceof OpNode))) {
+ MethodInvokeNode leftmin=new MethodInvokeNode(valuend);
+ leftmin.addArgument(on.getLeft());
+ on.left=leftmin;
+ checkExpressionNode(md, nametable, on.getLeft(), null);
+ }
+
+ if (!(rtd.isString()&&(on.getRight() instanceof OpNode))) {
+ MethodInvokeNode rightmin=new MethodInvokeNode(valuend);
+ rightmin.addArgument(on.getRight());
+ on.right=rightmin;
+ checkExpressionNode(md, nametable, on.getRight(), null);
+ }
+
on.setLeftType(stringtd);
on.setRightType(stringtd);
on.setType(stringtd);
case Operation.LEFTSHIFT:
case Operation.RIGHTSHIFT:
+ case Operation.URIGHTSHIFT:
if (!rtd.isIntegerType())
throw new Error();
//5.6.1 Unary Numeric Promotion