2013-10-18 11:33:46 +00:00
|
|
|
|
// ino.module.Statement.8652.package
|
|
|
|
|
package mycompiler.mystatement;
|
|
|
|
|
// ino.end
|
|
|
|
|
// ino.module.Statement.8652.import
|
|
|
|
|
import java.util.Enumeration;
|
|
|
|
|
import java.util.Hashtable;
|
|
|
|
|
import java.util.Vector;
|
|
|
|
|
|
|
|
|
|
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
|
|
|
|
import typinferenz.ConstraintsSet;
|
|
|
|
|
import typinferenz.JavaCodeResult;
|
|
|
|
|
import typinferenz.ResultSet;
|
2014-02-11 15:30:38 +00:00
|
|
|
|
import typinferenz.Typeable;
|
2014-02-09 15:07:31 +00:00
|
|
|
|
import typinferenz.assumptions.TypeAssumptions;
|
2013-10-18 11:33:46 +00:00
|
|
|
|
import mycompiler.IItemWithOffset;
|
2014-02-11 15:30:38 +00:00
|
|
|
|
import mycompiler.SyntaxTreeNode;
|
2013-10-18 11:33:46 +00:00
|
|
|
|
import mycompiler.mybytecode.ClassFile;
|
|
|
|
|
import mycompiler.mybytecode.CodeAttribute;
|
|
|
|
|
import mycompiler.myclass.Class;
|
|
|
|
|
import mycompiler.myexception.CTypeReconstructionException;
|
|
|
|
|
import mycompiler.myexception.JVMCodeException;
|
|
|
|
|
import mycompiler.myexception.SCStatementException;
|
|
|
|
|
import mycompiler.mytype.GenericTypeVar;
|
|
|
|
|
import mycompiler.mytype.Pair;
|
|
|
|
|
import mycompiler.mytype.Type;
|
|
|
|
|
import mycompiler.mytype.TypePlaceholder;
|
|
|
|
|
import mycompiler.mytypereconstruction.CSupportData;
|
|
|
|
|
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
|
|
|
|
|
import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener;
|
|
|
|
|
import mycompiler.mytypereconstruction.set.CSubstitutionSet;
|
|
|
|
|
import mycompiler.mytypereconstruction.set.CTripleSet;
|
|
|
|
|
import mycompiler.mytypereconstruction.set.CTypeAssumptionSet;
|
|
|
|
|
import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption;
|
|
|
|
|
// ino.end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ino.class.Statement.26184.declaration
|
2014-02-12 01:12:12 +00:00
|
|
|
|
public abstract class Statement extends SyntaxTreeNode implements IItemWithOffset, Typeable, ITypeReplacementListener
|
2013-10-18 11:33:46 +00:00
|
|
|
|
// ino.end
|
|
|
|
|
// ino.class.Statement.26184.body
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// ino.attribute.offset.26188.declaration
|
|
|
|
|
private int offset;
|
|
|
|
|
// ino.end
|
|
|
|
|
// ino.attribute.variableLength.26191.declaration
|
|
|
|
|
private int variableLength;
|
|
|
|
|
// ino.end
|
|
|
|
|
|
|
|
|
|
protected Type type;
|
2014-02-12 01:12:12 +00:00
|
|
|
|
private SyntaxTreeNode parent;
|
2013-10-18 11:33:46 +00:00
|
|
|
|
|
|
|
|
|
// ino.method.Statement.26194.definition
|
|
|
|
|
public Statement(int offset, int variableLength)
|
|
|
|
|
// ino.end
|
|
|
|
|
// ino.method.Statement.26194.body
|
|
|
|
|
{
|
|
|
|
|
this.offset=offset;
|
|
|
|
|
this.variableLength=variableLength;
|
|
|
|
|
}
|
|
|
|
|
// ino.end
|
|
|
|
|
|
|
|
|
|
// ino.method.getOffset.26197.definition
|
|
|
|
|
public int getOffset()
|
|
|
|
|
// ino.end
|
|
|
|
|
// ino.method.getOffset.26197.body
|
|
|
|
|
{
|
|
|
|
|
return offset;
|
|
|
|
|
}
|
|
|
|
|
// ino.end
|
|
|
|
|
|
|
|
|
|
// ino.method.getVariableLength.26200.definition
|
|
|
|
|
public int getVariableLength()
|
|
|
|
|
// ino.end
|
|
|
|
|
// ino.method.getVariableLength.26200.body
|
|
|
|
|
{
|
|
|
|
|
return variableLength;
|
|
|
|
|
}
|
|
|
|
|
// ino.end
|
|
|
|
|
|
|
|
|
|
// ino.method.codegen.26206.declaration
|
|
|
|
|
public abstract void codegen(ClassFile classfile, CodeAttribute code, Vector paralist)
|
|
|
|
|
throws JVMCodeException;
|
|
|
|
|
// ino.end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ino.method.wandleRefTypeAttributes2GenericAttributes.26224.declaration
|
|
|
|
|
public abstract void wandleRefTypeAttributes2GenericAttributes(Vector<Type> paralist, Vector<GenericTypeVar> genericMethodParameters);
|
|
|
|
|
// ino.end
|
|
|
|
|
|
|
|
|
|
public abstract boolean addOffsetsToStatement(CTypeAssumption localAssumption, String NameVariable, boolean isMemberVariable);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author AI10023 - Andreas Stadelmeier
|
|
|
|
|
* Implementierung des Java 8 - Typinferenzalgorithmus von Martin Pl<EFBFBD>micke
|
|
|
|
|
* Jedes Statement wird im Zuge des Algorithmus durch die TYPEExpr-Funktion angesprochen.
|
|
|
|
|
*/
|
|
|
|
|
public abstract ConstraintsSet TYPEStmt(TypeAssumptions assumptions);
|
|
|
|
|
|
2014-02-11 15:30:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Type getType(){
|
2013-10-18 11:33:46 +00:00
|
|
|
|
return type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author Andreas Stadelmeier, a10023
|
|
|
|
|
* Sollte von jedem Statement <EFBFBD>berschrieben werden.
|
|
|
|
|
* Liefert Informationen zum Statment und dessen Typ.
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public String getTypeInformation(){
|
|
|
|
|
return this.printJavaCode(new ResultSet(new Vector<Pair>()))+" : "+type.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2014-02-11 15:30:38 +00:00
|
|
|
|
* @author AI10023 - Andreas Stadelmeier
|
|
|
|
|
* Jedem Statement und jeder Expression wird im Zuge des Typinferenzalgorithmus eine Typvariable zugewiesen.
|
|
|
|
|
* Daher m<EFBFBD>ssen alle Statements und Expressions die Methoden setTypeVariable und getTypeVariable implementieren.
|
2013-10-18 11:33:46 +00:00
|
|
|
|
*/
|
|
|
|
|
public void setType(Type t)
|
|
|
|
|
{
|
2014-02-11 15:30:38 +00:00
|
|
|
|
if(this.getType() instanceof TypePlaceholder){
|
|
|
|
|
((TypePlaceholder)this.getType()).removeReplacementListener(this);
|
2013-10-18 11:33:46 +00:00
|
|
|
|
}
|
|
|
|
|
if(t instanceof TypePlaceholder){
|
|
|
|
|
((TypePlaceholder)t).addReplacementListener(this);
|
|
|
|
|
}
|
|
|
|
|
this.type=t;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void replaceType(CReplaceTypeEvent e)
|
|
|
|
|
{
|
2014-02-11 15:30:38 +00:00
|
|
|
|
if(getType() instanceof TypePlaceholder){
|
|
|
|
|
((TypePlaceholder)getType()).removeReplacementListener(this);
|
2013-10-18 11:33:46 +00:00
|
|
|
|
}
|
|
|
|
|
this.setType(e.getNewType());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public abstract JavaCodeResult printJavaCode(ResultSet resultSet);
|
|
|
|
|
|
2014-02-12 01:12:12 +00:00
|
|
|
|
|
2013-10-18 11:33:46 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// ino.end
|