reindex the block index.

This commit is contained in:
Rafael Ávila de Espíndola
2011-03-11 17:29:53 -05:00
parent 1feaf8ffb5
commit 74d891517b
3 changed files with 44 additions and 38 deletions

View File

@@ -1480,41 +1480,7 @@ impure fn parse_source_stmt(parser p) -> @ast.stmt {
fn index_block(vec[@ast.stmt] stmts, option.t[@ast.expr] expr) -> ast.block_ {
auto index = new_str_hash[ast.block_index_entry]();
for (@ast.stmt s in stmts) {
alt (s.node) {
case (ast.stmt_decl(?d)) {
alt (d.node) {
case (ast.decl_local(?loc)) {
index.insert(loc.ident, ast.bie_local(loc));
}
case (ast.decl_item(?it)) {
alt (it.node) {
case (ast.item_fn(?i, _, _, _, _)) {
index.insert(i, ast.bie_item(it));
}
case (ast.item_mod(?i, _, _)) {
index.insert(i, ast.bie_item(it));
}
case (ast.item_ty(?i, _, _, _, _)) {
index.insert(i, ast.bie_item(it));
}
case (ast.item_tag(?i, ?variants, _, _)) {
index.insert(i, ast.bie_item(it));
let uint vid = 0u;
for (ast.variant v in variants) {
auto t = ast.bie_tag_variant(it, vid);
index.insert(v.name, t);
vid += 1u;
}
}
case (ast.item_obj(?i, _, _, _, _)) {
index.insert(i, ast.bie_item(it));
}
}
}
}
}
case (_) { /* fall through */ }
}
ast.index_stmt(index, s);
}
ret rec(stmts=stmts, expr=expr, index=index);
}