diff options
| author | Patrick Walton <[email protected]> | 2010-11-30 12:32:20 -0800 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2010-11-30 12:32:20 -0800 |
| commit | 567a45cc70424b77cac489940a36ff8a6ea97b84 (patch) | |
| tree | c7c5f0260ca59854fcf81265d612673f7716bdd9 /src/comp/front | |
| parent | Finish support for typechecking and translating records. Un-XFAIL rec.rs. (diff) | |
| download | rust-567a45cc70424b77cac489940a36ff8a6ea97b84.tar.xz rust-567a45cc70424b77cac489940a36ff8a6ea97b84.zip | |
rustc: Add def ids to variants
Diffstat (limited to 'src/comp/front')
| -rw-r--r-- | src/comp/front/ast.rs | 3 | ||||
| -rw-r--r-- | src/comp/front/parser.rs | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs index a1670c70..25cea29e 100644 --- a/src/comp/front/ast.rs +++ b/src/comp/front/ast.rs @@ -30,6 +30,7 @@ tag def { def_const(def_id); def_arg(def_id); def_local(def_id); + def_variant(def_id); def_ty(def_id); def_ty_arg(def_id); } @@ -173,7 +174,7 @@ type _fn = rec(vec[arg] inputs, type _mod = rec(vec[@item] items, hashmap[ident,uint] index); -type variant = rec(str name, vec[@ty] args); +type variant = rec(str name, vec[@ty] args, def_id id); type item = spanned[item_]; tag item_ { diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index b23fa0aa..91124dc1 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -1260,7 +1260,8 @@ impure fn parse_item_tag(parser p) -> tup(ast.ident, @ast.item) { expect(p, token.SEMI); - variants += vec(rec(name=name, args=args)); + auto id = p.next_def_id(); + variants += vec(rec(name=name, args=args, id=id)); } case (token.RBRACE) { /* empty */ } case (_) { |