diff --git a/src/main/java/de/dhbwstuttgart/target/generate/StatementToTargetExpression.java b/src/main/java/de/dhbwstuttgart/target/generate/StatementToTargetExpression.java index 74f0fe89..87cb243c 100644 --- a/src/main/java/de/dhbwstuttgart/target/generate/StatementToTargetExpression.java +++ b/src/main/java/de/dhbwstuttgart/target/generate/StatementToTargetExpression.java @@ -300,9 +300,20 @@ public class StatementToTargetExpression implements ASTVisitor { public void visit(SuperCall superCall) { var aSuper = converter.convert(superCall.receiver.getType()); var type = converter.convert(superCall.getType()); - var parameters = superCall.arglist.getArguments().stream().map(par -> converter.convert(par.getType())).toList(); + var receiverName = new JavaClassName(converter.convert(superCall.receiver.getType()).name()); + var clazz = converter.compiler.getClass(converter.compiler.getClass(receiverName).getSuperClass().getName()); + var signature = superCall.signatureArguments().stream().map(converter::convert).toList(); + var method = converter.findConstructor(clazz, signature); + var params = superCall.getArgumentList().getArguments().stream().map(converter::convert).toList(); - result = new TargetMethodCall(type, type, parameters, new TargetSuper(aSuper), superCall.getArgumentList().getArguments().stream().map(converter::convert).toList(), aSuper, superCall.name, false, false, false); + List argList; + if (method.isPresent()) { + argList = method.get().getParameterList().getFormalparalist().stream().map(e -> converter.convert(e.getType())).toList(); + } else { + argList = params.stream().map(TargetExpression::type).toList(); + } + + result = new TargetMethodCall(type, null, argList, new TargetSuper(aSuper), params, aSuper, superCall.name, false, false, false); } @Override