Add method visibility
to CrateStore
This commit is contained in:
parent
45f0ce71c1
commit
c63054d632
3 changed files with 11 additions and 0 deletions
|
@ -137,6 +137,7 @@ pub trait CrateStore<'tcx> : Any {
|
|||
// item info
|
||||
fn stability(&self, def: DefId) -> Option<attr::Stability>;
|
||||
fn deprecation(&self, def: DefId) -> Option<attr::Deprecation>;
|
||||
fn visibility(&self, def: DefId) -> hir::Visibility;
|
||||
fn closure_kind(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
|
||||
-> ty::ClosureKind;
|
||||
fn closure_ty(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
|
||||
|
@ -302,6 +303,7 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
|
|||
// item info
|
||||
fn stability(&self, def: DefId) -> Option<attr::Stability> { unimplemented!() }
|
||||
fn deprecation(&self, def: DefId) -> Option<attr::Deprecation> { unimplemented!() }
|
||||
fn visibility(&self, def: DefId) -> hir::Visibility { unimplemented!() }
|
||||
fn closure_kind(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
|
||||
-> ty::ClosureKind { unimplemented!() }
|
||||
fn closure_ty(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
|
||||
|
|
|
@ -49,6 +49,11 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
|
|||
decoder::get_deprecation(&cdata, def.index)
|
||||
}
|
||||
|
||||
fn visibility(&self, def: DefId) -> hir::Visibility {
|
||||
let cdata = self.get_crate_data(def.krate);
|
||||
decoder::get_visibility(&cdata, def.index)
|
||||
}
|
||||
|
||||
fn closure_kind(&self, _tcx: &TyCtxt<'tcx>, def_id: DefId) -> ty::ClosureKind
|
||||
{
|
||||
assert!(!def_id.is_local());
|
||||
|
|
|
@ -545,6 +545,10 @@ pub fn get_deprecation(cdata: Cmd, id: DefIndex) -> Option<attr::Deprecation> {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn get_visibility(cdata: Cmd, id: DefIndex) -> hir::Visibility {
|
||||
item_visibility(cdata.lookup_item(id))
|
||||
}
|
||||
|
||||
pub fn get_repr_attrs(cdata: Cmd, id: DefIndex) -> Vec<attr::ReprAttr> {
|
||||
let item = cdata.lookup_item(id);
|
||||
match reader::maybe_get_doc(item, tag_items_data_item_repr).map(|doc| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue