// ino.module.UnaryExpr.8655.package package de.dhbwstuttgart.syntaxtree.statement; // ino.end // ino.module.UnaryExpr.8655.import import java.util.Vector; import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.myexception.JVMCodeException; 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; // 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