aboutsummaryrefslogtreecommitdiff
path: root/src/comp/front
diff options
context:
space:
mode:
authorMarijn Haverbeke <[email protected]>2011-05-11 15:26:36 +0200
committerMarijn Haverbeke <[email protected]>2011-05-11 15:26:36 +0200
commitfe29d24b6e795b3149e710659d12a8c9972bed96 (patch)
tree12a1def74085ffe7104575f3ce56b1f6245f9bb2 /src/comp/front
parentGet rid of block indices (diff)
downloadrust-fe29d24b6e795b3149e710659d12a8c9972bed96.tar.xz
rust-fe29d24b6e795b3149e710659d12a8c9972bed96.zip
Get rid of arm indices
Diffstat (limited to 'src/comp/front')
-rw-r--r--src/comp/front/ast.rs2
-rw-r--r--src/comp/front/parser.rs25
2 files changed, 3 insertions, 24 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs
index 01dea8d8..3d8090b0 100644
--- a/src/comp/front/ast.rs
+++ b/src/comp/front/ast.rs
@@ -233,7 +233,7 @@ tag decl_ {
decl_item(@item);
}
-type arm = rec(@pat pat, block block, hashmap[ident,def_id] index);
+type arm = rec(@pat pat, block block);
type elt = rec(mutability mut, @expr expr);
type field = rec(mutability mut, ident ident, @expr expr);
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs
index 69f0e054..10432389 100644
--- a/src/comp/front/parser.rs
+++ b/src/comp/front/parser.rs
@@ -1367,9 +1367,8 @@ fn parse_alt_expr(parser p) -> @ast.expr {
expect(p, token.LPAREN);
auto pat = parse_pat(p);
expect(p, token.RPAREN);
- auto index = index_arm(pat);
auto block = parse_block(p);
- arms += vec(rec(pat=pat, block=block, index=index));
+ arms += vec(rec(pat=pat, block=block));
}
// FIXME: this is a vestigial form left over from
@@ -1384,9 +1383,8 @@ fn parse_alt_expr(parser p) -> @ast.expr {
p.bump();
auto hi = p.get_hi_pos();
auto pat = @spanned(lo, hi, ast.pat_wild(p.get_ann()));
- auto index = index_arm(pat);
auto block = parse_block(p);
- arms += vec(rec(pat=pat, block=block, index=index));
+ arms += vec(rec(pat=pat, block=block));
}
case (token.RBRACE) { /* empty */ }
case (?tok) {
@@ -1626,25 +1624,6 @@ fn parse_source_stmt(parser p) -> @ast.stmt {
fail;
}
-fn index_arm(@ast.pat pat) -> hashmap[ast.ident,ast.def_id] {
- fn do_index_arm(&hashmap[ast.ident,ast.def_id] index, @ast.pat pat) {
- alt (pat.node) {
- case (ast.pat_bind(?i, ?def_id, _)) { index.insert(i, def_id); }
- case (ast.pat_wild(_)) { /* empty */ }
- case (ast.pat_lit(_, _)) { /* empty */ }
- case (ast.pat_tag(_, ?pats, _, _)) {
- for (@ast.pat p in pats) {
- do_index_arm(index, p);
- }
- }
- }
- }
-
- auto index = new_str_hash[ast.def_id]();
- do_index_arm(index, pat);
- ret index;
-}
-
fn stmt_to_expr(@ast.stmt stmt) -> Option.t[@ast.expr] {
alt (stmt.node) {
case (ast.stmt_expr(?e,_)) { ret some[@ast.expr](e); }