aboutsummaryrefslogtreecommitdiff
path: root/src/comp/front/ast.rs
diff options
context:
space:
mode:
authorRafael Ávila de Espíndola <[email protected]>2011-01-01 13:13:00 -0500
committerRafael Ávila de Espíndola <[email protected]>2011-01-04 11:35:13 -0500
commite0fe271d3459d04af9e1580c396b4698063e1999 (patch)
treeab869f8a2779d8c5819c1493881225cdc863d043 /src/comp/front/ast.rs
parentRefactor the view_item code so that it is similar to the code used for (diff)
downloadrust-e0fe271d3459d04af9e1580c396b4698063e1999.tar.xz
rust-e0fe271d3459d04af9e1580c396b4698063e1999.zip
Add support for looking up a name introduced by a 'use'.
With this we go from "error: unresolved name: foo" to "unimplemented definition variant for: foo" in use foo; fn main(vec[str] args) { foo.bar(); }
Diffstat (limited to 'src/comp/front/ast.rs')
-rw-r--r--src/comp/front/ast.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs
index 55207de0..15c0e499 100644
--- a/src/comp/front/ast.rs
+++ b/src/comp/front/ast.rs
@@ -35,6 +35,7 @@ tag def {
def_ty(def_id);
def_ty_arg(def_id);
def_binding(def_id);
+ def_use(def_id);
}
type crate = spanned[crate_];
@@ -212,20 +213,23 @@ type _obj = rec(vec[obj_field] fields,
tag mod_index_entry {
+ mie_use(uint);
mie_item(uint);
mie_tag_variant(uint /* tag item index */, uint /* variant index */);
}
-type _mod = rec(vec[@item] items,
- hashmap[ident,mod_index_entry] index);
+type mod_index = hashmap[ident,mod_index_entry];
+type _mod = rec(vec[@view_item] view_items,
+ vec[@item] items,
+ mod_index index);
type variant_arg = rec(@ty ty, def_id id);
type variant = rec(str name, vec[variant_arg] args, def_id id, ann ann);
type view_item = spanned[view_item_];
tag view_item_ {
- view_item_use(ident, vec[@meta_item]);
- view_item_import(vec[ident]);
+ view_item_use(ident, vec[@meta_item], def_id);
+ view_item_import(vec[ident], def_id);
}
type item = spanned[item_];