Skip to content

Commit 371f867

Browse files
catamorphismgraydon
authored andcommitted
---
yaml --- r: 2643 b: refs/heads/master c: a9bc671 h: refs/heads/master i: 2641: bd97576 2639: 40c60a2 v: v3
1 parent 00e5d2b commit 371f867

File tree

2 files changed

+4
-29
lines changed

2 files changed

+4
-29
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: c0f728712ba018ae0a3993232bf5b259e0c312ad
2+
refs/heads/master: a9bc6715e774f1197ba9c67bcac89f8f59e08966

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

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn add_var(def_id v, ident nm, uint next, fn_info tbl) -> uint {
6262

6363
/* builds a table mapping each local var defined in f
6464
to a bit number in the precondition/postcondition vectors */
65-
fn mk_fn_info(&_fn f, &def_id f_id, &ident f_name) -> fn_info {
65+
fn mk_fn_info(&crate_ctxt ccx, &_fn f, &ident f_name, &def_id f_id) -> () {
6666
auto res = rec(vars=@new_def_hash[var_info](),
6767
cf=f.decl.cf);
6868
let uint next = 0u;
@@ -72,7 +72,6 @@ fn mk_fn_info(&_fn f, &def_id f_id, &ident f_name) -> fn_info {
7272
just collect locally declared vars */
7373

7474
let @vec[tup(ident,def_id)] locals = find_locals(f, f_name, f_id);
75-
// log (uistr(vec::len[tup(ident, def_id)](locals)) + " locals");
7675
for (tup(ident,def_id) p in *locals) {
7776
next = add_var(p._1, p._0, next, res);
7877
}
@@ -83,39 +82,15 @@ fn mk_fn_info(&_fn f, &def_id f_id, &ident f_name) -> fn_info {
8382
log(f_name + " has " + uistr(vec::len[tup(ident, def_id)](*locals))
8483
+ " locals");
8584

86-
ret res;
87-
}
88-
89-
/* FIXME: can do this with just one case -- for fn -- now */
90-
91-
/* extends mk_fn_info to an item, side-effecting the map fi from
92-
function IDs to fn_info maps
93-
only looks at function and object items. */
94-
fn mk_fn_info_item (&crate_ctxt ccx, &@item i) -> () {
95-
alt (i.node) {
96-
case (item_fn(?i,?f,?ty_params,?id,?a)) {
97-
auto f_inf = mk_fn_info(f, id, i);
98-
ccx.fm.insert(id, f_inf);
99-
}
100-
case (item_obj(?i,?o,?ty_params,?odid,?a)) {
101-
auto all_methods = vec::clone[@method](o.methods);
102-
plus_option[@method](all_methods, o.dtor);
103-
auto f_inf;
104-
for (@method m in all_methods) {
105-
f_inf = mk_fn_info(m.node.meth, m.node.id, m.node.ident);
106-
ccx.fm.insert(m.node.id, f_inf);
107-
}
108-
}
109-
case (_) { ret; }
110-
}
85+
ccx.fm.insert(f_id, res);
11186
}
11287

11388
/* initializes the global fn_info_map (mapping each function ID, including
11489
nested locally defined functions, onto a mapping from local variable name
11590
to bit number) */
11691
fn mk_f_to_fn_info(&crate_ctxt ccx, @crate c) -> () {
11792
let ast_visitor vars_visitor = walk::default_visitor();
118-
vars_visitor = rec(visit_item_post=bind mk_fn_info_item(ccx,_)
93+
vars_visitor = rec(visit_fn_pre=bind mk_fn_info(ccx,_,_,_)
11994
with vars_visitor);
12095

12196
walk_crate(vars_visitor, *c);

0 commit comments

Comments
 (0)