diff options
Diffstat (limited to 'crates/ra_hir_def/src')
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 9 | ||||
-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, 16 insertions, 5 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 06145e92a..032037c8c 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -497,14 +497,16 @@ impl ExprCollector<'_> { | |||
497 | self.collect_block_items(&block); | 497 | self.collect_block_items(&block); |
498 | let statements = block | 498 | let statements = block |
499 | .statements() | 499 | .statements() |
500 | .map(|s| match s { | 500 | .filter_map(|s| match s { |
501 | ast::Stmt::LetStmt(stmt) => { | 501 | ast::Stmt::LetStmt(stmt) => { |
502 | let pat = self.collect_pat_opt(stmt.pat()); | 502 | let pat = self.collect_pat_opt(stmt.pat()); |
503 | let type_ref = stmt.ascribed_type().map(TypeRef::from_ast); | 503 | let type_ref = stmt.ascribed_type().map(TypeRef::from_ast); |
504 | let initializer = stmt.initializer().map(|e| self.collect_expr(e)); | 504 | let initializer = stmt.initializer().map(|e| self.collect_expr(e)); |
505 | Statement::Let { pat, type_ref, initializer } | 505 | Some(Statement::Let { pat, type_ref, initializer }) |
506 | } | ||
507 | ast::Stmt::ExprStmt(stmt) => { | ||
508 | Some(Statement::Expr(self.collect_expr_opt(stmt.expr()))) | ||
506 | } | 509 | } |
507 | ast::Stmt::ExprStmt(stmt) => Statement::Expr(self.collect_expr_opt(stmt.expr())), | ||
508 | }) | 510 | }) |
509 | .collect(); | 511 | .collect(); |
510 | let tail = block.expr().map(|e| self.collect_expr(e)); | 512 | let tail = block.expr().map(|e| self.collect_expr(e)); |
@@ -556,6 +558,7 @@ impl ExprCollector<'_> { | |||
556 | let ast_id = self.expander.ast_id(&def); | 558 | let ast_id = self.expander.ast_id(&def); |
557 | (TraitLoc { container, ast_id }.intern(self.db).into(), def.name()) | 559 | (TraitLoc { container, ast_id }.intern(self.db).into(), def.name()) |
558 | } | 560 | } |
561 | ast::ModuleItem::ExternBlock(_) => continue, // FIXME: collect from extern blocks | ||
559 | ast::ModuleItem::ImplDef(_) | 562 | ast::ModuleItem::ImplDef(_) |
560 | | ast::ModuleItem::UseItem(_) | 563 | | ast::ModuleItem::UseItem(_) |
561 | | ast::ModuleItem::ExternCrateItem(_) | 564 | | 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 | } |