From 48e22982c8b36b9ea37c71a00081f8d8febb334a Mon Sep 17 00:00:00 2001 From: Aldaron7 Date: Mon, 30 Apr 2018 20:28:12 +0200 Subject: [PATCH] =?UTF-8?q?Fehler=20in=20Construct=20f=C3=BCr=20Typen=20de?= =?UTF-8?q?r=20Felder,=20und=20Methoden=20der=20generierten=20Interfaces?= =?UTF-8?q?=20markiert=20mit=20//TODO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/de/dhbwstuttgart/strucTypes/Construct.java | 7 ++++++- .../strucTypes/printutils/SyntaxTreePrinter.java | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/de/dhbwstuttgart/strucTypes/Construct.java b/src/de/dhbwstuttgart/strucTypes/Construct.java index 96cc7507..18a42e27 100644 --- a/src/de/dhbwstuttgart/strucTypes/Construct.java +++ b/src/de/dhbwstuttgart/strucTypes/Construct.java @@ -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 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); }); diff --git a/src/de/dhbwstuttgart/strucTypes/printutils/SyntaxTreePrinter.java b/src/de/dhbwstuttgart/strucTypes/printutils/SyntaxTreePrinter.java index 4f7774e1..dd4750c2 100644 --- a/src/de/dhbwstuttgart/strucTypes/printutils/SyntaxTreePrinter.java +++ b/src/de/dhbwstuttgart/strucTypes/printutils/SyntaxTreePrinter.java @@ -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