[StableMIR] API to retrieve definitions from crates
Add functions to retrieve function definitions and static items from all crates (local and external). For external crates, add a query to retrieve the number of defs in a foreign crate.
This commit is contained in:
@@ -34,6 +34,12 @@ pub trait Context {
|
||||
/// Check whether the body of a function is available.
|
||||
fn has_body(&self, item: DefId) -> bool;
|
||||
fn foreign_modules(&self, crate_num: CrateNum) -> Vec<ForeignModuleDef>;
|
||||
|
||||
/// Retrieve all functions defined in this crate.
|
||||
fn crate_functions(&self, crate_num: CrateNum) -> Vec<FnDef>;
|
||||
|
||||
/// Retrieve all static items defined in this crate.
|
||||
fn crate_statics(&self, crate_num: CrateNum) -> Vec<StaticDef>;
|
||||
fn foreign_module(&self, mod_def: ForeignModuleDef) -> ForeignModule;
|
||||
fn foreign_items(&self, mod_def: ForeignModuleDef) -> Vec<ForeignDef>;
|
||||
fn all_trait_decls(&self) -> TraitDecls;
|
||||
|
||||
Reference in New Issue
Block a user