diff options
author | Aleksey Kladov <[email protected]> | 2018-09-15 11:38:31 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-09-15 22:00:05 +0100 |
commit | 47be3a3a24de1eb28e1575db1571d934765f6d53 (patch) | |
tree | 6653f5206a482f013fe0a6d4bb6d6dcc259f16fc /crates/libanalysis/src/db | |
parent | 8c737255ff876fc61f8dc8a7d33252476a4b4c8d (diff) |
renames
Diffstat (limited to 'crates/libanalysis/src/db')
-rw-r--r-- | crates/libanalysis/src/db/mod.rs | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/crates/libanalysis/src/db/mod.rs b/crates/libanalysis/src/db/mod.rs index f68aab61c..3198272b7 100644 --- a/crates/libanalysis/src/db/mod.rs +++ b/crates/libanalysis/src/db/mod.rs | |||
@@ -120,38 +120,36 @@ impl<'a> QueryCtx<'a> { | |||
120 | 120 | ||
121 | fn query_config() -> salsa::QueryConfig<State, Data> { | 121 | fn query_config() -> salsa::QueryConfig<State, Data> { |
122 | let mut res = salsa::QueryConfig::new(); | 122 | let mut res = salsa::QueryConfig::new(); |
123 | let queries: Vec<SalsaGroundQuery> = vec![ | 123 | let queries: Vec<BoxedGroundQuery> = vec![ |
124 | queries::FILE_TEXT.into(), | 124 | queries::FILE_TEXT.into(), |
125 | queries::FILE_SET.into(), | 125 | queries::FILE_SET.into(), |
126 | ]; | 126 | ]; |
127 | for q in queries { | 127 | for q in queries { |
128 | res = res.with_ground_query(q.query_type, q.f) | 128 | res = res.with_ground_query(q.query_type, q.f) |
129 | } | 129 | } |
130 | let queries: Vec<SalsaQuery> = vec![ | 130 | let mut queries: Vec<BoxedQuery> = vec![ |
131 | queries::FILE_SYNTAX.into(), | 131 | queries::FILE_SYNTAX.into(), |
132 | ::module_map_db::MODULE_DESCR.into(), | ||
133 | ::module_map_db::RESOLVE_SUBMODULE.into(), | ||
134 | ::module_map_db::PARENT_MODULE.into(), | ||
135 | ]; | 132 | ]; |
133 | ::module_map_db::queries(&mut queries); | ||
136 | for q in queries { | 134 | for q in queries { |
137 | res = res.with_query(q.query_type, q.f); | 135 | res = res.with_query(q.query_type, q.f); |
138 | } | 136 | } |
139 | res | 137 | res |
140 | } | 138 | } |
141 | 139 | ||
142 | struct SalsaGroundQuery { | 140 | struct BoxedGroundQuery { |
143 | query_type: salsa::QueryTypeId, | 141 | query_type: salsa::QueryTypeId, |
144 | f: Box<Fn(&State, &Data) -> (Data, salsa::OutputFingerprint) + Send + Sync + 'static>, | 142 | f: Box<Fn(&State, &Data) -> (Data, salsa::OutputFingerprint) + Send + Sync + 'static>, |
145 | } | 143 | } |
146 | 144 | ||
147 | impl<T, R> From<GroundQuery<T, R>> for SalsaGroundQuery | 145 | impl<T, R> From<GroundQuery<T, R>> for BoxedGroundQuery |
148 | where | 146 | where |
149 | T: Send + Sync + 'static, | 147 | T: Send + Sync + 'static, |
150 | R: Send + Sync + 'static, | 148 | R: Send + Sync + 'static, |
151 | { | 149 | { |
152 | fn from(q: GroundQuery<T, R>) -> SalsaGroundQuery | 150 | fn from(q: GroundQuery<T, R>) -> BoxedGroundQuery |
153 | { | 151 | { |
154 | SalsaGroundQuery { | 152 | BoxedGroundQuery { |
155 | query_type: salsa::QueryTypeId(q.id), | 153 | query_type: salsa::QueryTypeId(q.id), |
156 | f: Box::new(move |state, data| { | 154 | f: Box::new(move |state, data| { |
157 | let data: &T = data.downcast_ref().unwrap(); | 155 | let data: &T = data.downcast_ref().unwrap(); |
@@ -163,19 +161,19 @@ where | |||
163 | } | 161 | } |
164 | } | 162 | } |
165 | 163 | ||
166 | struct SalsaQuery { | 164 | pub(crate) struct BoxedQuery { |
167 | query_type: salsa::QueryTypeId, | 165 | query_type: salsa::QueryTypeId, |
168 | f: Box<Fn(&salsa::QueryCtx<State, Data>, &Data) -> (Data, salsa::OutputFingerprint) + Send + Sync + 'static>, | 166 | f: Box<Fn(&salsa::QueryCtx<State, Data>, &Data) -> (Data, salsa::OutputFingerprint) + Send + Sync + 'static>, |
169 | } | 167 | } |
170 | 168 | ||
171 | impl<T, R> From<Query<T, R>> for SalsaQuery | 169 | impl<T, R> From<Query<T, R>> for BoxedQuery |
172 | where | 170 | where |
173 | T: Hash + Send + Sync + 'static, | 171 | T: Hash + Send + Sync + 'static, |
174 | R: Hash + Send + Sync + 'static, | 172 | R: Hash + Send + Sync + 'static, |
175 | { | 173 | { |
176 | fn from(q: Query<T, R>) -> SalsaQuery | 174 | fn from(q: Query<T, R>) -> BoxedQuery |
177 | { | 175 | { |
178 | SalsaQuery { | 176 | BoxedQuery { |
179 | query_type: salsa::QueryTypeId(q.id), | 177 | query_type: salsa::QueryTypeId(q.id), |
180 | f: Box::new(move |ctx, data| { | 178 | f: Box::new(move |ctx, data| { |
181 | let ctx = QueryCtx { inner: ctx }; | 179 | let ctx = QueryCtx { inner: ctx }; |