Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/semantics.rs')
-rw-r--r--crates/hir/src/semantics.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index 98f5739600..4bc757da44 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -2003,6 +2003,15 @@ impl<'db> SemanticsImpl<'db> {
.unwrap_or_default()
}
+ pub fn record_literal_matched_fields(
+ &self,
+ literal: &ast::RecordExpr,
+ ) -> Vec<(Field, Type<'db>)> {
+ self.analyze(literal.syntax())
+ .and_then(|it| it.record_literal_matched_fields(self.db, literal))
+ .unwrap_or_default()
+ }
+
pub fn record_pattern_missing_fields(
&self,
pattern: &ast::RecordPat,
@@ -2012,6 +2021,15 @@ impl<'db> SemanticsImpl<'db> {
.unwrap_or_default()
}
+ pub fn record_pattern_matched_fields(
+ &self,
+ pattern: &ast::RecordPat,
+ ) -> Vec<(Field, Type<'db>)> {
+ self.analyze(pattern.syntax())
+ .and_then(|it| it.record_pattern_matched_fields(self.db, pattern))
+ .unwrap_or_default()
+ }
+
fn with_ctx<F: FnOnce(&mut SourceToDefCtx<'_, '_>) -> T, T>(&self, f: F) -> T {
let mut ctx = SourceToDefCtx { db: self.db, cache: &mut self.s2d_cache.borrow_mut() };
f(&mut ctx)