// ino.module.Binary.8623.package package mycompiler.mystatement; // ino.end // ino.module.Binary.8623.import import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; import mycompiler.mybytecode.ClassFile; import mycompiler.mybytecode.CodeAttribute; import mycompiler.mybytecode.JVMCode; import mycompiler.myclass.Class; import mycompiler.myexception.CTypeReconstructionException; import mycompiler.myexception.JVMCodeException; import mycompiler.myexception.SCExcept; import mycompiler.myexception.SCStatementException; import mycompiler.myoperator.AddOp; import mycompiler.myoperator.LogOp; import mycompiler.myoperator.MulOp; import mycompiler.myoperator.Operator; import mycompiler.myoperator.RelOp; import mycompiler.mytype.GenericTypeVar; import mycompiler.mytype.Type; import mycompiler.mytypereconstruction.CSupportData; import mycompiler.mytypereconstruction.set.CSubstitutionSet; import mycompiler.mytypereconstruction.set.CTripleSet; import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; import org.apache.log4j.Logger; // ino.end import sun.reflect.generics.reflectiveObjects.NotImplementedException; import typinferenz.ConstraintsSet; import typinferenz.JavaCodeResult; import typinferenz.ResultSet; import typinferenz.TypeAssumptions; // ino.class.Binary.24966.description type=line // neu von Felix // ino.end // ino.class.Binary.24966.declaration public class Binary extends BinaryExpr // ino.end // ino.class.Binary.24966.body { // ino.method.Binary.24970.definition public Binary(int offset, int variableLength) // ino.end // ino.method.Binary.24970.body { super(offset,variableLength); } // ino.end // ino.attribute.parserlog.24973.decldescription type=javadoc /** * Logger: log4j */ // ino.end // ino.attribute.parserlog.24973.declaration protected static Logger parserlog = Logger.getLogger("parser"); // ino.end // ino.attribute.expr1.24976.declaration public Expr expr1; // ino.end // ino.attribute.op.24979.declaration public Operator op; // ino.end // ino.attribute.expr2.24982.declaration public Expr expr2; // ino.end // ino.method.sc_check.24985.definition public void sc_check(Vector classname, Hashtable ch, Hashtable bh, boolean ext, Hashtable parach, Hashtable parabh) throws SCStatementException // ino.end // ino.method.sc_check.24985.body { Operator testen = get_Operator(); if(ext) parserlog.debug(" ---Binary---"); SCStatementException except=null; try { expr1.sc_check(classname, ch, bh, ext, parach, parabh); parserlog.debug("expr1.get_Type: "+expr1.getTypeName()); } catch(SCStatementException ex) { except=ex; } try { expr2.sc_check(classname, ch, bh, ext, parach, parabh); parserlog.debug("expr1.get_Type: "+expr2.getTypeName()); } //System/.out.println(expr1.get_Type()); //System/.out.println(expr2.get_Type()); catch(SCStatementException ex) { if(except==null) except=ex; else { Vector v; SCExcept hilf; v=ex.get_exlist(); for(Enumeration el=v.elements();el.hasMoreElements();) { hilf=el.nextElement(); except.addException(hilf); } } } //Type type1 = new Type(expr1.getTypeName()); if(!expr1.getTypeName().equals(expr2.getTypeName())) { if(ext) parserlog.error("Typfehler: -->Binary.sc_check() "); SCExcept neu=new SCExcept(); neu.set_error("Typfehler: "+expr1.getTypeName()+" != "+expr2.getTypeName()); neu.set_statement("Binary"); if(except==null) except=new SCStatementException(); except.addException(neu); } else { if(testen instanceof AddOp ||testen instanceof MulOp) this.setType(new Type(expr1.getTypeName(),getOffset())); else this.setType(new Type("boolean",getOffset())); } if(except!=null) throw except; } // ino.end // ino.method.set_Expr1.24988.definition public void set_Expr1(Expr exp) // ino.end // ino.method.set_Expr1.24988.body { this.expr1=exp; } // ino.end // ino.method.set_Expr2.24991.definition public void set_Expr2(Expr exp) // ino.end // ino.method.set_Expr2.24991.body { this.expr2=exp; } // ino.end // ino.method.set_Operator.24994.definition public void set_Operator(Operator Op) // ino.end // ino.method.set_Operator.24994.body { this.op=Op; } // ino.end // ino.method.get_Name.24997.definition public String get_Name() // ino.end // ino.method.get_Name.24997.body { return null; } // ino.end // ino.method.get_Operator.25000.definition public Operator get_Operator() // ino.end // ino.method.get_Operator.25000.body { return op; } // ino.end // ino.method.get_Expr1.25003.definition public Expr get_Expr1() // ino.end // ino.method.get_Expr1.25003.body { return expr1; } // ino.end // ino.method.get_Expr2.25006.definition public Expr get_Expr2() // ino.end // ino.method.get_Expr2.25006.body { return expr2; } // ino.end // ino.method.codegen.25009.definition public void codegen(ClassFile classfile, CodeAttribute code, Vector paralist) throws JVMCodeException // ino.end // ino.method.codegen.25009.body { if(type_check(code)) { op.codegen(classfile, code, this, false, paralist); } else { throw new JVMCodeException("JVMCodeException: Binary: void codegen(ClassFile classfile, Code_attribute code)"); } } // ino.end // ino.method.not_codegen.25012.definition public void not_codegen(ClassFile classfile, CodeAttribute code, Vector paralist) throws JVMCodeException // ino.end // ino.method.not_codegen.25012.body { if(((op instanceof RelOp) || (op instanceof LogOp)) && type_check(code)) { op.codegen(classfile, code, this, true, paralist); } else { throw new JVMCodeException("JVMCodeException: Binary: void not_codegen(ClassFile classfile, Code_attribute code)"); } } // ino.end // ino.method.neg_codegen.25015.definition public void neg_codegen(ClassFile classfile, CodeAttribute code, Vector paralist) throws JVMCodeException // ino.end // ino.method.neg_codegen.25015.body { if(((op instanceof AddOp) || (op instanceof MulOp)) && type_check(code)) { op.codegen(classfile, code, this, true, paralist); } else { throw new JVMCodeException("JVMCodeException: Binary: void neg_codegen(ClassFile classfile, Code_attribute code)"); } } // ino.end // ino.method.type_check.25018.definition public boolean type_check(CodeAttribute code) throws JVMCodeException // ino.end // ino.method.type_check.25018.body { int type1 = JVMCode.get_nType(expr1.getTypeName()); int type2 = JVMCode.get_nType(expr2.getTypeName()); if((type1 < type2) || ((type1==0 || type1==1) && (type2==2 || type2==3))) { return false; } if(type1 != type2) { code.add_code(JVMCode.n2n(expr2.getTypeName(), expr1.getTypeName())); } return true; } // ino.end // ino.method.TRExp.25021.definition public CTripleSet TRExp(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) throws CTypeReconstructionException // ino.end // ino.method.TRExp.25021.body { CTripleSet ret = op.TRExp(this, sigma, V, supportData); //CTripleSet returnSet = super.unifyAndRegisterType(ret, supportData); CTripleSet returnSet = super.registerType(ret, supportData); // //CTripleSet expr2Set = binary.get_Expr2().TRExp(intTriple1.getSubstitutions(), intTriple1.getAssumptionSet(), supportData); // // -------------------------- // // Alle Triple durchgehen: // // -------------------------- // Iterator retIt = ret.getIterator(); // while(retIt.hasNext()){ // CTriple retTriple = (CTriple)retIt.next(); // // -------------------------- // // ReturnType mit type von this (Binary) unifizieren: // // -------------------------- // Vector> unifierPossibilities = Unify.unify(retTriple.getResultType(), this.getType(), supportData.getFiniteClosure()); // // -------------------------- // // Wenn Unifier vorhanden, dann // // anwenden und Triple hinzuf�gen: // // -------------------------- // if(unifierPossibilities.size()!=0){ // // -------------------------- // // Subset bauen: // // -------------------------- // CTripleSet subSet = new CTripleSet(); // // -------------------------- // // Alle m�glichen Unifier anwenden: // // -------------------------- // for(int j=0; j paralist, Vector genericMethodParameters) // ino.end // ino.method.wandleRefTypeAttributes2GenericAttributes.25027.body { } // ino.end public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) { expr1.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); expr2.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); } @Override public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) { ConstraintsSet ret = new ConstraintsSet(); // TODO Implement Method stub return ret; } @Override public JavaCodeResult printJavaCode(ResultSet resultSet) { throw new NotImplementedException(); } } // ino.end