Skip to content

Commit 00e5d2b

Browse files
catamorphismgraydon
authored andcommitted
---
yaml --- r: 2642 b: refs/heads/master c: c0f7287 h: refs/heads/master v: v3
1 parent bd97576 commit 00e5d2b

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 2cd769e35898df0a84c797c610748a59034a9b93
2+
refs/heads/master: c0f728712ba018ae0a3993232bf5b259e0c312ad

trunk/src/comp/middle/tstate/ck.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ import bitvectors::promises;
6262

6363
import annotate::annotate_crate;
6464
import collect_locals::mk_f_to_fn_info;
65-
import pre_post_conditions::check_item_fn;
65+
import pre_post_conditions::fn_pre_post;
6666
import states::find_pre_post_state_fn;
6767

6868
fn check_states_expr(&fn_ctxt fcx, @expr e) -> () {
@@ -199,19 +199,18 @@ fn check_crate(ty::node_type_table nt, ty::ctxt cx, @crate crate) -> @crate {
199199
annotate_crate(ccx, *crate);
200200

201201
/* Compute the pre and postcondition for every subexpression */
202-
203-
auto fld = new_identity_fold[crate_ctxt]();
204-
fld = @rec(fold_item_fn = bind check_item_fn(_,_,_,_,_,_,_) with *fld);
205-
auto with_pre_postconditions =
206-
fold_crate[crate_ctxt](ccx, fld, crate);
202+
auto do_pre_post = walk::default_visitor();
203+
do_pre_post = rec(visit_fn_pre = bind fn_pre_post(ccx, _, _, _)
204+
with do_pre_post);
205+
walk::walk_crate(do_pre_post, *crate);
207206

208207
auto fld1 = new_identity_fold[crate_ctxt]();
209208

210209
fld1 = @rec(fold_item_fn = bind check_item_fn_state(_,_,_,_,_,_,_),
211210
fold_obj = bind check_obj_state(_,_,_,_)
212211
with *fld1);
213212

214-
ret fold_crate[crate_ctxt](ccx, fld1, with_pre_postconditions);
213+
ret fold_crate[crate_ctxt](ccx, fld1, crate);
215214
}
216215

217216
//

trunk/src/comp/middle/tstate/pre_post_conditions.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -679,18 +679,11 @@ fn find_pre_post_fn(&fn_ctxt fcx, &_fn f) -> () {
679679
find_pre_post_block(fcx, f.body);
680680
}
681681

682-
fn check_item_fn(&crate_ctxt ccx, &span sp, &ident i, &_fn f,
683-
&vec[ty_param] ty_params,
684-
&def_id id, &ann a) -> @item {
685-
log("check_item_fn:");
686-
log_fn(f, i, ty_params);
687-
682+
fn fn_pre_post(crate_ctxt ccx, &_fn f, &ident i, &def_id id) -> () {
688683
assert (ccx.fm.contains_key(id));
689684
auto fcx = rec(enclosing=ccx.fm.get(id),
690685
id=id, name=i, ccx=ccx);
691686
find_pre_post_fn(fcx, f);
692-
693-
ret @respan(sp, item_fn(i, f, ty_params, id, a));
694687
}
695688

696689
//

0 commit comments

Comments
 (0)