aboutsummaryrefslogtreecommitdiff
path: root/src/comp/front/ast.rs
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-10-18 16:15:25 -0700
committerGraydon Hoare <[email protected]>2010-10-18 16:15:25 -0700
commit865bbae685fbf9bd1583a3f1715dd8093c0cbda2 (patch)
tree76ccfd49924368ddebaabe535ec02e9b654f7247 /src/comp/front/ast.rs
parentDisable use of parametric tail call in map.rs, they don't presently work. (diff)
downloadrust-865bbae685fbf9bd1583a3f1715dd8093c0cbda2.tar.xz
rust-865bbae685fbf9bd1583a3f1715dd8093c0cbda2.zip
More work on resolving names in rustc. Basic expr_name lookup working on items and args.
Diffstat (limited to 'src/comp/front/ast.rs')
-rw-r--r--src/comp/front/ast.rs41
1 files changed, 18 insertions, 23 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs
index a33373f4..04c64bea 100644
--- a/src/comp/front/ast.rs
+++ b/src/comp/front/ast.rs
@@ -12,20 +12,17 @@ type name = spanned[name_];
type path = vec[name];
type crate_num = int;
-type slot_num = int;
-type item_num = int;
-
-tag slot_id {
- id_slot(crate_num, slot_num);
-}
-
-tag item_id {
- id_item(crate_num, slot_num);
-}
-
-tag referent {
- ref_slot(slot_id);
- ref_item(item_id);
+type def_num = int;
+type def_id = tup(crate_num, def_num);
+
+tag def {
+ def_fn(def_id);
+ def_mod(def_id);
+ def_const(def_id);
+ def_arg(def_id);
+ def_local(def_id);
+ def_ty(def_id);
+ def_ty_arg(def_id);
}
type crate = spanned[crate_];
@@ -93,7 +90,7 @@ tag expr_ {
expr_assign(@expr /* TODO: @expr : is_lval(@expr) */, @expr);
expr_field(@expr, ident);
expr_index(@expr, @expr);
- expr_name(name, option[referent]);
+ expr_name(name, option[def]);
}
type lit = spanned[lit_];
@@ -118,7 +115,7 @@ tag ty_ {
ty_box(@ty);
ty_vec(@ty);
ty_tup(vec[tup(bool /* mutability */, @ty)]);
- ty_path(path, option[referent]);
+ ty_path(path, option[def]);
}
tag mode {
@@ -126,10 +123,8 @@ tag mode {
alias;
}
-type slot = rec(@ty ty, mode mode, option[slot_id] id);
-type input = rec(slot slot, ident ident);
-
-type _fn = rec(vec[input] inputs,
+type arg = rec(mode mode, @ty ty, ident ident, def_id id);
+type _fn = rec(vec[arg] inputs,
ty output,
block body);
@@ -137,9 +132,9 @@ type _mod = hashmap[ident,@item];
type item = spanned[item_];
tag item_ {
- item_fn(_fn, item_id);
- item_mod(_mod);
- item_ty(@ty, item_id);
+ item_fn(_fn, def_id);
+ item_mod(_mod, def_id);
+ item_ty(@ty, def_id);
}