make file pretty

This commit is contained in:
2020-02-03 22:59:17 +01:00
parent 018ce8712a
commit e8f80eb2f9

View File

@@ -55,17 +55,19 @@ public class ContextAnalysis extends KlangBaseVisitor<Node> {
statements[i] = (Statement) currentStatement;
actualStatementCount += 1;
// We use the existance of a type to indicate that this statement returns something
// for which the VariableDeclaration is an exception
// We use the existance of a type to indicate that this statement returns
// something for which the VariableDeclaration is an exception
if (currentStatement.type != null && !(currentStatement instanceof VariableDeclaration)) {
// check whether the type matches
try {
this.currentDeclaredReturnType.combine(currentStatement.type);
} catch (Exception e) {
throw new RuntimeException(Helper.getErrorPrefix(currentStatement.line, currentStatement.col) + e.getMessage());
throw new RuntimeException(
Helper.getErrorPrefix(currentStatement.line, currentStatement.col) + e.getMessage());
}
// since we have a return guaranteed, every statement after this one is unreachable code
// since we have a return guaranteed, every statement
// after this one is unreachable code
hasReturn = true;
break;
}
@@ -125,8 +127,9 @@ public class ContextAnalysis extends KlangBaseVisitor<Node> {
}
if (thenBlock.type != null && type != null) {
// Since a block verifies that it can combine with the return type of the function
// it is defined in, we do not have check whether the then and alt block return types match
// Since a block verifies that it can combine with the return type of the
// function it is defined in, we do not have check whether the then and
// alt block return types match
result.type = thenBlock.type;
}