Fehler in Construct für Typen der Felder, und Methoden der generierten Interfaces markiert mit //TODO

This commit is contained in:
Aldaron7 2018-04-30 20:28:12 +02:00
parent 3ed300268f
commit 48e22982c8
2 changed files with 7 additions and 2 deletions

View File

@ -23,6 +23,7 @@ import de.dhbwstuttgart.syntaxtree.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.Method; import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.syntaxtree.ParameterList; import de.dhbwstuttgart.syntaxtree.ParameterList;
import de.dhbwstuttgart.syntaxtree.statement.Block; import de.dhbwstuttgart.syntaxtree.statement.Block;
import de.dhbwstuttgart.syntaxtree.type.GenericRefType;
import de.dhbwstuttgart.syntaxtree.type.RefType; import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
@ -88,10 +89,12 @@ public class Construct extends DefaultASTVisitor {
// Schleife über alle FieldConstraints mit ClassType i // Schleife über alle FieldConstraints mit ClassType i
this.constraintsSet.getFieldConstraints().stream().filter(fc -> fc.getClassType().equals(i)).forEach(fc -> { this.constraintsSet.getFieldConstraints().stream().filter(fc -> fc.getClassType().equals(i)).forEach(fc -> {
TypePlaceholder type = TypePlaceholder.fresh(offset); TypePlaceholder type = TypePlaceholder.fresh(offset);
//TODO welcher Typ für field TPH, GenRT,...?
GenericRefType grt = new GenericRefType(type.getName(), offset);
parameterInhTyterm.add(fc.getFieldType()); parameterInhTyterm.add(fc.getFieldType());
generics.add(new GenericTypeVar( type.getName(), generics.add(new GenericTypeVar( type.getName(),
new ArrayList<>(), offset, offset)); new ArrayList<>(), offset, offset));
Field field = new Field(fc.getFieldName(), type, Modifier.PUBLIC, offset); Field field = new Field(fc.getFieldName(), grt, Modifier.PUBLIC, offset);
fielddecl.add(field); fielddecl.add(field);
}); });
@ -104,12 +107,14 @@ public class Construct extends DefaultASTVisitor {
GenericDeclarationList gtvDeclarations = new GenericDeclarationList(new ArrayList<>(), offset); GenericDeclarationList gtvDeclarations = new GenericDeclarationList(new ArrayList<>(), offset);
List<FormalParameter> params = new ArrayList<>(); List<FormalParameter> params = new ArrayList<>();
mc.getArguments().stream().map(a -> a.getSupertype()).forEach(supertype -> { mc.getArguments().stream().map(a -> a.getSupertype()).forEach(supertype -> {
//TODO welcher Typ für argument?
TypePlaceholder tph = TypePlaceholder.fresh(offset); TypePlaceholder tph = TypePlaceholder.fresh(offset);
params.add(new FormalParameter(tph.getName(), tph, offset)); params.add(new FormalParameter(tph.getName(), tph, offset));
parameterInhTyterm.add(supertype); parameterInhTyterm.add(supertype);
generics.add(new GenericTypeVar(tph.getName(), new ArrayList<>(), offset, offset)); generics.add(new GenericTypeVar(tph.getName(), new ArrayList<>(), offset, offset));
}); });
ParameterList parameterList = new ParameterList(params, offset); ParameterList parameterList = new ParameterList(params, offset);
//TODO Welcher returnType für method
Method method = new Method(Modifier.PUBLIC, mc.getMethodName(), returnType, parameterList, block, gtvDeclarations, offset); Method method = new Method(Modifier.PUBLIC, mc.getMethodName(), returnType, parameterList, block, gtvDeclarations, offset);
methods.add(method); methods.add(method);
}); });

View File

@ -390,7 +390,7 @@ public class SyntaxTreePrinter implements ASTVisitor {
@Override @Override
public void visit(GenericRefType genericRefType) { public void visit(GenericRefType genericRefType) {
throw new NotImplementedException(); System.out.println("GenRT " + genericRefType.getParsedName());
} }
@Override @Override