Skip to content

Commit d97c800

Browse files
committed
Make ret and fail stmts have 0 out-edges, Closes #250.
1 parent 94b681a commit d97c800

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

src/boot/me/typestate.ml

+5
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,11 @@ let rec build_flow_graph_for_stmt
865865
| Ast.STMT_block b ->
866866
blk predecessors b
867867

868+
| Ast.STMT_fail
869+
| Ast.STMT_ret _ ->
870+
connect predecessors [s.id];
871+
[]
872+
868873
| _ ->
869874
connect predecessors [s.id];
870875
[s.id]

src/comp/front/lexer.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -665,12 +665,9 @@ impure fn next_token(reader rdr) -> token.token {
665665
case ('%') {
666666
ret binop(rdr, token.PERCENT);
667667
}
668-
669668
}
670669

671-
log "lexer stopping at ";
672-
log c;
673-
ret token.EOF;
670+
fail;
674671
}
675672

676673

src/comp/middle/fold.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ fn fold_expr[ENV](&ENV env, ast_fold[ENV] fld, &@expr e) -> @expr {
701701

702702
}
703703

704-
ret e;
704+
fail;
705705
}
706706

707707

@@ -724,7 +724,7 @@ fn fold_stmt[ENV](&ENV env, ast_fold[ENV] fld, &@stmt s) -> @stmt {
724724
ret fld.fold_stmt_expr(env_, s.span, ee);
725725
}
726726
}
727-
ret s;
727+
fail;
728728
}
729729

730730
fn fold_block[ENV](&ENV env, ast_fold[ENV] fld, &block blk) -> block {

src/comp/middle/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ fn fold_ty(ty_fold fld, @t ty) -> @t {
373373
case (ty_param(_)) { ret fld.fold_simple_ty(ty); }
374374
}
375375

376-
ret ty;
376+
fail;
377377
}
378378

379379
// Type utilities

0 commit comments

Comments
 (0)