diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-11-24 17:08:16 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-11-24 17:08:16 +0000 |
commit | a58db5712f4fc82845e9397f728815d389c3c38b (patch) | |
tree | 8f4d416bad74f75e43924981b1d2c2099ea50edc /crates/ra_hir/src/ty/infer.rs | |
parent | ac9ba5eb32073c16608acaa04324e7dc46d303d6 (diff) | |
parent | 63e3ea38d3ff7ab69b968e8962f33e82a4f978fb (diff) |
Merge #2389
2389: Don't redo field resolution in the IDE r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty/infer.rs')
-rw-r--r-- | crates/ra_hir/src/ty/infer.rs | 5 |
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 | } |