diff options
Diffstat (limited to 'crates/ra_hir/src/code_model_api.rs')
-rw-r--r-- | crates/ra_hir/src/code_model_api.rs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs index d4244f70c..91b235594 100644 --- a/crates/ra_hir/src/code_model_api.rs +++ b/crates/ra_hir/src/code_model_api.rs | |||
@@ -113,6 +113,11 @@ impl Module { | |||
113 | self.child_impl(db, name) | 113 | self.child_impl(db, name) |
114 | } | 114 | } |
115 | 115 | ||
116 | /// Iterates over all child modules. | ||
117 | pub fn children(&self, db: &impl HirDatabase) -> Cancelable<impl Iterator<Item = Module>> { | ||
118 | self.children_impl(db) | ||
119 | } | ||
120 | |||
116 | /// Finds a parent module. | 121 | /// Finds a parent module. |
117 | pub fn parent(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { | 122 | pub fn parent(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { |
118 | self.parent_impl(db) | 123 | self.parent_impl(db) |
@@ -268,8 +273,11 @@ pub use crate::code_model_impl::function::ScopeEntryWithSyntax; | |||
268 | #[derive(Debug, Clone, PartialEq, Eq)] | 273 | #[derive(Debug, Clone, PartialEq, Eq)] |
269 | pub struct FnSignature { | 274 | pub struct FnSignature { |
270 | pub(crate) name: Name, | 275 | pub(crate) name: Name, |
271 | pub(crate) args: Vec<TypeRef>, | 276 | pub(crate) params: Vec<TypeRef>, |
272 | pub(crate) ret_type: TypeRef, | 277 | pub(crate) ret_type: TypeRef, |
278 | /// True if the first param is `self`. This is relevant to decide whether this | ||
279 | /// can be called as a method. | ||
280 | pub(crate) has_self_param: bool, | ||
273 | } | 281 | } |
274 | 282 | ||
275 | impl FnSignature { | 283 | impl FnSignature { |
@@ -277,13 +285,19 @@ impl FnSignature { | |||
277 | &self.name | 285 | &self.name |
278 | } | 286 | } |
279 | 287 | ||
280 | pub fn args(&self) -> &[TypeRef] { | 288 | pub fn params(&self) -> &[TypeRef] { |
281 | &self.args | 289 | &self.params |
282 | } | 290 | } |
283 | 291 | ||
284 | pub fn ret_type(&self) -> &TypeRef { | 292 | pub fn ret_type(&self) -> &TypeRef { |
285 | &self.ret_type | 293 | &self.ret_type |
286 | } | 294 | } |
295 | |||
296 | /// True if the first arg is `self`. This is relevant to decide whether this | ||
297 | /// can be called as a method. | ||
298 | pub fn has_self_param(&self) -> bool { | ||
299 | self.has_self_param | ||
300 | } | ||
287 | } | 301 | } |
288 | 302 | ||
289 | impl Function { | 303 | impl Function { |