diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-03-15 18:46:18 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-03-15 18:46:57 -0700 |
| commit | e0edcfc21cab536222a16eee0533993b68e84886 (patch) | |
| tree | d617fc91de8a4b33fbea96a8c32f2b492e5c964a /src/rustc | |
| parent | 43b457c5d61971ed4787b8557462281fce9f4341 (diff) | |
| download | rust-e0edcfc21cab536222a16eee0533993b68e84886.tar.gz rust-e0edcfc21cab536222a16eee0533993b68e84886.zip | |
rustc: Index blocks
Diffstat (limited to 'src/rustc')
| -rw-r--r-- | src/rustc/middle/ast_map.rs | 6 | ||||
| -rw-r--r-- | src/rustc/middle/ty.rs | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/rustc/middle/ast_map.rs b/src/rustc/middle/ast_map.rs index 196586fb10f..4212614f9aa 100644 --- a/src/rustc/middle/ast_map.rs +++ b/src/rustc/middle/ast_map.rs @@ -36,6 +36,7 @@ enum ast_node { node_arg(arg, uint), node_local(uint), node_ctor(@item), + node_block(blk), } type map = std::map::hashmap<node_id, ast_node>; @@ -107,6 +108,11 @@ fn map_fn(fk: visit::fn_kind, decl: fn_decl, body: blk, visit::visit_fn(fk, decl, body, sp, id, cx, v); } +fn map_block(b: blk, cx: ctx, v: vt) { + cx.map.insert(b.node.id, node_block(b)); + visit::visit_block(b, cx, v); +} + fn number_pat(cx: ctx, pat: @pat) { pat_util::walk_pat(pat) {|p| alt p.node { diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index 9d581287470..0e017f3f011 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -2328,7 +2328,8 @@ fn item_path(cx: ctxt, id: ast::def_id) -> ast_map::path { } ast_map::node_expr(_) | ast_map::node_arg(_, _) | - ast_map::node_local(_) | ast_map::node_export(_, _) { + ast_map::node_local(_) | ast_map::node_export(_, _) | + ast_map::node_block(_) { cx.sess.bug(#fmt["cannot find item_path for node %?", node]); } } |
