rustc: Index blocks
This commit is contained in:
parent
43b457c5d6
commit
e0edcfc21c
@ -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 {
|
||||
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user