Merge branch 'refactorToAPIs' of gohorb.ba-horb.de:/bahome/projekt/git/JavaCompilerCore into refactorToAPIs

This commit is contained in:
Etienne Zink 2022-04-20 15:21:25 +02:00
commit 59c5e48201
5 changed files with 15 additions and 6 deletions

View File

@ -20,7 +20,8 @@ public class ASTToTargetAST {
public TargetClass convert(ClassOrInterface input, Map<TypePlaceholder, TargetType> sigma){ public TargetClass convert(ClassOrInterface input, Map<TypePlaceholder, TargetType> sigma){
List<TargetConstructor> targetConstructors = new ArrayList<>(); List<TargetConstructor> targetConstructors = new ArrayList<>();
//TODO constructor conversion -> also reduce syntactic sugar //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()), input.getSuperInterfaces().stream().map(it -> sigma.get(it)).collect(Collectors.toList()),
targetConstructors, targetConstructors,
input.getFieldDecl().stream().map(it -> convert(it, sigma)).collect(Collectors.toList()), input.getFieldDecl().stream().map(it -> convert(it, sigma)).collect(Collectors.toList()),
@ -42,7 +43,7 @@ public class ASTToTargetAST {
} }
private TargetField convert(Field input, Map<TypePlaceholder, TargetType> sigma) { private TargetField convert(Field input, Map<TypePlaceholder, TargetType> sigma) {
return null; return new TargetField(convert(input.getType(), sigma), input.getName());
} }
private TargetType convert(RefTypeOrTPHOrWildcardOrGeneric input, Map<TypePlaceholder, TargetType> sigma) { private TargetType convert(RefTypeOrTPHOrWildcardOrGeneric input, Map<TypePlaceholder, TargetType> sigma) {

View File

@ -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) {
}

View File

@ -5,6 +5,7 @@ import de.dhbwstuttgart.target.tree.type.TargetType;
import java.util.List; import java.util.List;
public record TargetClass(int modifiers, String qualifiedName, TargetType superType, List<TargetType> implementingInterfaces, public record TargetClass(int modifiers, String qualifiedName, List<GenericDeclaration> generics, TargetType superType,
List<TargetType> implementingInterfaces,
List<TargetConstructor> constructors, List<TargetField> fields, List<TargetMethod> methods) {} List<TargetConstructor> constructors, List<TargetField> fields, List<TargetMethod> methods) {}

View File

@ -1,7 +1,9 @@
package de.dhbwstuttgart.target.tree; package de.dhbwstuttgart.target.tree;
import de.dhbwstuttgart.target.tree.expression.TargetBlock;
import java.util.List; import java.util.List;
public record TargetConstructor(List<MethodParameter> parameterTypes) { public record TargetConstructor(List<MethodParameter> parameterTypes, TargetBlock block) {
} }

View File

@ -1,7 +1,5 @@
package de.dhbwstuttgart.target.tree.type; package de.dhbwstuttgart.target.tree.type;
import java.util.List;
public record TargetExtendsWildcard(TargetType innerType) implements TargetType{ public record TargetExtendsWildcard(TargetType innerType) implements TargetType{
} }