methodcall not implemented, current input not working on ast or typechek or codegen
This commit is contained in:
parent
5a66ce97ca
commit
8a26f700b5
@ -1,10 +1,12 @@
|
||||
class Example1 {
|
||||
int i;
|
||||
boolean b;
|
||||
char c;
|
||||
Example e;
|
||||
int m(int n){
|
||||
Example e = new Example();
|
||||
e.m(1);
|
||||
this.e = new Example();
|
||||
this.e.m(2);
|
||||
this.m(2);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -14,11 +16,6 @@ class Example {
|
||||
boolean b;
|
||||
char c;
|
||||
int m(int a){
|
||||
int localA = 0;
|
||||
boolean localB = true;
|
||||
if(localB){
|
||||
localA = 7;
|
||||
}else{}
|
||||
return localA;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -32,22 +32,32 @@ public class MethodCallStatementExpression extends AbstractType implements IExpr
|
||||
|
||||
@Override
|
||||
public TypeCheckResult typeCheck(HashMap<String, HashMap<String, HashMap<String, ParameterList>>> methodContext, HashMap<String, HashMap<String, String>> typeContext, HashMap<String, String> localVars) throws TypeCheckException {
|
||||
TypeCheckResult result = new TypeCheckResult();
|
||||
//todo i really dont get this. waiting for tuesday meeting
|
||||
throw new TypeCheckException("NOT IMPLEMENTED");
|
||||
|
||||
RefType searchMethodHere;
|
||||
if(classThatHasTheMethodIfNotThis == null){
|
||||
searchMethodHere = thisClass;
|
||||
} else {
|
||||
searchMethodHere = classThatHasTheMethodIfNotThis;
|
||||
}
|
||||
|
||||
List<MethodDecl> methods = searchMethodHere.methodDecls;
|
||||
|
||||
if(!methods.contains(methodName)){
|
||||
throw new TypeCheckException("The method " + methodName + " is called, but does not exist.");
|
||||
}
|
||||
|
||||
return result;
|
||||
// TypeCheckResult result = new TypeCheckResult();
|
||||
// String receivingField;
|
||||
// String classContainingMethod;
|
||||
//
|
||||
// if(receiver.instVarExpression != null){
|
||||
// receivingField = receiver.instVarExpression.fieldName;
|
||||
// }else if(receiver.thisExpression) {
|
||||
//
|
||||
// }
|
||||
// RefType searchMethodHere;
|
||||
// if(classThatHasTheMethodIfNotThis == null){
|
||||
// searchMethodHere = thisClass;
|
||||
// } else {
|
||||
// searchMethodHere = classThatHasTheMethodIfNotThis;
|
||||
// }
|
||||
//
|
||||
// List<MethodDecl> methods = searchMethodHere.methodDecls;
|
||||
//
|
||||
// if(!methods.contains(methodName)){
|
||||
// throw new TypeCheckException("The method " + methodName + " is called, but does not exist.");
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
}
|
||||
|
||||
//Errors occur due to the change in parameter in the RefType class
|
||||
|
Loading…
Reference in New Issue
Block a user