rustc: Assign definition IDs to type params

This commit is contained in:
Patrick Walton 2010-11-24 18:01:20 -08:00
parent 9769b61226
commit 78ec07790a
2 changed files with 8 additions and 2 deletions

View file

@ -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;

View file

@ -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;
}