diff --git a/src/main/java/abstractSyntaxTree/StatementExpression/MethodCallStatementExpression.java b/src/main/java/abstractSyntaxTree/StatementExpression/MethodCallStatementExpression.java index 7ef11db..6d028f8 100644 --- a/src/main/java/abstractSyntaxTree/StatementExpression/MethodCallStatementExpression.java +++ b/src/main/java/abstractSyntaxTree/StatementExpression/MethodCallStatementExpression.java @@ -132,7 +132,9 @@ public class MethodCallStatementExpression extends AbstractType implements IExpr throw new ExecutionControl.NotImplementedException("Receiver type not supported."); } } else { - throw new ExecutionControl.NotImplementedException("Receiver is null."); + mv.visitVarInsn(Opcodes.ALOAD, 0); + owner = thisClass; + } String returnOfPreviousMethod = null; // Invoke the method for each receiving method in the chain @@ -196,12 +198,17 @@ public class MethodCallStatementExpression extends AbstractType implements IExpr } descriptor.append(")"); + String classToSearchMethodIn; //Return Type - String classToSearchMethodIn = localVars.get(receiver.identifier); - if (classToSearchMethodIn == null) { - classToSearchMethodIn = returnOfPreviousMethod; - } - if (classToSearchMethodIn == null) { + if (receiver != null) { + classToSearchMethodIn = localVars.get(receiver.identifier); + if (classToSearchMethodIn == null) { + classToSearchMethodIn = returnOfPreviousMethod; + } + if (classToSearchMethodIn == null) { + classToSearchMethodIn = thisClass; + } + } else { classToSearchMethodIn = thisClass; }