From 567a45cc70424b77cac489940a36ff8a6ea97b84 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 30 Nov 2010 12:32:20 -0800 Subject: rustc: Add def ids to variants --- src/comp/front/ast.rs | 3 ++- src/comp/front/parser.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/comp/front') 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 (_) { -- cgit v1.2.3