change ast::ty_param into a struct.
This commit is contained in:
parent
df7d376d25
commit
e1f1a1204a
6 changed files with 14 additions and 10 deletions
|
@ -121,7 +121,11 @@ enum ty_param_bound {
|
||||||
|
|
||||||
#[auto_encode]
|
#[auto_encode]
|
||||||
#[auto_decode]
|
#[auto_decode]
|
||||||
type ty_param = {ident: ident, id: node_id, bounds: @~[ty_param_bound]};
|
struct ty_param {
|
||||||
|
ident: ident,
|
||||||
|
id: node_id,
|
||||||
|
bounds: @~[ty_param_bound]
|
||||||
|
}
|
||||||
|
|
||||||
#[auto_encode]
|
#[auto_encode]
|
||||||
#[auto_decode]
|
#[auto_decode]
|
||||||
|
|
|
@ -251,7 +251,7 @@ priv impl ext_ctxt {
|
||||||
span: span,
|
span: span,
|
||||||
});
|
});
|
||||||
|
|
||||||
{
|
ast::ty_param {
|
||||||
ident: ident,
|
ident: ident,
|
||||||
id: self.next_id(),
|
id: self.next_id(),
|
||||||
bounds: @vec::append(~[bound], *bounds)
|
bounds: @vec::append(~[bound], *bounds)
|
||||||
|
@ -425,7 +425,7 @@ fn mk_impl(
|
||||||
span: span,
|
span: span,
|
||||||
});
|
});
|
||||||
|
|
||||||
{
|
ast::ty_param {
|
||||||
ident: tp.ident,
|
ident: tp.ident,
|
||||||
id: cx.next_id(),
|
id: cx.next_id(),
|
||||||
bounds: @vec::append(~[t_bound], *tp.bounds)
|
bounds: @vec::append(~[t_bound], *tp.bounds)
|
||||||
|
|
|
@ -313,6 +313,6 @@ fn mk_ty_param(cx: ext_ctxt,
|
||||||
ident: ast::ident,
|
ident: ast::ident,
|
||||||
bounds: @~[ast::ty_param_bound])
|
bounds: @~[ast::ty_param_bound])
|
||||||
-> ast::ty_param {
|
-> ast::ty_param {
|
||||||
{ ident: ident, id: cx.next_id(), bounds: bounds }
|
ast::ty_param { ident: ident, id: cx.next_id(), bounds: bounds }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ impl ext_ctxt: ext_ctxt_ast_builder {
|
||||||
fn ty_param(id: ast::ident, +bounds: ~[ast::ty_param_bound])
|
fn ty_param(id: ast::ident, +bounds: ~[ast::ty_param_bound])
|
||||||
-> ast::ty_param
|
-> ast::ty_param
|
||||||
{
|
{
|
||||||
{ident: id, id: self.next_id(), bounds: @bounds}
|
ast::ty_param { ident: id, id: self.next_id(), bounds: @bounds }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn arg(name: ident, ty: @ast::Ty) -> ast::arg {
|
fn arg(name: ident, ty: @ast::Ty) -> ast::arg {
|
||||||
|
|
|
@ -148,13 +148,13 @@ fn fold_ty_param_bound(tpb: ty_param_bound, fld: ast_fold) -> ty_param_bound {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fold_ty_param(tp: ty_param, fld: ast_fold) -> ty_param {
|
fn fold_ty_param(tp: ty_param, fld: ast_fold) -> ty_param {
|
||||||
{ident: /* FIXME (#2543) */ copy tp.ident,
|
ast::ty_param { ident: /* FIXME (#2543) */ copy tp.ident,
|
||||||
id: fld.new_id(tp.id),
|
id: fld.new_id(tp.id),
|
||||||
bounds: @vec::map(*tp.bounds, |x| fold_ty_param_bound(*x, fld) )}
|
bounds: @tp.bounds.map(|x| fold_ty_param_bound(*x, fld) )}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fold_ty_params(tps: ~[ty_param], fld: ast_fold) -> ~[ty_param] {
|
fn fold_ty_params(tps: ~[ty_param], fld: ast_fold) -> ~[ty_param] {
|
||||||
vec::map(tps, |x| fold_ty_param(*x, fld) )
|
tps.map(|x| fold_ty_param(*x, fld))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn noop_fold_crate(c: crate_, fld: ast_fold) -> crate_ {
|
fn noop_fold_crate(c: crate_, fld: ast_fold) -> crate_ {
|
||||||
|
|
|
@ -2458,7 +2458,7 @@ impl Parser {
|
||||||
fn parse_ty_param() -> ty_param {
|
fn parse_ty_param() -> ty_param {
|
||||||
let ident = self.parse_ident();
|
let ident = self.parse_ident();
|
||||||
let bounds = self.parse_optional_ty_param_bounds();
|
let bounds = self.parse_optional_ty_param_bounds();
|
||||||
return {ident: ident, id: self.get_id(), bounds: bounds};
|
ast::ty_param { ident: ident, id: self.get_id(), bounds: bounds }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_ty_params() -> ~[ty_param] {
|
fn parse_ty_params() -> ~[ty_param] {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue