Aufräumen
This commit is contained in:
parent
a35bcd490b
commit
e84d6373c7
@ -4,7 +4,7 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import de.dhbwstuttgart.typeinference.Menge;
|
import de.dhbwstuttgart.typeinference.*;
|
||||||
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@ -18,16 +18,10 @@ import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
|||||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.Void;
|
import de.dhbwstuttgart.syntaxtree.type.Void;
|
||||||
import de.dhbwstuttgart.typeinference.ByteCodeResult;
|
|
||||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
|
||||||
import de.dhbwstuttgart.typeinference.Pair;
|
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
|
||||||
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
|
|
||||||
import de.dhbwstuttgart.typeinference.TypeinferenceResults;
|
|
||||||
import de.dhbwstuttgart.typeinference.UnifyConstraintsSet;
|
|
||||||
import de.dhbwstuttgart.typeinference.assumptions.ClassAssumption;
|
import de.dhbwstuttgart.typeinference.assumptions.ClassAssumption;
|
||||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||||
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
|
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
|
||||||
|
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
|
||||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||||
import de.dhbwstuttgart.typeinference.unify.TypeUnify;
|
import de.dhbwstuttgart.typeinference.unify.TypeUnify;
|
||||||
import de.dhbwstuttgart.typeinference.unify.Unifikationsalgorithmus;
|
import de.dhbwstuttgart.typeinference.unify.Unifikationsalgorithmus;
|
||||||
@ -512,6 +506,11 @@ public class SourceFile extends SyntaxTreeNode
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getVariableLength() {
|
public int getVariableLength() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
@ -14,7 +14,6 @@ import de.dhbwstuttgart.syntaxtree.modifier.Public;
|
|||||||
import de.dhbwstuttgart.syntaxtree.statement.Block;
|
import de.dhbwstuttgart.syntaxtree.statement.Block;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.Statement;
|
import de.dhbwstuttgart.syntaxtree.statement.Statement;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.SuperCall;
|
import de.dhbwstuttgart.syntaxtree.statement.SuperCall;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
|
||||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||||
import de.dhbwstuttgart.typeinference.Menge;
|
import de.dhbwstuttgart.typeinference.Menge;
|
||||||
|
|
||||||
|
@ -79,13 +79,13 @@ public class RefType extends SyntaxTreeNode
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(parameter==null || parameter.size()==0){
|
if(parameter==null || parameter.size()==0){
|
||||||
ret &= (((RefType)obj).get_ParaList()==null || ((RefType)obj).get_ParaList().size()==0);
|
ret &= (((RefType)obj).getParaList()==null || ((RefType)obj).getParaList().size()==0);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(((RefType)obj).get_ParaList()==null){
|
if(((RefType)obj).getParaList()==null){
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
else if(parameter.size() != ((RefType)obj).get_ParaList().size())
|
else if(parameter.size() != ((RefType)obj).getParaList().size())
|
||||||
{
|
{
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ public class RefType extends SyntaxTreeNode
|
|||||||
{
|
{
|
||||||
for(int i = 0; i<parameter.size(); i++)
|
for(int i = 0; i<parameter.size(); i++)
|
||||||
{
|
{
|
||||||
ret &= parameter.get(i).equals(((RefType)obj).get_ParaList().get(i));
|
ret &= parameter.get(i).equals(((RefType)obj).getParaList().get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,22 +106,20 @@ public class RefType extends SyntaxTreeNode
|
|||||||
|
|
||||||
public RefType clone()
|
public RefType clone()
|
||||||
{
|
{
|
||||||
if(this.get_ParaList() != null )
|
if(this.getParaList() != null )
|
||||||
{
|
{
|
||||||
List para = this.get_ParaList();
|
List para = this.getParaList();
|
||||||
Menge<Type> clonepara = new Menge<Type>();
|
List<RefType> clonepara = new ArrayList<>();
|
||||||
for(int i = 0; i< para.size(); i++)
|
for(int i = 0; i< para.size(); i++)
|
||||||
{
|
{
|
||||||
clonepara.addElement(((Type)para.get(i)).clone());
|
clonepara.add(((RefType)para.get(i)).clone());
|
||||||
}
|
}
|
||||||
RefType newRefType=new RefType(this.getTypeName(), clonepara,this.getParent(),getOffset());
|
RefType newRefType=new RefType(this.getName(), clonepara, getOffset());
|
||||||
newRefType.setPrimitiveFlag(this.getPrimitiveFlag());
|
|
||||||
newRefType.IsArray = this.IsArray;
|
newRefType.IsArray = this.IsArray;
|
||||||
return newRefType;
|
return newRefType;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
RefType newRefType = new RefType(this.getTypeName(),getOffset());
|
RefType newRefType = new RefType(this.getName(),getOffset());
|
||||||
newRefType.setPrimitiveFlag(this.getPrimitiveFlag());
|
|
||||||
newRefType.IsArray = this.IsArray;
|
newRefType.IsArray = this.IsArray;
|
||||||
return newRefType;
|
return newRefType;
|
||||||
}
|
}
|
||||||
@ -169,31 +167,31 @@ public class RefType extends SyntaxTreeNode
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Menge<TypePlaceholder> getUnresolvedTPH(ResultSet resultSet) {
|
public List<TypePlaceholder> getUnresolvedTPH(ResultSet resultSet) {
|
||||||
Menge<TypePlaceholder> ret = super.getUnresolvedTPH(resultSet);
|
List<TypePlaceholder> ret = new ArrayList<>(); //super.getUnresolvedTPH(resultSet);
|
||||||
ret.addAll(this.printJavaCode(resultSet).getUnresolvedTPH());
|
ret.addAll(this.printJavaCode(resultSet).getUnresolvedTPH());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TypePlaceholder> getInvolvedTypePlaceholder() {
|
public List<TypePlaceholder> getInvolvedTypePlaceholder() {
|
||||||
Menge<TypePlaceholder> ret = super.getInvolvedTypePlaceholder();
|
List<TypePlaceholder> ret = new ArrayList<>(); //super.getInvolvedTypePlaceholder();
|
||||||
if(this.parameter == null)return ret;
|
if(this.parameter == null)return ret;
|
||||||
for(Type param : this.parameter){
|
for(RefType param : this.parameter){
|
||||||
ret.addAll(param.getInvolvedTypePlaceholder());
|
ret.addAll(param.getInvolvedTypePlaceholder());
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Menge<SyntaxTreeNode> getChildren() {
|
public List<SyntaxTreeNode> getChildren() {
|
||||||
Menge<SyntaxTreeNode> ret = super.getChildren();
|
List<SyntaxTreeNode> ret = new ArrayList<>(); //super.getChildren();
|
||||||
ret.addAll(this.getParaList());
|
ret.addAll(this.getParaList());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public org.apache.bcel.generic.Type getBytecodeType(ClassGenerator cg, TypeinferenceResultSet rs) {
|
public org.apache.bcel.generic.Type getBytecodeType(ClassGenerator cg, TypeinferenceResultSet rs) {
|
||||||
org.apache.bcel.generic.ObjectType ret = new org.apache.bcel.generic.ObjectType(getCombinedType(cg, rs));
|
org.apache.bcel.generic.ObjectType ret = new org.apache.bcel.generic.ObjectType(getCombinedType(cg, rs));
|
||||||
if(this.IsArray()){
|
if(this.IsArray){
|
||||||
//Hier wird einfachhalber von einer Dimension ausgegangen. Arrays sind im Bytecode nur für main-Methode relevant
|
//Hier wird einfachhalber von einer Dimension ausgegangen. Arrays sind im Bytecode nur für main-Methode relevant
|
||||||
return new org.apache.bcel.generic.ArrayType(ret, 1);
|
return new org.apache.bcel.generic.ArrayType(ret, 1);
|
||||||
}else{
|
}else{
|
||||||
|
Loading…
Reference in New Issue
Block a user