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();
|
TypeCheckResult result = new TypeCheckResult();
|
||||||
codeBlock.thisClass = classThatContainsMethod;
|
codeBlock.thisClass = classThatContainsMethod;
|
||||||
String CodeBlockType = codeBlock.typeCheck(methodContext, typeContext, localVars).type;
|
String codeBlockType = codeBlock.typeCheck(methodContext, typeContext, localVars).type;
|
||||||
if(!Objects.equals(this.returnType, CodeBlockType))
|
if(Objects.equals(this.name, classThatContainsMethod))
|
||||||
throw new TypeCheckException("Method returns " + CodeBlockType + ", but should return " + this.returnType + ". ");
|
codeBlockType = null;
|
||||||
|
|
||||||
|
if(!Objects.equals(this.returnType, codeBlockType))
|
||||||
|
throw new TypeCheckException("Method returns " + codeBlockType + ", but should return " + this.returnType + ". ");
|
||||||
result.type = codeBlock.returnType;
|
result.type = codeBlock.returnType;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user