forked from JavaTX/JavaCompilerCore
InstVarDecl gelöscht. Weitere Verbesserungen. Keine Lauffähige Version
This commit is contained in:
parent
605c554ffb
commit
95d7553482
@ -19,7 +19,6 @@ import mycompiler.myclass.ImportDeclarations;
|
|||||||
import mycompiler.myclass.DeclId;
|
import mycompiler.myclass.DeclId;
|
||||||
import mycompiler.myclass.ExceptionList;
|
import mycompiler.myclass.ExceptionList;
|
||||||
import mycompiler.myclass.FormalParameter;
|
import mycompiler.myclass.FormalParameter;
|
||||||
import mycompiler.myclass.InstVarDecl;
|
|
||||||
import mycompiler.myclass.Method;
|
import mycompiler.myclass.Method;
|
||||||
import mycompiler.myclass.ParameterList;
|
import mycompiler.myclass.ParameterList;
|
||||||
import mycompiler.myclass.UsedId;
|
import mycompiler.myclass.UsedId;
|
||||||
@ -219,7 +218,7 @@ public Vector<Pair> testPair = new Vector<Pair>();
|
|||||||
%type <ClassBody> classbodydeclarations
|
%type <ClassBody> classbodydeclarations
|
||||||
%type <Field> classbodydeclaration
|
%type <Field> classbodydeclaration
|
||||||
%type <Field> classmemberdeclaration
|
%type <Field> classmemberdeclaration
|
||||||
%type <InstVarDecl> variabledeclarators
|
%type <FieldDeclaration> variabledeclarators
|
||||||
%type <FieldDeclaration> fielddeclarator;
|
%type <FieldDeclaration> fielddeclarator;
|
||||||
%type <DeclId> variabledeclarator
|
%type <DeclId> variabledeclarator
|
||||||
%type <DeclId> variabledeclaratorid
|
%type <DeclId> variabledeclaratorid
|
||||||
@ -1198,7 +1197,7 @@ type : primitivetype
|
|||||||
}
|
}
|
||||||
variabledeclarators : variabledeclarator
|
variabledeclarators : variabledeclarator
|
||||||
{
|
{
|
||||||
InstVarDecl IVD = new InstVarDecl();
|
FieldDeclaration IVD = new FieldDeclaration();
|
||||||
IVD.getDeclIdVector().addElement( $1 );
|
IVD.getDeclIdVector().addElement( $1 );
|
||||||
$$ = IVD;
|
$$ = IVD;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -20,7 +20,6 @@ import mycompiler.myclass.DeclId;
|
|||||||
import mycompiler.myclass.FieldDecl;
|
import mycompiler.myclass.FieldDecl;
|
||||||
import mycompiler.myclass.FormalParameter;
|
import mycompiler.myclass.FormalParameter;
|
||||||
import mycompiler.myclass.ImportDeclarations;
|
import mycompiler.myclass.ImportDeclarations;
|
||||||
import mycompiler.myclass.InstVarDecl;
|
|
||||||
import mycompiler.myclass.Method;
|
import mycompiler.myclass.Method;
|
||||||
import mycompiler.myclass.ParameterList;
|
import mycompiler.myclass.ParameterList;
|
||||||
import mycompiler.myclass.UsedId;
|
import mycompiler.myclass.UsedId;
|
||||||
|
@ -579,6 +579,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface
|
|||||||
//--
|
//--
|
||||||
assumptions.add(globalAssumptions);
|
assumptions.add(globalAssumptions);
|
||||||
|
|
||||||
|
/*
|
||||||
//Generiere Liste mit Expressions, welche zur Initialisierung von Feldern verwendet werden.
|
//Generiere Liste mit Expressions, welche zur Initialisierung von Feldern verwendet werden.
|
||||||
Vector<Expr> fieldInitializers = new Vector<Expr>();
|
Vector<Expr> fieldInitializers = new Vector<Expr>();
|
||||||
for(FieldDeclaration field : body.getFieldInitializations()){
|
for(FieldDeclaration field : body.getFieldInitializations()){
|
||||||
@ -588,8 +589,14 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface
|
|||||||
fieldAssign.set_Expr(expr1, expr2);
|
fieldAssign.set_Expr(expr1, expr2);
|
||||||
fieldInitializers.add(fieldAssign);
|
fieldInitializers.add(fieldAssign);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
ConstraintsSet oderConstraints = this.TYPE(this.getMethodList(), fieldInitializers, assumptions);
|
//ConstraintsSet oderConstraints = this.TYPE(this.getMethodList(), fieldInitializers, assumptions);
|
||||||
|
|
||||||
|
ConstraintsSet oderConstraints = new ConstraintsSet();
|
||||||
|
for(Field f:this.body.getFields()){
|
||||||
|
oderConstraints.add(f.TYPE(assumptions));
|
||||||
|
}
|
||||||
typinferenzLog.debug("Erstellte Constraints: "+oderConstraints);
|
typinferenzLog.debug("Erstellte Constraints: "+oderConstraints);
|
||||||
|
|
||||||
return oderConstraints;
|
return oderConstraints;
|
||||||
@ -894,6 +901,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface
|
|||||||
Method method=(Method)fieldsAndMethods.get(i);
|
Method method=(Method)fieldsAndMethods.get(i);
|
||||||
method.wandleRefTypeAttributes2GenericAttributes(paralist);
|
method.wandleRefTypeAttributes2GenericAttributes(paralist);
|
||||||
}// Ist es eine InstanzVariable?
|
}// Ist es eine InstanzVariable?
|
||||||
|
/*
|
||||||
else if(fieldsAndMethods.get(i) instanceof InstVarDecl){
|
else if(fieldsAndMethods.get(i) instanceof InstVarDecl){
|
||||||
InstVarDecl instVar=(InstVarDecl)fieldsAndMethods.get(i);
|
InstVarDecl instVar=(InstVarDecl)fieldsAndMethods.get(i);
|
||||||
Type type=instVar.getType();
|
Type type=instVar.getType();
|
||||||
@ -904,7 +912,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface
|
|||||||
instVar.setType(pendant);
|
instVar.setType(pendant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
@ -7,6 +7,7 @@ import mycompiler.mybytecode.ClassFile;
|
|||||||
import mycompiler.myexception.JVMCodeException;
|
import mycompiler.myexception.JVMCodeException;
|
||||||
import mycompiler.mytype.Type;
|
import mycompiler.mytype.Type;
|
||||||
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
|
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
|
||||||
|
import typinferenz.ConstraintsSet;
|
||||||
import typinferenz.JavaCodeResult;
|
import typinferenz.JavaCodeResult;
|
||||||
import typinferenz.ResultSet;
|
import typinferenz.ResultSet;
|
||||||
import typinferenz.Typeable;
|
import typinferenz.Typeable;
|
||||||
@ -20,7 +21,18 @@ public abstract class Field extends SyntaxTreeNode implements TypeInsertable, Ty
|
|||||||
private Type typ;
|
private Type typ;
|
||||||
|
|
||||||
private SyntaxTreeNode parent;
|
private SyntaxTreeNode parent;
|
||||||
|
|
||||||
|
private int offset;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOffset(int offset){
|
||||||
|
this.offset = offset;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int getOffset(){
|
||||||
|
return this.offset;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setType(Type typ) {
|
public void setType(Type typ) {
|
||||||
this.typ = typ;
|
this.typ = typ;
|
||||||
@ -71,5 +83,5 @@ public abstract class Field extends SyntaxTreeNode implements TypeInsertable, Ty
|
|||||||
*/
|
*/
|
||||||
public abstract TypeAssumptions createTypeAssumptions(Class classmember);
|
public abstract TypeAssumptions createTypeAssumptions(Class classmember);
|
||||||
|
|
||||||
|
public abstract ConstraintsSet TYPE(TypeAssumptions publicAssumptions);
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,11 @@ package mycompiler.myclass;
|
|||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import typinferenz.ConstraintsSet;
|
||||||
import typinferenz.JavaCodeResult;
|
import typinferenz.JavaCodeResult;
|
||||||
|
import typinferenz.OderConstraint;
|
||||||
import typinferenz.ResultSet;
|
import typinferenz.ResultSet;
|
||||||
|
import typinferenz.SingleConstraint;
|
||||||
import typinferenz.assumptions.TypeAssumptions;
|
import typinferenz.assumptions.TypeAssumptions;
|
||||||
import mycompiler.SyntaxTreeNode;
|
import mycompiler.SyntaxTreeNode;
|
||||||
import mycompiler.mybytecode.ClassFile;
|
import mycompiler.mybytecode.ClassFile;
|
||||||
@ -52,8 +54,10 @@ public class FieldDeclaration extends Field{
|
|||||||
|
|
||||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||||
JavaCodeResult ret = new JavaCodeResult();
|
JavaCodeResult ret = new JavaCodeResult();
|
||||||
ret.attach(this.getType().printJavaCode(resultSet)).attach( " ").attach( this.getName()+" = ").attach(this.getWert().printJavaCode(resultSet) ).attach( ";");
|
JavaCodeResult toAttach = this.getType().printJavaCode(resultSet).attach(" ").attach( this.getName());
|
||||||
|
if(this.wert!=null)toAttach.attach(" = ").attach(this.getWert().printJavaCode(resultSet) );
|
||||||
|
toAttach.attach( ";");
|
||||||
|
ret.attach(toAttach);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +66,6 @@ public class FieldDeclaration extends Field{
|
|||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//Felder:
|
//Felder:
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
|
|
||||||
TypeAssumptions assumptions = new TypeAssumptions();
|
TypeAssumptions assumptions = new TypeAssumptions();
|
||||||
/*
|
/*
|
||||||
* TODO: Der Feld-Assumption muss ein TPH als Typ hinzugefügt werden, falls er Typlos initialisiert wurde. Dies kann auch der Type-Algorithmus der Inst/FieldVar - Klasse machen.
|
* TODO: Der Feld-Assumption muss ein TPH als Typ hinzugefügt werden, falls er Typlos initialisiert wurde. Dies kann auch der Type-Algorithmus der Inst/FieldVar - Klasse machen.
|
||||||
@ -82,7 +85,7 @@ public class FieldDeclaration extends Field{
|
|||||||
@Override
|
@Override
|
||||||
public Vector<SyntaxTreeNode> getChildren() {
|
public Vector<SyntaxTreeNode> getChildren() {
|
||||||
Vector<SyntaxTreeNode> ret = new Vector<SyntaxTreeNode>();
|
Vector<SyntaxTreeNode> ret = new Vector<SyntaxTreeNode>();
|
||||||
ret.add(this.wert);
|
if(this.wert!=null)ret.add(this.wert);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,6 +99,24 @@ public class FieldDeclaration extends Field{
|
|||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getVariableLength()
|
||||||
|
{
|
||||||
|
return declid.elementAt(0).get_Name().length();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public ConstraintsSet TYPE(TypeAssumptions publicAssumptions) {
|
||||||
|
ConstraintsSet ret = new ConstraintsSet();
|
||||||
|
SingleConstraint c1 = new SingleConstraint(this.getType(), this.getType());
|
||||||
|
ret.add(c1); //Damit die TypVariable des Felds in den Constraints auftaucht
|
||||||
|
|
||||||
|
if(this.wert!=null){
|
||||||
|
//Falls bei der Deklaration ein Wert zugewiesen wird, verhält sich das Constraintserzeugen wie bei dem Assign-Statement:
|
||||||
|
ret.add(this.wert.TYPEExpr(publicAssumptions));
|
||||||
|
ret.add(new SingleConstraint(this.wert.getType(), this.getType()));
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,8 @@ import org.apache.log4j.Logger;
|
|||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||||
import typinferenz.JavaCodeResult;
|
import typinferenz.JavaCodeResult;
|
||||||
import typinferenz.ResultSet;
|
import typinferenz.ResultSet;
|
||||||
import typinferenz.Typeable;
|
import typinferenz.Typeable;
|
||||||
@ -200,5 +202,13 @@ public class FormalParameter implements ITypeReplacementListener, Typeable, Type
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOffset(int offset) {
|
||||||
|
//Das Offset steht in declId
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
@ -1,208 +0,0 @@
|
|||||||
// ino.module.InstVarDecl.8563.package
|
|
||||||
package mycompiler.myclass;
|
|
||||||
// ino.end
|
|
||||||
// ino.module.InstVarDecl.8563.import
|
|
||||||
import java.util.Vector;
|
|
||||||
|
|
||||||
import mycompiler.mybytecode.ClassFile;
|
|
||||||
import mycompiler.MyCompiler;
|
|
||||||
import mycompiler.myexception.JVMCodeException;
|
|
||||||
import mycompiler.mytype.Type;
|
|
||||||
import mycompiler.mytype.TypePlaceholder;
|
|
||||||
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
|
|
||||||
import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener;
|
|
||||||
import mycompiler.mytypereconstruction.set.CTypeAssumptionSet;
|
|
||||||
import mycompiler.mytypereconstruction.typeassumption.CInstVarTypeAssumption;
|
|
||||||
import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
|
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
|
||||||
import typinferenz.JavaCodeResult;
|
|
||||||
import typinferenz.ResultSet;
|
|
||||||
import typinferenz.assumptions.TypeAssumptions;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ino.class.InstVarDecl.23441.declaration
|
|
||||||
public class InstVarDecl extends FieldDecl implements ITypeReplacementListener
|
|
||||||
// ino.end
|
|
||||||
// ino.class.InstVarDecl.23441.body
|
|
||||||
{
|
|
||||||
// ino.attribute.type.23446.declaration
|
|
||||||
protected Type type;
|
|
||||||
// ino.end
|
|
||||||
// ino.attribute.inferencelog.23449.declaration
|
|
||||||
protected static Logger inferencelog = Logger.getLogger("inference");
|
|
||||||
// ino.end
|
|
||||||
// ino.attribute.parserlog.23452.declaration
|
|
||||||
protected static Logger parserlog = Logger.getLogger("parser");
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
|
|
||||||
// ino.method.setType.23455.defdescription type=javadoc
|
|
||||||
/**
|
|
||||||
* <br/>Author: J<EFBFBD>rg B<EFBFBD>uerle
|
|
||||||
* @param t
|
|
||||||
*/
|
|
||||||
// ino.end
|
|
||||||
// ino.method.setType.23455.definition
|
|
||||||
public void setType(Type t)
|
|
||||||
// ino.end
|
|
||||||
// ino.method.setType.23455.body
|
|
||||||
{
|
|
||||||
if(this.type instanceof TypePlaceholder){
|
|
||||||
((TypePlaceholder)this.type).removeReplacementListener(this);
|
|
||||||
}
|
|
||||||
if(t instanceof TypePlaceholder){
|
|
||||||
((TypePlaceholder)t).addReplacementListener(this);
|
|
||||||
}
|
|
||||||
this.type = t;
|
|
||||||
parserlog.debug("T->InstVarDecl->set_Type->type.get_Type: " + t.getName());
|
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
// ino.method.getType.23458.definition
|
|
||||||
public Type getType()
|
|
||||||
// ino.end
|
|
||||||
// ino.method.getType.23458.body
|
|
||||||
{
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
// ino.method.getTypeName.23461.definition
|
|
||||||
public String getTypeName()
|
|
||||||
// ino.end
|
|
||||||
// ino.method.getTypeName.23461.body
|
|
||||||
{
|
|
||||||
if(this.getType()==null)return "null";
|
|
||||||
return this.getType().getName();
|
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ino.method.codegen.23464.definition
|
|
||||||
public void codegen(ClassFile classfile, Vector paralist)
|
|
||||||
throws JVMCodeException
|
|
||||||
// ino.end
|
|
||||||
// ino.method.codegen.23464.body
|
|
||||||
{
|
|
||||||
if(declid != null)
|
|
||||||
{
|
|
||||||
for(int i = 0; i < declid.size(); i++)
|
|
||||||
{
|
|
||||||
declid.elementAt(i).codegen_InstVarDecl(classfile, this.getType(), paralist);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
// ino.method.getLineNumber.23467.definition
|
|
||||||
public int getLineNumber()
|
|
||||||
// ino.end
|
|
||||||
// ino.method.getLineNumber.23467.body
|
|
||||||
{
|
|
||||||
if(declid.size()<=0)
|
|
||||||
return MyCompiler.NO_LINENUMBER;
|
|
||||||
else{
|
|
||||||
return declid.elementAt(0).getLineNumber();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
// ino.method.getOffset.23470.defdescription type=line
|
|
||||||
// hinzugef<EFBFBD>gt: hoth 09.04.2006
|
|
||||||
// ino.end
|
|
||||||
// ino.method.getOffset.23470.definition
|
|
||||||
public int getOffset()
|
|
||||||
// ino.end
|
|
||||||
// ino.method.getOffset.23470.body
|
|
||||||
{
|
|
||||||
if(declid.size()<=0)
|
|
||||||
return MyCompiler.NO_LINENUMBER;
|
|
||||||
else{
|
|
||||||
return declid.elementAt(0).getOffset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
// ino.method.getVariableLength.23473.definition
|
|
||||||
public int getVariableLength()
|
|
||||||
// ino.end
|
|
||||||
// ino.method.getVariableLength.23473.body
|
|
||||||
{
|
|
||||||
return declid.elementAt(0).get_Name().length();
|
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
// ino.method.replaceType.23476.defdescription type=javadoc
|
|
||||||
/**
|
|
||||||
* <br>Author: J<EFBFBD>rg B<EFBFBD>uerle
|
|
||||||
* @param e
|
|
||||||
*/
|
|
||||||
// ino.end
|
|
||||||
// ino.method.replaceType.23476.definition
|
|
||||||
public void replaceType(CReplaceTypeEvent e)
|
|
||||||
// ino.end
|
|
||||||
// ino.method.replaceType.23476.body
|
|
||||||
{
|
|
||||||
inferencelog.debug("Ersetze Typ in InstVarDecl \""+this.get_Name()+"\"");
|
|
||||||
if(type instanceof TypePlaceholder){
|
|
||||||
((TypePlaceholder)type).removeReplacementListener(this);
|
|
||||||
}
|
|
||||||
this.setType(e.getNewType());
|
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
// ino.method.getTypeLineNumber.23479.defdescription type=javadoc
|
|
||||||
/**
|
|
||||||
* <br>Author: J<EFBFBD>rg B<EFBFBD>uerle
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
// ino.end
|
|
||||||
// ino.method.getTypeLineNumber.23479.definition
|
|
||||||
public int getTypeLineNumber()
|
|
||||||
// ino.end
|
|
||||||
// ino.method.getTypeLineNumber.23479.body
|
|
||||||
{
|
|
||||||
return this.getLineNumber();
|
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return this.type + " " + super.getDeclIdVector().firstElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
|
|
||||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
|
||||||
JavaCodeResult ret = new JavaCodeResult();
|
|
||||||
ret.attach( this.getType().printJavaCode(resultSet)).attach( " " ).attach( super.getDeclIdVector().firstElement() + ";");
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TypeAssumptions createTypeAssumptions(Class classmember) {
|
|
||||||
TypeAssumptions assumptions = new TypeAssumptions();
|
|
||||||
//////////////////////////////
|
|
||||||
//Alle Variablendeklarationen (int a, b, c) durchgehen:
|
|
||||||
//////////////////////////////
|
|
||||||
for(int i=0; i<this.getDeclIdVector().size(); i++){
|
|
||||||
DeclId id = (DeclId)this.getDeclIdVector().elementAt(i);
|
|
||||||
if(this.getType()==null)this.setType(TypePlaceholder.fresh(this));
|
|
||||||
CInstVarTypeAssumption assum = new CInstVarTypeAssumption(classmember.getName(), id.get_Name(), this.getType(), this.getLineNumber(),this.getOffset(),new Vector<Integer>()); // Typannahme bauen...
|
|
||||||
assumptions.add(assum);
|
|
||||||
}
|
|
||||||
return assumptions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ino.end
|
|
File diff suppressed because it is too large
Load Diff
@ -19,7 +19,6 @@ import mycompiler.myclass.ImportDeclarations;
|
|||||||
import mycompiler.myclass.DeclId;
|
import mycompiler.myclass.DeclId;
|
||||||
import mycompiler.myclass.ExceptionList;
|
import mycompiler.myclass.ExceptionList;
|
||||||
import mycompiler.myclass.FormalParameter;
|
import mycompiler.myclass.FormalParameter;
|
||||||
import mycompiler.myclass.InstVarDecl;
|
|
||||||
import mycompiler.myclass.Method;
|
import mycompiler.myclass.Method;
|
||||||
import mycompiler.myclass.ParameterList;
|
import mycompiler.myclass.ParameterList;
|
||||||
import mycompiler.myclass.UsedId;
|
import mycompiler.myclass.UsedId;
|
||||||
@ -219,7 +218,7 @@ public Vector<Pair> testPair = new Vector<Pair>();
|
|||||||
%type <ClassBody> classbodydeclarations
|
%type <ClassBody> classbodydeclarations
|
||||||
%type <Field> classbodydeclaration
|
%type <Field> classbodydeclaration
|
||||||
%type <Field> classmemberdeclaration
|
%type <Field> classmemberdeclaration
|
||||||
%type <InstVarDecl> variabledeclarators
|
%type <FieldDeclaration> variabledeclarators
|
||||||
%type <FieldDeclaration> fielddeclarator;
|
%type <FieldDeclaration> fielddeclarator;
|
||||||
%type <DeclId> variabledeclarator
|
%type <DeclId> variabledeclarator
|
||||||
%type <DeclId> variabledeclaratorid
|
%type <DeclId> variabledeclaratorid
|
||||||
@ -1198,7 +1197,7 @@ type : primitivetype
|
|||||||
}
|
}
|
||||||
variabledeclarators : variabledeclarator
|
variabledeclarators : variabledeclarator
|
||||||
{
|
{
|
||||||
InstVarDecl IVD = new InstVarDecl();
|
FieldDeclaration IVD = new FieldDeclaration();
|
||||||
IVD.getDeclIdVector().addElement( $1 );
|
IVD.getDeclIdVector().addElement( $1 );
|
||||||
$$ = IVD;
|
$$ = IVD;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ public class Assign extends Expr
|
|||||||
ret.add(expr2.TYPEExpr(assumptions));
|
ret.add(expr2.TYPEExpr(assumptions));
|
||||||
//this.setTypeVariable( TypePlaceholder.fresh(this));
|
//this.setTypeVariable( TypePlaceholder.fresh(this));
|
||||||
this.setType(TypePlaceholder.fresh(this));
|
this.setType(TypePlaceholder.fresh(this));
|
||||||
ret.add(new SingleConstraint(expr2.getType(), expr1.getType())); //expr1.type < expr2.type
|
ret.add(new SingleConstraint(expr2.getType(), expr1.getType())); //expr2.type <. expr1.type
|
||||||
ret.add(new SingleConstraint(expr1.getType(), this.getType()));
|
ret.add(new SingleConstraint(expr1.getType(), this.getType()));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ public class LambdaTest {
|
|||||||
//String[] arguments = new String[1];
|
//String[] arguments = new String[1];
|
||||||
//arguments[0]="/home/janulrich/workspace/JavaCompilerCore/test/LampdaExpressions/general.java";
|
//arguments[0]="/home/janulrich/workspace/JavaCompilerCore/test/LampdaExpressions/general.java";
|
||||||
//MyCompiler.main(arguments);
|
//MyCompiler.main(arguments);
|
||||||
Vector<TypeinferenceResultSet> resultSet = null;
|
Vector<TypeinferenceResultSet> resultSet = new Vector<TypeinferenceResultSet>();
|
||||||
|
|
||||||
MyCompilerAPI compiler = MyCompiler.getAPI();
|
MyCompilerAPI compiler = MyCompiler.getAPI();
|
||||||
try{
|
try{
|
||||||
|
@ -180,7 +180,7 @@ public class RefType extends Type implements IMatchable
|
|||||||
{
|
{
|
||||||
if (parameter.elementAt(i) instanceof GenericTypeVar)
|
if (parameter.elementAt(i) instanceof GenericTypeVar)
|
||||||
{
|
{
|
||||||
TypePlaceholder tlv = TypePlaceholder.fresh(); //TODO: Hier wird ein TypePlaceholder ohne ITypeReplacementListener erstellt. Kann Probleme verursachen
|
TypePlaceholder tlv = TypePlaceholder.fresh();
|
||||||
sub.addElement(new CSubstitutionGenVar((GenericTypeVar)parameter.elementAt(i), tlv));
|
sub.addElement(new CSubstitutionGenVar((GenericTypeVar)parameter.elementAt(i), tlv));
|
||||||
parameter.set(i, tlv);
|
parameter.set(i, tlv);
|
||||||
}
|
}
|
||||||
|
@ -3,5 +3,8 @@ package typinferenz;
|
|||||||
import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener;
|
import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener;
|
||||||
|
|
||||||
public interface TypeInsertable extends ITypeReplacementListener {
|
public interface TypeInsertable extends ITypeReplacementListener {
|
||||||
|
|
||||||
|
public int getOffset();
|
||||||
|
public void setOffset(int offset);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
Class DEBUG [Typeinference] Erstellte Assumptions: Set {
|
||||||
|
varString: TPH A,
|
||||||
|
methode: NOPARAS --> void,
|
||||||
|
var: TPH B,
|
||||||
|
<init>: NOPARAS --> BasicAssumptionsTest
|
||||||
|
}
|
||||||
|
Block DEBUG [Typeinference] Prozessing statement: (var = int 1)
|
||||||
|
Block DEBUG [Typeinference] Prozessing statement: (varString = null (varString.toString( [ ])))
|
Loading…
Reference in New Issue
Block a user