Fixed an error regarding the owner of a method if the first method in a chain is not in the class where it is called

This commit is contained in:
Jochen Seyfried 2024-07-03 08:18:56 +02:00
parent 88bcfa5fa3
commit c5752df15e

View File

@ -127,11 +127,10 @@ public class MethodCallStatementExpression extends AbstractType implements IExpr
// Invoke the method for each receiving method in the chain
for (ReceivingMethod receivingMethod : receivingMethods) {
// Get the owner class for the current method in the chain
if (returnOfPreviousMethod == null)
owner = thisClass;
else
if (returnOfPreviousMethod != null) {
// If the return of the previous method is not null, use it as the owner class for the current method in the chain
owner = returnOfPreviousMethod;
}
// Generate the code for each argument expression for the current method
for (IExpression argument : receivingMethod.arguments) {