diff options
Diffstat (limited to 'crates/ra_hir_def/src')
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 10 | ||||
-rw-r--r-- | crates/ra_hir_def/src/nameres/raw.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir_def/src/path/lower.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir_def/src/path/lower/lower_use.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir_def/src/visibility.rs | 4 |
5 files changed, 17 insertions, 5 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 8d4b8b0f0..8338414fa 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -482,14 +482,17 @@ impl ExprCollector<'_> { | |||
482 | self.collect_block_items(&block); | 482 | self.collect_block_items(&block); |
483 | let statements = block | 483 | let statements = block |
484 | .statements() | 484 | .statements() |
485 | .map(|s| match s { | 485 | .filter_map(|s| match s { |
486 | ast::Stmt::LetStmt(stmt) => { | 486 | ast::Stmt::LetStmt(stmt) => { |
487 | let pat = self.collect_pat_opt(stmt.pat()); | 487 | let pat = self.collect_pat_opt(stmt.pat()); |
488 | let type_ref = stmt.ascribed_type().map(TypeRef::from_ast); | 488 | let type_ref = stmt.ascribed_type().map(TypeRef::from_ast); |
489 | let initializer = stmt.initializer().map(|e| self.collect_expr(e)); | 489 | let initializer = stmt.initializer().map(|e| self.collect_expr(e)); |
490 | Statement::Let { pat, type_ref, initializer } | 490 | Some(Statement::Let { pat, type_ref, initializer }) |
491 | } | 491 | } |
492 | ast::Stmt::ExprStmt(stmt) => Statement::Expr(self.collect_expr_opt(stmt.expr())), | 492 | ast::Stmt::ExprStmt(stmt) => { |
493 | Some(Statement::Expr(self.collect_expr_opt(stmt.expr()))) | ||
494 | } | ||
495 | ast::Stmt::ModuleItem(_) => None, | ||
493 | }) | 496 | }) |
494 | .collect(); | 497 | .collect(); |
495 | let tail = block.expr().map(|e| self.collect_expr(e)); | 498 | let tail = block.expr().map(|e| self.collect_expr(e)); |
@@ -541,6 +544,7 @@ impl ExprCollector<'_> { | |||
541 | let ast_id = self.expander.ast_id(&def); | 544 | let ast_id = self.expander.ast_id(&def); |
542 | (TraitLoc { container, ast_id }.intern(self.db).into(), def.name()) | 545 | (TraitLoc { container, ast_id }.intern(self.db).into(), def.name()) |
543 | } | 546 | } |
547 | ast::ModuleItem::ExternBlock(_) => continue, // FIXME: collect from extern blocks | ||
544 | ast::ModuleItem::ImplDef(_) | 548 | ast::ModuleItem::ImplDef(_) |
545 | | ast::ModuleItem::UseItem(_) | 549 | | ast::ModuleItem::UseItem(_) |
546 | | ast::ModuleItem::ExternCrateItem(_) | 550 | | ast::ModuleItem::ExternCrateItem(_) |
diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs index 8f190e7f9..a9dff3a5d 100644 --- a/crates/ra_hir_def/src/nameres/raw.rs +++ b/crates/ra_hir_def/src/nameres/raw.rs | |||
@@ -266,6 +266,10 @@ impl RawItemsCollector { | |||
266 | self.add_macro(current_module, it); | 266 | self.add_macro(current_module, it); |
267 | return; | 267 | return; |
268 | } | 268 | } |
269 | ast::ModuleItem::ExternBlock(_) => { | ||
270 | // FIXME: add extern block | ||
271 | return; | ||
272 | } | ||
269 | }; | 273 | }; |
270 | if let Some(name) = name { | 274 | if let Some(name) = name { |
271 | let name = name.as_name(); | 275 | let name = name.as_name(); |
diff --git a/crates/ra_hir_def/src/path/lower.rs b/crates/ra_hir_def/src/path/lower.rs index 4900000fe..3c13cb2c7 100644 --- a/crates/ra_hir_def/src/path/lower.rs +++ b/crates/ra_hir_def/src/path/lower.rs | |||
@@ -28,7 +28,7 @@ pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option<Path> | |||
28 | loop { | 28 | loop { |
29 | let segment = path.segment()?; | 29 | let segment = path.segment()?; |
30 | 30 | ||
31 | if segment.has_colon_colon() { | 31 | if segment.coloncolon().is_some() { |
32 | kind = PathKind::Abs; | 32 | kind = PathKind::Abs; |
33 | } | 33 | } |
34 | 34 | ||
diff --git a/crates/ra_hir_def/src/path/lower/lower_use.rs b/crates/ra_hir_def/src/path/lower/lower_use.rs index 278d5196e..6ec944228 100644 --- a/crates/ra_hir_def/src/path/lower/lower_use.rs +++ b/crates/ra_hir_def/src/path/lower/lower_use.rs | |||
@@ -34,7 +34,7 @@ pub(crate) fn lower_use_tree( | |||
34 | let alias = tree.alias().map(|a| { | 34 | let alias = tree.alias().map(|a| { |
35 | a.name().map(|it| it.as_name()).map_or(ImportAlias::Underscore, ImportAlias::Alias) | 35 | a.name().map(|it| it.as_name()).map_or(ImportAlias::Underscore, ImportAlias::Alias) |
36 | }); | 36 | }); |
37 | let is_glob = tree.has_star(); | 37 | let is_glob = tree.star().is_some(); |
38 | if let Some(ast_path) = tree.path() { | 38 | if let Some(ast_path) = tree.path() { |
39 | // Handle self in a path. | 39 | // Handle self in a path. |
40 | // E.g. `use something::{self, <...>}` | 40 | // E.g. `use something::{self, <...>}` |
diff --git a/crates/ra_hir_def/src/visibility.rs b/crates/ra_hir_def/src/visibility.rs index 62513873e..1482d3be0 100644 --- a/crates/ra_hir_def/src/visibility.rs +++ b/crates/ra_hir_def/src/visibility.rs | |||
@@ -84,6 +84,10 @@ impl RawVisibility { | |||
84 | let path = ModPath { kind: PathKind::Super(1), segments: Vec::new() }; | 84 | let path = ModPath { kind: PathKind::Super(1), segments: Vec::new() }; |
85 | RawVisibility::Module(path) | 85 | RawVisibility::Module(path) |
86 | } | 86 | } |
87 | ast::VisibilityKind::PubSelf => { | ||
88 | let path = ModPath { kind: PathKind::Plain, segments: Vec::new() }; | ||
89 | RawVisibility::Module(path) | ||
90 | } | ||
87 | ast::VisibilityKind::Pub => RawVisibility::Public, | 91 | ast::VisibilityKind::Pub => RawVisibility::Public, |
88 | } | 92 | } |
89 | } | 93 | } |