ident->name in NamedField, elsewhere
This commit is contained in:
parent
9ab2cfdae6
commit
d9ba61c786
@ -788,7 +788,7 @@ impl BorrowckCtxt {
|
||||
match fname {
|
||||
mc::NamedField(ref fname) => {
|
||||
out.push_char('.');
|
||||
out.push_str(token::ident_to_str(fname));
|
||||
out.push_str(token::interner_get(*fname));
|
||||
}
|
||||
mc::PositionalField(idx) => {
|
||||
out.push_char('#'); // invent a notation here
|
||||
|
@ -81,7 +81,7 @@ pub fn find_entry_point(session: Session, crate: &Crate, ast_map: ast_map::map)
|
||||
fn find_item(item: @item, ctxt: @mut EntryContext, visitor: &mut EntryVisitor) {
|
||||
match item.node {
|
||||
item_fn(*) => {
|
||||
if item.ident == special_idents::main {
|
||||
if item.ident.name == special_idents::main.name {
|
||||
match ctxt.ast_map.find(&item.id) {
|
||||
Some(&ast_map::node_item(_, path)) => {
|
||||
if path.len() == 0 {
|
||||
|
@ -56,6 +56,7 @@ use syntax::ast::{MutImmutable, MutMutable};
|
||||
use syntax::ast;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::print::pprust;
|
||||
use syntax::parse::token;
|
||||
|
||||
#[deriving(Eq)]
|
||||
pub enum categorization {
|
||||
@ -99,7 +100,7 @@ pub enum InteriorKind {
|
||||
|
||||
#[deriving(Eq, IterBytes)]
|
||||
pub enum FieldName {
|
||||
NamedField(ast::Ident),
|
||||
NamedField(ast::Name),
|
||||
PositionalField(uint)
|
||||
}
|
||||
|
||||
@ -619,7 +620,7 @@ impl mem_categorization_ctxt {
|
||||
@cmt_ {
|
||||
id: node.id(),
|
||||
span: node.span(),
|
||||
cat: cat_interior(base_cmt, InteriorField(NamedField(f_name))),
|
||||
cat: cat_interior(base_cmt, InteriorField(NamedField(f_name.name))),
|
||||
mutbl: base_cmt.mutbl.inherit(),
|
||||
ty: f_ty
|
||||
}
|
||||
@ -1224,9 +1225,9 @@ pub fn ptr_sigil(ptr: PointerKind) -> ~str {
|
||||
}
|
||||
|
||||
impl Repr for InteriorKind {
|
||||
fn repr(&self, tcx: ty::ctxt) -> ~str {
|
||||
fn repr(&self, _tcx: ty::ctxt) -> ~str {
|
||||
match *self {
|
||||
InteriorField(NamedField(fld)) => tcx.sess.str_of(fld).to_owned(),
|
||||
InteriorField(NamedField(fld)) => token::interner_get(fld).to_owned(),
|
||||
InteriorField(PositionalField(i)) => fmt!("#%?", i),
|
||||
InteriorElement(_) => ~"[]",
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ impl VisitContext {
|
||||
// specified and (2) have a type that
|
||||
// moves-by-default:
|
||||
let consume_with = with_fields.iter().any(|tf| {
|
||||
!fields.iter().any(|f| f.ident == tf.ident) &&
|
||||
!fields.iter().any(|f| f.ident.name == tf.ident.name) &&
|
||||
ty::type_moves_by_default(self.tcx, tf.mt.ty)
|
||||
});
|
||||
|
||||
|
@ -206,7 +206,7 @@ impl PrivacyVisitor {
|
||||
fn check_field(&mut self, span: Span, id: ast::DefId, ident: ast::Ident) {
|
||||
let fields = ty::lookup_struct_fields(self.tcx, id);
|
||||
for field in fields.iter() {
|
||||
if field.ident != ident { loop; }
|
||||
if field.ident.name != ident.name { loop; }
|
||||
if field.vis == private {
|
||||
self.tcx.sess.span_err(span, fmt!("field `%s` is private",
|
||||
token::ident_to_str(&ident)));
|
||||
|
Loading…
Reference in New Issue
Block a user