aboutsummaryrefslogtreecommitdiff
path: root/src/comp/middle
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2010-11-24 17:36:22 -0800
committerPatrick Walton <[email protected]>2010-11-24 17:36:22 -0800
commit9769b612261d6000b969ce466c4033f8445d3474 (patch)
tree5313b4cb1be29bbe3d396a758b3cf46a68b6a5af /src/comp/middle
parentrustc: Parse type-parametric tags (diff)
downloadrust-9769b612261d6000b969ce466c4033f8445d3474.tar.xz
rust-9769b612261d6000b969ce466c4033f8445d3474.zip
rustc: Parse type-parametric typedefs
Diffstat (limited to 'src/comp/middle')
-rw-r--r--src/comp/middle/fold.rs14
-rw-r--r--src/comp/middle/resolve.rs2
-rw-r--r--src/comp/middle/typeck.rs8
3 files changed, 13 insertions, 11 deletions
diff --git a/src/comp/middle/fold.rs b/src/comp/middle/fold.rs
index 8a8f65eb..de2fd87a 100644
--- a/src/comp/middle/fold.rs
+++ b/src/comp/middle/fold.rs
@@ -166,7 +166,8 @@ type ast_fold[ENV] =
&ast._mod m, def_id id) -> @item) fold_item_mod,
(fn(&ENV e, &span sp, ident ident,
- @ty t, def_id id, ann a) -> @item) fold_item_ty,
+ @ty t, vec[ast.ty_param] ty_params,
+ def_id id, ann a) -> @item) fold_item_ty,
(fn(&ENV e, &span sp, ident ident,
vec[ast.variant] variants,
@@ -550,9 +551,9 @@ fn fold_item[ENV](&ENV env, ast_fold[ENV] fld, @item i) -> @item {
ret fld.fold_item_mod(env_, i.span, ident, mm_, id);
}
- case (ast.item_ty(?ident, ?ty, ?id, ?ann)) {
+ case (ast.item_ty(?ident, ?ty, ?params, ?id, ?ann)) {
let @ast.ty ty_ = fold_ty[ENV](env_, fld, ty);
- ret fld.fold_item_ty(env_, i.span, ident, ty_, id, ann);
+ ret fld.fold_item_ty(env_, i.span, ident, ty_, params, id, ann);
}
case (ast.item_tag(?ident, ?variants, ?ty_params, ?id)) {
@@ -813,8 +814,9 @@ fn identity_fold_item_mod[ENV](&ENV e, &span sp, ident i,
}
fn identity_fold_item_ty[ENV](&ENV e, &span sp, ident i,
- @ty t, def_id id, ann a) -> @item {
- ret @respan(sp, ast.item_ty(i, t, id, a));
+ @ty t, vec[ast.ty_param] ty_params,
+ def_id id, ann a) -> @item {
+ ret @respan(sp, ast.item_ty(i, t, ty_params, id, a));
}
fn identity_fold_item_tag[ENV](&ENV e, &span sp, ident i,
@@ -941,7 +943,7 @@ fn new_identity_fold[ENV]() -> ast_fold[ENV] {
fold_item_fn = bind identity_fold_item_fn[ENV](_,_,_,_,_,_,_),
fold_item_mod = bind identity_fold_item_mod[ENV](_,_,_,_,_),
- fold_item_ty = bind identity_fold_item_ty[ENV](_,_,_,_,_,_),
+ fold_item_ty = bind identity_fold_item_ty[ENV](_,_,_,_,_,_,_),
fold_item_tag = bind identity_fold_item_tag[ENV](_,_,_,_,_,_),
fold_block = bind identity_fold_block[ENV](_,_,_),
diff --git a/src/comp/middle/resolve.rs b/src/comp/middle/resolve.rs
index f3957b3b..ed4d6c04 100644
--- a/src/comp/middle/resolve.rs
+++ b/src/comp/middle/resolve.rs
@@ -35,7 +35,7 @@ fn lookup_name(&env e, ast.ident i) -> option.t[def] {
case (ast.item_mod(_, _, ?id)) {
ret some[def](ast.def_mod(id));
}
- case (ast.item_ty(_, _, ?id, _)) {
+ case (ast.item_ty(_, _, _, ?id, _)) {
ret some[def](ast.def_ty(id));
}
}
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs
index 530bdc06..9c66895d 100644
--- a/src/comp/middle/typeck.rs
+++ b/src/comp/middle/typeck.rs
@@ -326,7 +326,7 @@ fn collect_item_types(@ast.crate crate) -> tup(@ast.crate, @ty_table) {
ret t_fn;
}
- case (ast.item_ty(?ident, ?referent_ty, ?def_id, _)) {
+ case (ast.item_ty(?ident, ?referent_ty, _, ?def_id, _)) {
if (item_to_ty.contains_key(def_id)) {
// Avoid repeating work.
check (item_to_ty.contains_key(def_id));
@@ -351,7 +351,7 @@ fn collect_item_types(@ast.crate crate) -> tup(@ast.crate, @ty_table) {
auto id_to_ty_item = @common.new_def_hash[@ast.item]();
for (@ast.item item in module.items) {
alt (item.node) {
- case (ast.item_ty(_, _, ?def_id, _)) {
+ case (ast.item_ty(_, _, _, ?def_id, _)) {
id_to_ty_item.insert(def_id, item);
}
case (_) { /* empty */ }
@@ -371,10 +371,10 @@ fn collect_item_types(@ast.crate crate) -> tup(@ast.crate, @ty_table) {
result = ast.item_fn(ident, fn_info, tps, def_id,
ast.ann_type(t));
}
- case (ast.item_ty(?ident, ?referent_ty, ?def_id, _)) {
+ case (ast.item_ty(?ident, ?referent_ty, ?tps, ?def_id, _)) {
auto t = trans_ty_item_to_ty(id_to_ty_item, item_to_ty, it);
auto ann = ast.ann_type(t);
- result = ast.item_ty(ident, referent_ty, def_id, ann);
+ result = ast.item_ty(ident, referent_ty, tps, def_id, ann);
}
case (ast.item_mod(_, _, _)) {
result = it.node;