Avoid calling to_vec() unnecessarily in parser.
Also, rename the OptVec-to-vector conversion method to opt_vec::take_vec() and convert from a method into a fn because I fear strange bugs.
This commit is contained in:
parent
50c08dbf0d
commit
ca9549bdfc
5 changed files with 28 additions and 18 deletions
|
|
@ -460,8 +460,8 @@ fn mk_impl(
|
|||
let ty = cx.ty_path(
|
||||
span,
|
||||
~[ident],
|
||||
generics.ty_params.map(
|
||||
|tp| cx.ty_path(span, ~[tp.ident], ~[])).to_vec()
|
||||
opt_vec::take_vec(generics.ty_params.map(
|
||||
|tp| cx.ty_path(span, ~[tp.ident], ~[])))
|
||||
);
|
||||
|
||||
let generics = ast::Generics {
|
||||
|
|
|
|||
|
|
@ -394,13 +394,15 @@ impl ext_ctxt_ast_builder for ext_ctxt {
|
|||
}
|
||||
|
||||
fn ty_vars(&self, ty_params: &OptVec<ast::TyParam>) -> ~[@ast::Ty] {
|
||||
ty_params.map(|p| self.ty_path_ast_builder(
|
||||
path(~[p.ident], dummy_sp()))).to_vec()
|
||||
opt_vec::take_vec(
|
||||
ty_params.map(|p| self.ty_path_ast_builder(
|
||||
path(~[p.ident], dummy_sp()))))
|
||||
}
|
||||
|
||||
fn ty_vars_global(&self,
|
||||
ty_params: &OptVec<ast::TyParam>) -> ~[@ast::Ty] {
|
||||
ty_params.map(|p| self.ty_path_ast_builder(
|
||||
path(~[p.ident], dummy_sp()))).to_vec()
|
||||
opt_vec::take_vec(
|
||||
ty_params.map(|p| self.ty_path_ast_builder(
|
||||
path(~[p.ident], dummy_sp()))))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue