mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-12 08:36:03 +00:00
alpha-rename .ident to .name in Lifetime, including in rustdoc.
This commit is contained in:
parent
460ca4f037
commit
189c0085d1
@ -145,7 +145,7 @@ impl<'a> Visitor<&'a ScopeChain<'a>> for LifetimeContext {
|
||||
fn visit_lifetime_ref(&mut self,
|
||||
lifetime_ref: &ast::Lifetime,
|
||||
scope: &'a ScopeChain<'a>) {
|
||||
if lifetime_ref.ident == special_idents::statik.name {
|
||||
if lifetime_ref.name == special_idents::statik.name {
|
||||
self.insert_lifetime(lifetime_ref, ast::DefStaticRegion);
|
||||
return;
|
||||
}
|
||||
@ -262,7 +262,7 @@ impl LifetimeContext {
|
||||
self.sess.span_err(
|
||||
lifetime_ref.span,
|
||||
format!("use of undeclared lifetime name `'{}`",
|
||||
token::get_name(lifetime_ref.ident)));
|
||||
token::get_name(lifetime_ref.name)));
|
||||
}
|
||||
|
||||
fn check_lifetime_names(&self, lifetimes: &OptVec<ast::Lifetime>) {
|
||||
@ -271,23 +271,23 @@ impl LifetimeContext {
|
||||
|
||||
let special_idents = [special_idents::statik];
|
||||
for lifetime in lifetimes.iter() {
|
||||
if special_idents.iter().any(|&i| i.name == lifetime.ident) {
|
||||
if special_idents.iter().any(|&i| i.name == lifetime.name) {
|
||||
self.sess.span_err(
|
||||
lifetime.span,
|
||||
format!("illegal lifetime parameter name: `{}`",
|
||||
token::get_name(lifetime.ident)));
|
||||
token::get_name(lifetime.name)));
|
||||
}
|
||||
}
|
||||
|
||||
for j in range(i + 1, lifetimes.len()) {
|
||||
let lifetime_j = lifetimes.get(j);
|
||||
|
||||
if lifetime_i.ident == lifetime_j.ident {
|
||||
if lifetime_i.name == lifetime_j.name {
|
||||
self.sess.span_err(
|
||||
lifetime_j.span,
|
||||
format!("lifetime name `'{}` declared twice in \
|
||||
the same scope",
|
||||
token::get_name(lifetime_j.ident)));
|
||||
token::get_name(lifetime_j.name)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -315,7 +315,7 @@ fn search_lifetimes(lifetimes: &OptVec<ast::Lifetime>,
|
||||
lifetime_ref: &ast::Lifetime)
|
||||
-> Option<(uint, ast::NodeId)> {
|
||||
for (i, lifetime_decl) in lifetimes.iter().enumerate() {
|
||||
if lifetime_decl.ident == lifetime_ref.ident {
|
||||
if lifetime_decl.name == lifetime_ref.name {
|
||||
return Some((i, lifetime_decl.id));
|
||||
}
|
||||
}
|
||||
|
@ -92,18 +92,18 @@ pub fn ast_region_to_region(tcx: ty::ctxt, lifetime: &ast::Lifetime)
|
||||
|
||||
Some(&ast::DefLateBoundRegion(binder_id, _, id)) => {
|
||||
ty::ReLateBound(binder_id, ty::BrNamed(ast_util::local_def(id),
|
||||
lifetime.ident))
|
||||
lifetime.name))
|
||||
}
|
||||
|
||||
Some(&ast::DefEarlyBoundRegion(index, id)) => {
|
||||
ty::ReEarlyBound(id, index, lifetime.ident)
|
||||
ty::ReEarlyBound(id, index, lifetime.name)
|
||||
}
|
||||
|
||||
Some(&ast::DefFreeRegion(scope_id, id)) => {
|
||||
ty::ReFree(ty::FreeRegion {
|
||||
scope_id: scope_id,
|
||||
bound_region: ty::BrNamed(ast_util::local_def(id),
|
||||
lifetime.ident)
|
||||
lifetime.name)
|
||||
})
|
||||
}
|
||||
};
|
||||
|
@ -966,7 +966,7 @@ pub fn ty_generics(ccx: &CrateCtxt,
|
||||
base_index: uint) -> ty::Generics {
|
||||
return ty::Generics {
|
||||
region_param_defs: Rc::new(generics.lifetimes.iter().map(|l| {
|
||||
ty::RegionParameterDef { name: l.ident,
|
||||
ty::RegionParameterDef { name: l.name,
|
||||
def_id: local_def(l.id) }
|
||||
}).collect()),
|
||||
type_param_defs: Rc::new(generics.ty_params.mapi_to_vec(|offset, param| {
|
||||
|
@ -161,8 +161,8 @@ pub fn bound_region_to_str(cx: ctxt,
|
||||
}
|
||||
|
||||
match br {
|
||||
BrNamed(_, ident) => format!("{}'{}{}", prefix,
|
||||
token::get_name(ident), space_str),
|
||||
BrNamed(_, name) => format!("{}'{}{}", prefix,
|
||||
token::get_name(name), space_str),
|
||||
BrAnon(_) => prefix.to_str(),
|
||||
BrFresh(_) => prefix.to_str(),
|
||||
}
|
||||
@ -224,7 +224,7 @@ pub fn region_to_str(cx: ctxt, prefix: &str, space: bool, region: Region) -> ~st
|
||||
// `explain_region()` or `note_and_explain_region()`.
|
||||
match region {
|
||||
ty::ReScope(_) => prefix.to_str(),
|
||||
ty::ReEarlyBound(_, _, ident) => token::get_name(ident).get().to_str(),
|
||||
ty::ReEarlyBound(_, _, name) => token::get_name(name).get().to_str(),
|
||||
ty::ReLateBound(_, br) => bound_region_to_str(cx, prefix, space, br),
|
||||
ty::ReFree(ref fr) => bound_region_to_str(cx, prefix, space, fr.bound_region),
|
||||
ty::ReInfer(ReSkolemized(_, br)) => {
|
||||
@ -720,9 +720,9 @@ impl Repr for ty::BoundRegion {
|
||||
fn repr(&self, tcx: ctxt) -> ~str {
|
||||
match *self {
|
||||
ty::BrAnon(id) => format!("BrAnon({})", id),
|
||||
ty::BrNamed(id, ident) => format!("BrNamed({}, {})",
|
||||
ty::BrNamed(id, name) => format!("BrNamed({}, {})",
|
||||
id.repr(tcx),
|
||||
token::get_name(ident)),
|
||||
token::get_name(name)),
|
||||
ty::BrFresh(id) => format!("BrFresh({})", id),
|
||||
}
|
||||
}
|
||||
@ -731,9 +731,9 @@ impl Repr for ty::BoundRegion {
|
||||
impl Repr for ty::Region {
|
||||
fn repr(&self, tcx: ctxt) -> ~str {
|
||||
match *self {
|
||||
ty::ReEarlyBound(id, index, ident) => {
|
||||
ty::ReEarlyBound(id, index, name) => {
|
||||
format!("ReEarlyBound({}, {}, {})",
|
||||
id, index, token::get_name(ident))
|
||||
id, index, token::get_name(name))
|
||||
}
|
||||
|
||||
ty::ReLateBound(binder_id, ref bound_region) => {
|
||||
|
@ -333,7 +333,7 @@ impl Lifetime {
|
||||
|
||||
impl Clean<Lifetime> for ast::Lifetime {
|
||||
fn clean(&self) -> Lifetime {
|
||||
Lifetime(token::get_name(self.ident).get().to_owned())
|
||||
Lifetime(token::get_name(self.name).get().to_owned())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ pub type FnIdent = Option<Ident>;
|
||||
pub struct Lifetime {
|
||||
id: NodeId,
|
||||
span: Span,
|
||||
ident: Name
|
||||
name: Name
|
||||
}
|
||||
|
||||
// a "Path" is essentially Rust's notion of a name;
|
||||
|
@ -413,8 +413,8 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||
ast::TraitTyParamBound(self.trait_ref(path))
|
||||
}
|
||||
|
||||
fn lifetime(&self, span: Span, ident: ast::Name) -> ast::Lifetime {
|
||||
ast::Lifetime { id: ast::DUMMY_NODE_ID, span: span, ident: ident }
|
||||
fn lifetime(&self, span: Span, name: ast::Name) -> ast::Lifetime {
|
||||
ast::Lifetime { id: ast::DUMMY_NODE_ID, span: span, name: name }
|
||||
}
|
||||
|
||||
fn stmt_expr(&self, expr: @ast::Expr) -> @ast::Stmt {
|
||||
|
@ -435,7 +435,7 @@ pub fn fold_lifetime<T: Folder>(l: &Lifetime, fld: &mut T) -> Lifetime {
|
||||
Lifetime {
|
||||
id: fld.new_id(l.id),
|
||||
span: fld.new_span(l.span),
|
||||
ident: l.ident
|
||||
name: l.name
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ mod test {
|
||||
segments: vec!(
|
||||
ast::PathSegment {
|
||||
identifier: str_to_ident("a"),
|
||||
lifetimes: opt_vec::Empty,
|
||||
lifetimes: Vec::new(),
|
||||
types: opt_vec::Empty,
|
||||
}
|
||||
),
|
||||
@ -342,12 +342,12 @@ mod test {
|
||||
segments: vec!(
|
||||
ast::PathSegment {
|
||||
identifier: str_to_ident("a"),
|
||||
lifetimes: opt_vec::Empty,
|
||||
lifetimes: Vec::new(),
|
||||
types: opt_vec::Empty,
|
||||
},
|
||||
ast::PathSegment {
|
||||
identifier: str_to_ident("b"),
|
||||
lifetimes: opt_vec::Empty,
|
||||
lifetimes: Vec::new(),
|
||||
types: opt_vec::Empty,
|
||||
}
|
||||
)
|
||||
|
@ -1609,7 +1609,7 @@ impl Parser {
|
||||
return ast::Lifetime {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
span: span,
|
||||
ident: i.name
|
||||
name: i.name
|
||||
};
|
||||
}
|
||||
_ => {
|
||||
|
@ -1956,7 +1956,7 @@ pub fn print_bounds(s: &mut State, bounds: &OptVec<ast::TyParamBound>,
|
||||
pub fn print_lifetime(s: &mut State,
|
||||
lifetime: &ast::Lifetime) -> io::IoResult<()> {
|
||||
try!(word(&mut s.s, "'"));
|
||||
print_name(s, lifetime.ident)
|
||||
print_name(s, lifetime.name)
|
||||
}
|
||||
|
||||
pub fn print_generics(s: &mut State,
|
||||
|
Loading…
Reference in New Issue
Block a user