diff --git a/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java b/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java index 63248f92..6c1303a3 100644 --- a/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java +++ b/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java @@ -20,7 +20,8 @@ public class ASTToTargetAST { public TargetClass convert(ClassOrInterface input, Map sigma){ List targetConstructors = new ArrayList<>(); //TODO constructor conversion -> also reduce syntactic sugar - return new TargetClass(input.getModifiers(),input.getClassName().toString(), sigma.get(input.getSuperClass()), + return new TargetClass(input.getModifiers(),input.getClassName().toString(), null, + sigma.get(input.getSuperClass()), input.getSuperInterfaces().stream().map(it -> sigma.get(it)).collect(Collectors.toList()), targetConstructors, input.getFieldDecl().stream().map(it -> convert(it, sigma)).collect(Collectors.toList()), @@ -42,7 +43,7 @@ public class ASTToTargetAST { } private TargetField convert(Field input, Map sigma) { - return null; + return new TargetField(convert(input.getType(), sigma), input.getName()); } private TargetType convert(RefTypeOrTPHOrWildcardOrGeneric input, Map sigma) { diff --git a/src/main/java/de/dhbwstuttgart/target/tree/GenericDeclaration.java b/src/main/java/de/dhbwstuttgart/target/tree/GenericDeclaration.java new file mode 100644 index 00000000..16591a8b --- /dev/null +++ b/src/main/java/de/dhbwstuttgart/target/tree/GenericDeclaration.java @@ -0,0 +1,7 @@ +package de.dhbwstuttgart.target.tree; + +import de.dhbwstuttgart.syntaxtree.type.GenericRefType; +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record GenericDeclaration(GenericRefType generic, TargetType bound) { +} diff --git a/src/main/java/de/dhbwstuttgart/target/tree/TargetClass.java b/src/main/java/de/dhbwstuttgart/target/tree/TargetClass.java index a78da9d3..e5c85560 100644 --- a/src/main/java/de/dhbwstuttgart/target/tree/TargetClass.java +++ b/src/main/java/de/dhbwstuttgart/target/tree/TargetClass.java @@ -5,6 +5,7 @@ import de.dhbwstuttgart.target.tree.type.TargetType; import java.util.List; -public record TargetClass(int modifiers, String qualifiedName, TargetType superType, List implementingInterfaces, +public record TargetClass(int modifiers, String qualifiedName, List generics, TargetType superType, + List implementingInterfaces, List constructors, List fields, List methods) {} diff --git a/src/main/java/de/dhbwstuttgart/target/tree/TargetConstructor.java b/src/main/java/de/dhbwstuttgart/target/tree/TargetConstructor.java index b93219ff..42838389 100644 --- a/src/main/java/de/dhbwstuttgart/target/tree/TargetConstructor.java +++ b/src/main/java/de/dhbwstuttgart/target/tree/TargetConstructor.java @@ -1,7 +1,9 @@ package de.dhbwstuttgart.target.tree; +import de.dhbwstuttgart.target.tree.expression.TargetBlock; + import java.util.List; -public record TargetConstructor(List parameterTypes) { +public record TargetConstructor(List parameterTypes, TargetBlock block) { } diff --git a/src/main/java/de/dhbwstuttgart/target/tree/type/TargetExtendsWildcard.java b/src/main/java/de/dhbwstuttgart/target/tree/type/TargetExtendsWildcard.java index b30b85e9..b410943b 100644 --- a/src/main/java/de/dhbwstuttgart/target/tree/type/TargetExtendsWildcard.java +++ b/src/main/java/de/dhbwstuttgart/target/tree/type/TargetExtendsWildcard.java @@ -1,7 +1,5 @@ package de.dhbwstuttgart.target.tree.type; -import java.util.List; - public record TargetExtendsWildcard(TargetType innerType) implements TargetType{ }