diff options
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/semantics.rs | 15 | ||||
-rw-r--r-- | crates/ra_hir/src/source_analyzer.rs | 8 |
2 files changed, 13 insertions, 10 deletions
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs index 054405966..a654c618f 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs | |||
@@ -209,7 +209,10 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> { | |||
209 | self.imp.resolve_field(field) | 209 | self.imp.resolve_field(field) |
210 | } | 210 | } |
211 | 211 | ||
212 | pub fn resolve_record_field(&self, field: &ast::RecordField) -> Option<(Field, Option<Local>)> { | 212 | pub fn resolve_record_field( |
213 | &self, | ||
214 | field: &ast::RecordExprField, | ||
215 | ) -> Option<(Field, Option<Local>)> { | ||
213 | self.imp.resolve_record_field(field) | 216 | self.imp.resolve_record_field(field) |
214 | } | 217 | } |
215 | 218 | ||
@@ -225,7 +228,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> { | |||
225 | self.imp.resolve_path(path) | 228 | self.imp.resolve_path(path) |
226 | } | 229 | } |
227 | 230 | ||
228 | pub fn resolve_variant(&self, record_lit: ast::RecordLit) -> Option<VariantDef> { | 231 | pub fn resolve_variant(&self, record_lit: ast::RecordExpr) -> Option<VariantDef> { |
229 | self.imp.resolve_variant(record_lit).map(VariantDef::from) | 232 | self.imp.resolve_variant(record_lit).map(VariantDef::from) |
230 | } | 233 | } |
231 | 234 | ||
@@ -240,7 +243,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> { | |||
240 | // FIXME: use this instead? | 243 | // FIXME: use this instead? |
241 | // pub fn resolve_name_ref(&self, name_ref: &ast::NameRef) -> Option<???>; | 244 | // pub fn resolve_name_ref(&self, name_ref: &ast::NameRef) -> Option<???>; |
242 | 245 | ||
243 | pub fn record_literal_missing_fields(&self, literal: &ast::RecordLit) -> Vec<(Field, Type)> { | 246 | pub fn record_literal_missing_fields(&self, literal: &ast::RecordExpr) -> Vec<(Field, Type)> { |
244 | self.imp.record_literal_missing_fields(literal) | 247 | self.imp.record_literal_missing_fields(literal) |
245 | } | 248 | } |
246 | 249 | ||
@@ -422,7 +425,7 @@ impl<'db> SemanticsImpl<'db> { | |||
422 | self.analyze(field.syntax()).resolve_field(self.db, field) | 425 | self.analyze(field.syntax()).resolve_field(self.db, field) |
423 | } | 426 | } |
424 | 427 | ||
425 | fn resolve_record_field(&self, field: &ast::RecordField) -> Option<(Field, Option<Local>)> { | 428 | fn resolve_record_field(&self, field: &ast::RecordExprField) -> Option<(Field, Option<Local>)> { |
426 | self.analyze(field.syntax()).resolve_record_field(self.db, field) | 429 | self.analyze(field.syntax()).resolve_record_field(self.db, field) |
427 | } | 430 | } |
428 | 431 | ||
@@ -440,7 +443,7 @@ impl<'db> SemanticsImpl<'db> { | |||
440 | self.analyze(path.syntax()).resolve_path(self.db, path) | 443 | self.analyze(path.syntax()).resolve_path(self.db, path) |
441 | } | 444 | } |
442 | 445 | ||
443 | fn resolve_variant(&self, record_lit: ast::RecordLit) -> Option<VariantId> { | 446 | fn resolve_variant(&self, record_lit: ast::RecordExpr) -> Option<VariantId> { |
444 | self.analyze(record_lit.syntax()).resolve_variant(self.db, record_lit) | 447 | self.analyze(record_lit.syntax()).resolve_variant(self.db, record_lit) |
445 | } | 448 | } |
446 | 449 | ||
@@ -453,7 +456,7 @@ impl<'db> SemanticsImpl<'db> { | |||
453 | self.analyze(pat.syntax()).resolve_bind_pat_to_const(self.db, pat) | 456 | self.analyze(pat.syntax()).resolve_bind_pat_to_const(self.db, pat) |
454 | } | 457 | } |
455 | 458 | ||
456 | fn record_literal_missing_fields(&self, literal: &ast::RecordLit) -> Vec<(Field, Type)> { | 459 | fn record_literal_missing_fields(&self, literal: &ast::RecordExpr) -> Vec<(Field, Type)> { |
457 | self.analyze(literal.syntax()) | 460 | self.analyze(literal.syntax()) |
458 | .record_literal_missing_fields(self.db, literal) | 461 | .record_literal_missing_fields(self.db, literal) |
459 | .unwrap_or_default() | 462 | .unwrap_or_default() |
diff --git a/crates/ra_hir/src/source_analyzer.rs b/crates/ra_hir/src/source_analyzer.rs index 86a47a9e5..8f438bba0 100644 --- a/crates/ra_hir/src/source_analyzer.rs +++ b/crates/ra_hir/src/source_analyzer.rs | |||
@@ -159,7 +159,7 @@ impl SourceAnalyzer { | |||
159 | pub(crate) fn resolve_record_field( | 159 | pub(crate) fn resolve_record_field( |
160 | &self, | 160 | &self, |
161 | db: &dyn HirDatabase, | 161 | db: &dyn HirDatabase, |
162 | field: &ast::RecordField, | 162 | field: &ast::RecordExprField, |
163 | ) -> Option<(Field, Option<Local>)> { | 163 | ) -> Option<(Field, Option<Local>)> { |
164 | let expr = field.expr()?; | 164 | let expr = field.expr()?; |
165 | let expr_id = self.expr_id(db, &expr)?; | 165 | let expr_id = self.expr_id(db, &expr)?; |
@@ -246,7 +246,7 @@ impl SourceAnalyzer { | |||
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | if let Some(rec_lit) = path.syntax().parent().and_then(ast::RecordLit::cast) { | 249 | if let Some(rec_lit) = path.syntax().parent().and_then(ast::RecordExpr::cast) { |
250 | let expr_id = self.expr_id(db, &rec_lit.into())?; | 250 | let expr_id = self.expr_id(db, &rec_lit.into())?; |
251 | if let Some(VariantId::EnumVariantId(variant)) = | 251 | if let Some(VariantId::EnumVariantId(variant)) = |
252 | self.infer.as_ref()?.variant_resolution_for_expr(expr_id) | 252 | self.infer.as_ref()?.variant_resolution_for_expr(expr_id) |
@@ -284,7 +284,7 @@ impl SourceAnalyzer { | |||
284 | pub(crate) fn record_literal_missing_fields( | 284 | pub(crate) fn record_literal_missing_fields( |
285 | &self, | 285 | &self, |
286 | db: &dyn HirDatabase, | 286 | db: &dyn HirDatabase, |
287 | literal: &ast::RecordLit, | 287 | literal: &ast::RecordExpr, |
288 | ) -> Option<Vec<(Field, Type)>> { | 288 | ) -> Option<Vec<(Field, Type)>> { |
289 | let krate = self.resolver.krate()?; | 289 | let krate = self.resolver.krate()?; |
290 | let body = self.body.as_ref()?; | 290 | let body = self.body.as_ref()?; |
@@ -358,7 +358,7 @@ impl SourceAnalyzer { | |||
358 | pub(crate) fn resolve_variant( | 358 | pub(crate) fn resolve_variant( |
359 | &self, | 359 | &self, |
360 | db: &dyn HirDatabase, | 360 | db: &dyn HirDatabase, |
361 | record_lit: ast::RecordLit, | 361 | record_lit: ast::RecordExpr, |
362 | ) -> Option<VariantId> { | 362 | ) -> Option<VariantId> { |
363 | let infer = self.infer.as_ref()?; | 363 | let infer = self.infer.as_ref()?; |
364 | let expr_id = self.expr_id(db, &record_lit.into())?; | 364 | let expr_id = self.expr_id(db, &record_lit.into())?; |