Merge remote-tracking branch 'origin/master'
# Conflicts: # src/main/java/abstractSyntaxTree/Program.java
This commit is contained in:
commit
34f4f307f3
@ -43,9 +43,12 @@ public class MethodDecl implements Node {
|
||||
|
||||
TypeCheckResult result = new TypeCheckResult();
|
||||
codeBlock.thisClass = classThatContainsMethod;
|
||||
String CodeBlockType = codeBlock.typeCheck(methodContext, typeContext, localVars).type;
|
||||
if(!Objects.equals(this.returnType, CodeBlockType))
|
||||
throw new TypeCheckException("Method returns " + CodeBlockType + ", but should return " + this.returnType + ". ");
|
||||
String codeBlockType = codeBlock.typeCheck(methodContext, typeContext, localVars).type;
|
||||
if(Objects.equals(this.name, classThatContainsMethod))
|
||||
codeBlockType = null;
|
||||
|
||||
if(!Objects.equals(this.returnType, codeBlockType))
|
||||
throw new TypeCheckException("Method returns " + codeBlockType + ", but should return " + this.returnType + ". ");
|
||||
result.type = codeBlock.returnType;
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user