aboutsummaryrefslogtreecommitdiff
path: root/src/comp
diff options
context:
space:
mode:
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/front/ast.rs3
-rw-r--r--src/comp/front/parser.rs7
2 files changed, 8 insertions, 2 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs
index 7da857b4..3c2af3c8 100644
--- a/src/comp/front/ast.rs
+++ b/src/comp/front/ast.rs
@@ -7,7 +7,6 @@ import util.common.spanned;
import util.common.ty_mach;
type ident = str;
-type ty_param = ident;
type name_ = rec(ident ident, vec[@ty] types);
type name = spanned[name_];
@@ -17,6 +16,8 @@ type crate_num = int;
type def_num = int;
type def_id = tup(crate_num, def_num);
+type ty_param = rec(ident ident, def_id id);
+
// Annotations added during successive passes.
tag ann {
ann_none;
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs
index f4874733..261ea1ad 100644
--- a/src/comp/front/parser.rs
+++ b/src/comp/front/parser.rs
@@ -1039,10 +1039,15 @@ impure fn parse_block(parser p) -> ast.block {
ret spanned(stmts.span, stmts.span, b);
}
+impure fn parse_ty_param(parser p) -> ast.ty_param {
+ auto ident = parse_ident(p);
+ ret rec(ident=ident, id=p.next_def_id());
+}
+
impure fn parse_ty_params(parser p) -> vec[ast.ty_param] {
let vec[ast.ty_param] ty_params = vec();
if (p.peek() == token.LBRACKET) {
- auto f = parse_ident; // FIXME: pass as lval directly
+ auto f = parse_ty_param; // FIXME: pass as lval directly
ty_params = parse_seq[ast.ty_param](token.LBRACKET, token.RBRACKET,
some(token.COMMA), f, p).node;
}