use util::nodemap::{NodeMap, DefIdMap};
use syntax::codemap::Span;
use syntax::{attr, visit};
+use syntax::ast;
use syntax::ast::{Attribute, Block, Crate, DefId, FnDecl, NodeId, Variant};
use syntax::ast::{Item, Required, Provided, TraitMethod, TypeMethod, Method};
-use syntax::ast::{Generics, StructDef, Ident};
+use syntax::ast::{Generics, StructDef, StructField, Ident};
use syntax::ast_util::is_local;
use syntax::attr::Stability;
use syntax::visit::{FnKind, FkMethod, Visitor};
s.ctor_id.map(|id| self.annotate(id, &[], parent.clone()));
visit::walk_struct_def(self, s, parent)
}
+
+ fn visit_struct_field(&mut self, s: &StructField, parent: Option<Stability>) {
+ let stab = self.annotate(s.node.id, s.node.attrs.as_slice(), parent);
+ visit::walk_struct_field(self, s, stab)
+ }
}
impl Index {
extern_cache: DefIdMap::new()
}
};
- visit::walk_crate(&mut annotator, krate,
- attr::find_stability(krate.attrs.as_slice()));
+ let stab = annotator.annotate(ast::CRATE_NODE_ID, krate.attrs.as_slice(), None);
+ visit::walk_crate(&mut annotator, krate, stab);
annotator.index
}
}
name: Some(name.clean()),
attrs: Vec::new(),
visibility: Some(ast::Public),
- stability: get_stability(self.id),
// FIXME: this is not accurate, we need an id for
// the specific field but we're using the id
- // for the whole variant. Nothing currently
- // uses this so we should be good for now.
+ // for the whole variant. Thus we read the
+ // stability from the whole variant as well.
+ // Struct variants are experimental and need
+ // more infrastructure work before we can get
+ // at the needed information here.
def_id: self.id,
+ stability: get_stability(self.id),
inner: StructFieldItem(
TypedStructField(ty.clean())
)
visibility: Some(ast::Public),
def_id: self.id,
inner: VariantItem(Variant { kind: kind }),
- stability: None,
+ stability: get_stability(self.id),
}
}
}
source: self.span.clean(),
def_id: ast_util::local_def(self.id),
visibility: self.vis.clean(),
- stability: None,
+ stability: get_stability(ast_util::local_def(self.id)),
inner: inner,
}
}