Prevent statements after branch statements.
This commit is contained in:
1 parent
96bf6a5bcb
commit
572ac616c1
1 file changed
+4
@@ -32,6 +32,10 @@ void check_stmt_list(Checker *c, Array<AstNode *> stmts, u32 flags) {
|
|||||||
case AstNode_ReturnStmt:
|
case AstNode_ReturnStmt:
|
||||||
error(n, "Statements after this `return` are never executed");
|
error(n, "Statements after this `return` are never executed");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case AstNode_BranchStmt:
|
||||||
|
error(n, "Statements after this `%.*s` are never executed", LIT(n->BranchStmt.token.string));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user