rustc: Assign definition IDs to type params
This commit is contained in:
parent
9769b61226
commit
78ec07790a
2 changed files with 8 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue