1
Fork 0

Generalize AST and ty::Generics to accept multiple lifetimes.

This commit is contained in:
Niko Matsakis 2013-10-29 06:03:32 -04:00
parent 85c51d3b02
commit 1f4faaee40
52 changed files with 1510 additions and 1454 deletions

View file

@ -38,7 +38,7 @@ pub trait AstBuilder {
fn path_all(&self, sp: Span,
global: bool,
idents: ~[ast::Ident],
rp: Option<ast::Lifetime>,
lifetimes: OptVec<ast::Lifetime>,
types: ~[ast::Ty])
-> ast::Path;
@ -237,19 +237,19 @@ pub trait AstBuilder {
impl AstBuilder for @ExtCtxt {
fn path(&self, span: Span, strs: ~[ast::Ident]) -> ast::Path {
self.path_all(span, false, strs, None, ~[])
self.path_all(span, false, strs, opt_vec::Empty, ~[])
}
fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path {
self.path(span, ~[id])
}
fn path_global(&self, span: Span, strs: ~[ast::Ident]) -> ast::Path {
self.path_all(span, true, strs, None, ~[])
self.path_all(span, true, strs, opt_vec::Empty, ~[])
}
fn path_all(&self,
sp: Span,
global: bool,
mut idents: ~[ast::Ident],
rp: Option<ast::Lifetime>,
lifetimes: OptVec<ast::Lifetime>,
types: ~[ast::Ty])
-> ast::Path {
let last_identifier = idents.pop();
@ -257,13 +257,13 @@ impl AstBuilder for @ExtCtxt {
.map(|ident| {
ast::PathSegment {
identifier: ident,
lifetime: None,
lifetimes: opt_vec::Empty,
types: opt_vec::Empty,
}
}).collect();
segments.push(ast::PathSegment {
identifier: last_identifier,
lifetime: rp,
lifetimes: lifetimes,
types: opt_vec::from(types),
});
ast::Path {
@ -327,7 +327,7 @@ impl AstBuilder for @ExtCtxt {
self.ident_of("option"),
self.ident_of("Option")
],
None,
opt_vec::Empty,
~[ ty ]), None)
}