// ino.module.UnaryExpr.8655.package package mycompiler.mystatement; // ino.end // ino.module.UnaryExpr.8655.import import java.util.Vector; import typinferenz.ConstraintsSet; import typinferenz.OderConstraint; import typinferenz.UndConstraint; import typinferenz.assumptions.TypeAssumptions; import mycompiler.mybytecode.ClassFile; import mycompiler.mybytecode.CodeAttribute; import mycompiler.myexception.JVMCodeException; // ino.end import mycompiler.mytype.RefType; import mycompiler.mytype.TypePlaceholder; // ino.class.UnaryExpr.26298.declaration public abstract class UnaryExpr extends Expr // ino.end // ino.class.UnaryExpr.26298.body { public Expr expr; // ino.method.UnaryExpr.26302.definition 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 private Vector getNumericTypes(){ Vector ret = new Vector<>(); ret.add(new RefType("Integer",-1)); ret.add(new RefType("Long",-1)); ret.add(new RefType("Double",-1)); 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(); undConstraint.addConstraint(this.getType(), t); undConstraint.addConstraint(this.expr.getType(), t); oderConstraint.addConstraint(undConstraint); } ret.add(oderConstraint); return ret; } @Override public ConstraintsSet TYPEStmt(TypeAssumptions assumptions) { return this.TYPEExpr(assumptions); } } // ino.end