aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/infer.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-11-24 17:06:55 +0000
committerAleksey Kladov <[email protected]>2019-11-24 17:06:55 +0000
commit63e3ea38d3ff7ab69b968e8962f33e82a4f978fb (patch)
tree8f4d416bad74f75e43924981b1d2c2099ea50edc /crates/ra_hir/src/ty/infer.rs
parentac9ba5eb32073c16608acaa04324e7dc46d303d6 (diff)
Don't redo field resolution in the IDE
Diffstat (limited to 'crates/ra_hir/src/ty/infer.rs')
-rw-r--r--crates/ra_hir/src/ty/infer.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs
index 2e744e5ec..0a9a83800 100644
--- a/crates/ra_hir/src/ty/infer.rs
+++ b/crates/ra_hir/src/ty/infer.rs
@@ -126,6 +126,8 @@ pub struct InferenceResult {
126 method_resolutions: FxHashMap<ExprId, Function>, 126 method_resolutions: FxHashMap<ExprId, Function>,
127 /// For each field access expr, records the field it resolves to. 127 /// For each field access expr, records the field it resolves to.
128 field_resolutions: FxHashMap<ExprId, StructField>, 128 field_resolutions: FxHashMap<ExprId, StructField>,
129 /// For each field in record literal, records the field it resolves to.
130 record_field_resolutions: FxHashMap<ExprId, StructField>,
129 /// For each struct literal, records the variant it resolves to. 131 /// For each struct literal, records the variant it resolves to.
130 variant_resolutions: FxHashMap<ExprOrPatId, VariantDef>, 132 variant_resolutions: FxHashMap<ExprOrPatId, VariantDef>,
131 /// For each associated item record what it resolves to 133 /// For each associated item record what it resolves to
@@ -143,6 +145,9 @@ impl InferenceResult {
143 pub fn field_resolution(&self, expr: ExprId) -> Option<StructField> { 145 pub fn field_resolution(&self, expr: ExprId) -> Option<StructField> {
144 self.field_resolutions.get(&expr).copied() 146 self.field_resolutions.get(&expr).copied()
145 } 147 }
148 pub fn record_field_resolution(&self, expr: ExprId) -> Option<StructField> {
149 self.record_field_resolutions.get(&expr).copied()
150 }
146 pub fn variant_resolution_for_expr(&self, id: ExprId) -> Option<VariantDef> { 151 pub fn variant_resolution_for_expr(&self, id: ExprId) -> Option<VariantDef> {
147 self.variant_resolutions.get(&id.into()).copied() 152 self.variant_resolutions.get(&id.into()).copied()
148 } 153 }