GenericTypeVar setParentClass entfernt

This commit is contained in:
JanUlrich 2014-09-10 23:32:36 +02:00
parent 45ea59e7ad
commit ca8145e4a2
8 changed files with 25 additions and 28 deletions

13
bin/.gitignore vendored
View File

@ -1,6 +1,7 @@
/de
/plugindevelopment
/mycompiler
/mytypereconstruction
/syntaxTree
/userinterface
/bytecode/
/de/
/log4jTesting.xml
/mycompiler/
/parser/
/plugindevelopment/
/syntaxTree/

View File

@ -1134,10 +1134,11 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
if(t instanceof GenericTypeVar)this.genericClassParameters.add((GenericTypeVar)t);
else this.genericClassParameters.add(new GenericTypeVar(t.get_Name(),this,-1));
}
/*
for(GenericTypeVar gtv : this.getGenericParameter()){
gtv.setParentClass(this);;
}
*/
//TODO: Umwandlung zu RefTypes funktioniert noch nicht richtig. (siehe LambdaTest2)
//Als RefType geparste Generische Variablen umwandeln:
this.wandleRefTypeAttributes2GenericAttributes();
@ -1153,8 +1154,8 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
Vector<SyntaxTreeNode> ret = new Vector<SyntaxTreeNode>();
for(Field f : this.getFields()){
ret.add(f);
ret.addAll(this.getGenericParameter());
}
ret.addAll(this.getGenericParameter());
return ret;
}

View File

@ -158,6 +158,7 @@ public abstract class Field extends SyntaxTreeNode implements TypeInsertable, Ty
public Vector<SyntaxTreeNode> getChildren() {
Vector<SyntaxTreeNode> ret = new Vector<>();
if(this.getType()!=null)ret.add(this.getType());
ret.addAll(this.getGenericParameter());
return ret;
}

View File

@ -101,7 +101,6 @@ public class FieldDeclaration extends Field{
public void parserPostProcessing(SyntaxTreeNode parent){
super.parserPostProcessing(parent);
if(this.getType() == null)this.setType(TypePlaceholder.fresh(this));
}
@Override

View File

@ -7,6 +7,7 @@ package de.dhbwstuttgart.syntaxtree.type;
import java.util.Vector;
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.typeinference.ConstraintType;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.SingleConstraint;
@ -55,7 +56,7 @@ public class BoundedGenericTypeVar extends GenericTypeVar
*/
// ino.method.BoundedGenericTypeVar.29409.definition
public BoundedGenericTypeVar(String s, Vector<Type> bounds, Class parentClass, int offset, int endOffset)
public BoundedGenericTypeVar(String s, Vector<Type> bounds, SyntaxTreeNode parentClass, int offset, int endOffset)
// ino.end
// ino.method.BoundedGenericTypeVar.29409.body
{
@ -147,5 +148,12 @@ public class BoundedGenericTypeVar extends GenericTypeVar
}
// ino.end
@Override
public Vector<SyntaxTreeNode> getChildren() {
Vector<SyntaxTreeNode> ret = super.getChildren();
ret.addAll(this.bounds);
return ret;
}
}
// ino.end

View File

@ -36,7 +36,6 @@ public class GenericTypeVar extends Type
//Type genericTypeVar;
//Vector<Type> extendVars = new Vector<Type>();
protected Pair genericConstraint;
private Class parent;
/**
* Eine Registry f<EFBFBD>r alle Generic-Instanzen, die vor der Bytecode-Generierung durch
* Ihre Superklasse ersetzt werden m<EFBFBD>ssen. Siehe "Type Erasure" in Sun Spezifikation.
@ -63,7 +62,7 @@ public class GenericTypeVar extends Type
*/
// ino.method.GenericTypeVar.26509.definition
public GenericTypeVar(String s, Class parentClass, int offset)
public GenericTypeVar(String s, SyntaxTreeNode parentClass, int offset)
// ino.end
// ino.method.GenericTypeVar.26509.body
{
@ -218,18 +217,6 @@ public class GenericTypeVar extends Type
public int getEndOffset() {
return this.getOffset() + this.name.toString().length();
}
public void setParentClass(Class parent){
//TODO: Die Methode sollte mit neuem Parser raus und dafür nur noch im Konstruktor gesetzt werden.
this.parent = parent;
}
public Class getParentClass() {
if(this.parent == null)
throw new DebugException("GenericTypeVar ohne Elternelement");
return this.parent;
}
}
// ino.end

View File

@ -36,17 +36,17 @@ public class Type extends SyntaxTreeNode implements IItemWithOffset
// ino.end
// ino.method.Type.26729.definition
public Type(String s, int offset)
public Type(String s, SyntaxTreeNode parent, int offset)
// ino.end
// ino.method.Type.26729.body
{
this(offset);
this(parent, offset);
this.name = new JavaClassName(s);
}
// ino.end
// ino.method.Type.26732.definition
public Type(int offset)
public Type(SyntaxTreeNode parent,int offset)
// ino.end
// ino.method.Type.26732.body
{