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

View File

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