Fix #328
All checks were successful
Build and Test with Maven / Build-and-test-with-Maven (push) Successful in 2m50s

This commit is contained in:
Daniel Holle 2024-04-28 19:25:20 +02:00
parent cba35a4bec
commit a5c314c5c5

View File

@ -300,9 +300,20 @@ public class StatementToTargetExpression implements ASTVisitor {
public void visit(SuperCall superCall) { public void visit(SuperCall superCall) {
var aSuper = converter.convert(superCall.receiver.getType()); var aSuper = converter.convert(superCall.receiver.getType());
var type = converter.convert(superCall.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<TargetType> 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 @Override