Browse Source

Prevent statements after branch statements.

Ginger Bill 8 years ago
parent
commit
572ac616c1
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/check_stmt.cpp

+ 4 - 0
src/check_stmt.cpp

@@ -32,6 +32,10 @@ void check_stmt_list(Checker *c, Array<AstNode *> stmts, u32 flags) {
 			case AstNode_ReturnStmt:
 				error(n, "Statements after this `return` are never executed");
 				break;
+
+			case AstNode_BranchStmt:
+				error(n, "Statements after this `%.*s` are never executed", LIT(n->BranchStmt.token.string));
+				break;
 			}
 		}