// ino.module.Operator.8607.package package de.dhbwstuttgart.syntaxtree.operator; // ino.end // ino.module.Operator.8607.import import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; import de.dhbwstuttgart.core.IItemWithOffset; import de.dhbwstuttgart.syntaxtree.statement.Binary; import de.dhbwstuttgart.syntaxtree.statement.Expr; import de.dhbwstuttgart.syntaxtree.type.Pair; import de.dhbwstuttgart.syntaxtree.type.RefType; import de.dhbwstuttgart.syntaxtree.type.Type; import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.OderConstraint; import de.dhbwstuttgart.typeinference.SingleConstraint; import de.dhbwstuttgart.typeinference.UndConstraint; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; import mycompiler.mybytecode.ClassFile; import mycompiler.mybytecode.CodeAttribute; import mycompiler.mybytecode.JVMCode; import mycompiler.myexception.CTypeReconstructionException; import mycompiler.myexception.JVMCodeException; import mycompiler.mytypereconstruction.CSupportData; import mycompiler.mytypereconstruction.CTriple; import mycompiler.mytypereconstruction.set.CSubstitutionSet; import mycompiler.mytypereconstruction.set.CTripleSet; import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; import mycompiler.mytypereconstruction.unify.Unify; // ino.end // ino.class.Operator.24257.declaration public abstract class Operator implements IItemWithOffset // ino.end // ino.class.Operator.24257.body { // ino.attribute.offset.24261.declaration private int offset; // ino.end // ino.attribute.variableLength.24264.declaration private int variableLength; // ino.end // ino.method.Operator.24267.definition public Operator(int offset,int variableLength) // ino.end // ino.method.Operator.24267.body { this.offset=offset; this.variableLength=variableLength; } // ino.end // ino.method.getOffset.24270.definition public int getOffset() // ino.end // ino.method.getOffset.24270.body { return offset; } // ino.end // ino.method.getVariableLength.24273.definition public int getVariableLength() // ino.end // ino.method.getVariableLength.24273.body { return variableLength; } // ino.end // ino.method.codegen.24276.declaration public abstract void codegen(ClassFile classfile, CodeAttribute code, Expr expr, boolean neg_not, Vector paralist) throws JVMCodeException; // ino.end /** * @author timo * This is cool: * we call the abstract parent to it him what operator-types he expects. the rest of the algorithm * is implemented in this class because it's always the same... * @see Design Pattern: Template Method */ protected abstract Hashtable getOperatorTypes( ); // ino.method.makePrimitive.29391.defdescription type=line // Unter der Annahme, dass sich ein Integer-Objekt auf dem Stack // befindet, wird dieses in den primitiven Typ int umgewandelt. // ino.end // ino.method.makePrimitive.29391.definition public void makePrimitive(ClassFile classfile, CodeAttribute code) // ino.end // ino.method.makePrimitive.29391.body { code.add_code(JVMCode.invokevirtual); code.add_code_short(classfile.add_method_ref("java/lang/Integer", "intValue", "()I")); } // ino.end // ino.method.makeWrapper.29394.defdescription type=line // Unter der Annahame, dass ein primitiver int-Typ auf dem Stack liegt, // wird dieser in den Wrapper-Typ Integer umgewandelt. // ino.end // ino.method.makeWrapper.29394.definition public void makeWrapper(ClassFile classfile, CodeAttribute code) // ino.end // ino.method.makeWrapper.29394.body { code.add_code(JVMCode.invokestatic); code.add_code_short(classfile.add_method_ref("java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;")); } // ino.end /** * Liefert eine HashMap der Form: HashMap * @param ass * @return */ public abstract HashMap getReturnTypes(TypeAssumptions ass); } // ino.end