diff options
author | Aleksey Kladov <[email protected]> | 2019-01-04 22:37:40 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-06 14:35:29 +0000 |
commit | 147b0f94e60f66c73ee1ca1726de97d76721bfda (patch) | |
tree | 7eca3e190d1de5b3c431585c8c554f03e7f26bb8 /crates/ra_hir/src/module.rs | |
parent | 9a820dc0ee23051137e4909d4698fe71930c04bc (diff) |
Start code_model::Module
Diffstat (limited to 'crates/ra_hir/src/module.rs')
-rw-r--r-- | crates/ra_hir/src/module.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_hir/src/module.rs b/crates/ra_hir/src/module.rs index b9821115c..f0b673908 100644 --- a/crates/ra_hir/src/module.rs +++ b/crates/ra_hir/src/module.rs | |||
@@ -224,7 +224,7 @@ impl ModuleTree { | |||
224 | /// `ModuleSource` is the syntax tree element that produced this module: | 224 | /// `ModuleSource` is the syntax tree element that produced this module: |
225 | /// either a file, or an inlinde module. | 225 | /// either a file, or an inlinde module. |
226 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] | 226 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] |
227 | pub struct ModuleSource(SourceItemId); | 227 | pub struct ModuleSource(pub(crate) SourceItemId); |
228 | 228 | ||
229 | /// An owned syntax node for a module. Unlike `ModuleSource`, | 229 | /// An owned syntax node for a module. Unlike `ModuleSource`, |
230 | /// this holds onto the AST for the whole file. | 230 | /// this holds onto the AST for the whole file. |
@@ -255,12 +255,12 @@ impl ModuleId { | |||
255 | let link = self.parent_link(tree)?; | 255 | let link = self.parent_link(tree)?; |
256 | Some(tree.links[link].owner) | 256 | Some(tree.links[link].owner) |
257 | } | 257 | } |
258 | fn crate_root(self, tree: &ModuleTree) -> ModuleId { | 258 | pub(crate) fn crate_root(self, tree: &ModuleTree) -> ModuleId { |
259 | generate(Some(self), move |it| it.parent(tree)) | 259 | generate(Some(self), move |it| it.parent(tree)) |
260 | .last() | 260 | .last() |
261 | .unwrap() | 261 | .unwrap() |
262 | } | 262 | } |
263 | fn child(self, tree: &ModuleTree, name: &Name) -> Option<ModuleId> { | 263 | pub(crate) fn child(self, tree: &ModuleTree, name: &Name) -> Option<ModuleId> { |
264 | let link = tree.mods[self] | 264 | let link = tree.mods[self] |
265 | .children | 265 | .children |
266 | .iter() | 266 | .iter() |