Teach rustc to fail

This commit is contained in:
Brian Anderson 2011-01-28 00:09:26 -05:00 committed by Graydon Hoare
parent 3cac20dae3
commit 6b7cab3602
5 changed files with 31 additions and 11 deletions

View file

@ -116,6 +116,7 @@ tag stmt_ {
stmt_ret(option.t[@expr]);
stmt_log(@expr);
stmt_check_expr(@expr);
stmt_fail;
stmt_expr(@expr);
}

View file

@ -1158,6 +1158,11 @@ impure fn parse_stmt(parser p) -> @ast.stmt {
}
}
case (token.FAIL) {
p.bump();
ret @spanned(lo, p.get_span(), ast.stmt_fail);
}
case (token.RET) {
p.bump();
alt (p.peek()) {
@ -1315,6 +1320,7 @@ fn stmt_ends_with_semi(@ast.stmt stmt) -> bool {
case (ast.stmt_ret(_)) { ret true; }
case (ast.stmt_log(_)) { ret true; }
case (ast.stmt_check_expr(_)) { ret true; }
case (ast.stmt_fail) { ret true; }
case (ast.stmt_expr(?e)) {
alt (e.node) {
case (ast.expr_vec(_,_)) { ret true; }