Compare commits

..

No commits in common. "4b2edaa6ff124064b87be6c7ad9ad0c1a473ebe5" and "942597d5359101ec639f1c7f7ac4938295253b07" have entirely different histories.

View File

@ -35,7 +35,7 @@ public class MethodCallStatementExpression extends AbstractType implements IExpr
String classToSearchMethodIn = thisClass;
//method is called on something that is not this ???
if (this.receiver != null) {
if(this.receiver != null) {
if (!receiver.thisExpression) {
classToSearchMethodIn = localVars.get(receiver.identifier);
if (classToSearchMethodIn == null)
@ -46,7 +46,7 @@ public class MethodCallStatementExpression extends AbstractType implements IExpr
String currentType = "";
// receiver is instvar
if (receiver != null) {
if(receiver != null) {
if (receiver.instVarExpression != null) {
String Subreceiver = receiver.instVarExpression.receivers.get(0).identifier; // e
String mostLeftField = receiver.instVarExpression.fieldName; // example1
@ -56,19 +56,17 @@ public class MethodCallStatementExpression extends AbstractType implements IExpr
receiver.instVarExpression.thisClass = typeOfSubreceiver;
receiver.instVarExpression.typeCheck(methodContext, typeContext, localVars);
currentType = typeContext.get(typeOfSubreceiver).get(mostLeftField);
} else {
currentType = thisClass;
}
} else {
}else{
currentType = thisClass;
}
//if classToSearchMethodIn does not conatin method, throw exception. go through list and check each
for (int i = 0; i < receivingMethods.size(); i++) {
for(int i = 0; i < receivingMethods.size(); i++){
currentType = (String) methodContext.get(currentType).get(receivingMethods.get(i).methodName).keySet().toArray()[0];
if (currentType == null)
throw new TypeCheckException("The method " + methodName + " was not found in " + classToSearchMethodIn + ".");
if(currentType == null)
throw new TypeCheckException("The method " + methodName + " was not found in "+ classToSearchMethodIn + ".");
receivingMethods.get(i).thisClass = this.thisClass;
receivingMethods.get(i).checkParameters(methodContext, typeContext, localVars);
}
@ -177,7 +175,7 @@ public class MethodCallStatementExpression extends AbstractType implements IExpr
if (o == null || getClass() != o.getClass()) return false;
MethodCallStatementExpression methodCallStatementExpression = (MethodCallStatementExpression) o;
return (Objects.equals(methodName, methodCallStatementExpression.methodName)
&& Objects.equals(arguments, methodCallStatementExpression.arguments)
&& Objects.equals(arguments, methodCallStatementExpression.arguments)
);
}