diff options
Diffstat (limited to 'crates/ra_hir_def/src/body')
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 5323af097..e656f9a41 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -446,14 +446,20 @@ where | |||
446 | } | 446 | } |
447 | } | 447 | } |
448 | // FIXME expand to statements in statement position | 448 | // FIXME expand to statements in statement position |
449 | ast::Expr::MacroCall(e) => match self.expander.enter_expand(self.db, e) { | 449 | ast::Expr::MacroCall(e) => { |
450 | Some((mark, expansion)) => { | 450 | let macro_call = self.expander.to_source(AstPtr::new(&e)); |
451 | let id = self.collect_expr(expansion); | 451 | match self.expander.enter_expand(self.db, e.clone()) { |
452 | self.expander.exit(self.db, mark); | 452 | Some((mark, expansion)) => { |
453 | id | 453 | self.source_map |
454 | .expansions | ||
455 | .insert(macro_call, self.expander.current_file_id); | ||
456 | let id = self.collect_expr(expansion); | ||
457 | self.expander.exit(self.db, mark); | ||
458 | id | ||
459 | } | ||
460 | None => self.alloc_expr(Expr::Missing, syntax_ptr), | ||
454 | } | 461 | } |
455 | None => self.alloc_expr(Expr::Missing, syntax_ptr), | 462 | } |
456 | }, | ||
457 | 463 | ||
458 | // FIXME implement HIR for these: | 464 | // FIXME implement HIR for these: |
459 | ast::Expr::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), | 465 | ast::Expr::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), |
@@ -543,7 +549,10 @@ where | |||
543 | }; | 549 | }; |
544 | self.body.item_scope.define_def(def); | 550 | self.body.item_scope.define_def(def); |
545 | if let Some(name) = name { | 551 | if let Some(name) = name { |
546 | self.body.item_scope.push_res(name.as_name(), def.into()); | 552 | let vis = crate::visibility::Visibility::Public; // FIXME determine correctly |
553 | self.body | ||
554 | .item_scope | ||
555 | .push_res(name.as_name(), crate::per_ns::PerNs::from_def(def, vis)); | ||
547 | } | 556 | } |
548 | } | 557 | } |
549 | } | 558 | } |