2013-10-18 11:33:46 +00:00
|
|
|
// ino.module.UnaryExpr.8655.package
|
2014-09-02 08:33:54 +00:00
|
|
|
package de.dhbwstuttgart.syntaxtree.statement;
|
2013-10-18 11:33:46 +00:00
|
|
|
// ino.end
|
|
|
|
// ino.module.UnaryExpr.8655.import
|
|
|
|
import java.util.Vector;
|
2014-08-28 17:05:57 +00:00
|
|
|
|
2014-09-04 14:35:44 +00:00
|
|
|
import de.dhbwstuttgart.bytecode.ClassFile;
|
|
|
|
import de.dhbwstuttgart.bytecode.CodeAttribute;
|
|
|
|
import de.dhbwstuttgart.myexception.JVMCodeException;
|
2014-09-02 08:33:54 +00:00
|
|
|
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
|
|
|
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
|
|
|
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
|
|
|
import de.dhbwstuttgart.typeinference.OderConstraint;
|
|
|
|
import de.dhbwstuttgart.typeinference.UndConstraint;
|
|
|
|
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
2013-10-18 11:33:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ino.class.UnaryExpr.26298.declaration
|
|
|
|
public abstract class UnaryExpr extends Expr
|
|
|
|
// ino.end
|
|
|
|
// ino.class.UnaryExpr.26298.body
|
|
|
|
{
|
2014-08-28 17:05:57 +00:00
|
|
|
public Expr expr;
|
|
|
|
|
|
|
|
// ino.method.UnaryExpr.26302.definition
|
2013-10-18 11:33:46 +00:00
|
|
|
public UnaryExpr(int offset,int variableLength)
|
|
|
|
// ino.end
|
|
|
|
// ino.method.UnaryExpr.26302.body
|
|
|
|
{
|
|
|
|
super(offset,variableLength);
|
|
|
|
}
|
|
|
|
// ino.end
|
|
|
|
|
|
|
|
// ino.method.codegen.26305.declaration
|
|
|
|
public abstract void codegen(ClassFile classfile, CodeAttribute code, Vector paralist)
|
|
|
|
throws JVMCodeException;
|
|
|
|
// ino.end
|
2014-08-28 17:05:57 +00:00
|
|
|
|
|
|
|
private Vector<RefType> getNumericTypes(){
|
|
|
|
Vector<RefType> ret = new Vector<>();
|
2014-09-14 16:38:43 +00:00
|
|
|
ret.add(new RefType("Integer",this,-1));
|
|
|
|
ret.add(new RefType("Long",this,-1));
|
|
|
|
ret.add(new RefType("Double",this,-1));
|
2014-08-28 17:05:57 +00:00
|
|
|
return ret ;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
|
|
|
if(this.getType() == null)this.setType(TypePlaceholder.fresh(this));
|
|
|
|
ConstraintsSet ret = new ConstraintsSet();
|
|
|
|
OderConstraint oderConstraint = new OderConstraint();
|
|
|
|
ret.add(this.expr.TYPEExpr(assumptions));
|
|
|
|
for(RefType t : getNumericTypes()){
|
|
|
|
UndConstraint undConstraint = new UndConstraint();
|
2014-09-08 13:12:47 +00:00
|
|
|
undConstraint.addConstraint(this.getType().TYPE(assumptions, this), t.TYPE(assumptions, this));
|
|
|
|
undConstraint.addConstraint(this.expr.getType().TYPE(assumptions, this), t.TYPE(assumptions, this));
|
2014-08-28 17:05:57 +00:00
|
|
|
|
|
|
|
oderConstraint.addConstraint(undConstraint);
|
|
|
|
}
|
|
|
|
ret.add(oderConstraint);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions) {
|
|
|
|
return this.TYPEExpr(assumptions);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-10-18 11:33:46 +00:00
|
|
|
}
|
|
|
|
// ino.end
|