aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/resolve.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/resolve.rs')
-rw-r--r--crates/ra_hir/src/resolve.rs32
1 files changed, 31 insertions, 1 deletions
diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs
index 41fcb35bc..b7fbf6df2 100644
--- a/crates/ra_hir/src/resolve.rs
+++ b/crates/ra_hir/src/resolve.rs
@@ -15,7 +15,7 @@ use crate::{
15 path::Path, 15 path::Path,
16}; 16};
17 17
18#[derive(Debug, Clone)] 18#[derive(Debug, Clone, Default)]
19pub struct Resolver { 19pub struct Resolver {
20 scopes: Vec<Scope>, // maybe a 'linked list' of scopes? or allow linking a Resolver to a parent Resolver? that's an optimization that might not be necessary, though 20 scopes: Vec<Scope>, // maybe a 'linked list' of scopes? or allow linking a Resolver to a parent Resolver? that's an optimization that might not be necessary, though
21} 21}
@@ -87,6 +87,36 @@ impl Resolver {
87 self 87 self
88 } 88 }
89 89
90 pub(crate) fn push_generic_params_scope(self, params: Arc<GenericParams>) -> Resolver {
91 self.push_scope(Scope::GenericParams(params))
92 }
93
94 pub(crate) fn push_impl_block_scope(self, impl_block: ImplBlock) -> Resolver {
95 self.push_scope(Scope::ImplBlockScope(impl_block))
96 }
97
98 pub(crate) fn push_module_scope(self, item_map: Arc<ItemMap>, module_id: ModuleId) -> Resolver {
99 self.push_scope(Scope::ModuleScope(ModuleItemMap {
100 item_map,
101 module_id,
102 }))
103 }
104
105 pub(crate) fn push_expr_scope(
106 self,
107 expr_scopes: Arc<ExprScopes>,
108 scope_id: ScopeId,
109 ) -> Resolver {
110 self.push_scope(Scope::ExprScope(ExprScope {
111 expr_scopes,
112 scope_id,
113 }))
114 }
115
116 pub(crate) fn push_function_params(self, body: Arc<Body>) -> Resolver {
117 self.push_scope(Scope::FunctionParams(body))
118 }
119
90 pub(crate) fn pop_scope(mut self) -> Resolver { 120 pub(crate) fn pop_scope(mut self) -> Resolver {
91 self.scopes.pop(); 121 self.scopes.pop();
92 self 122 self