diff options
author | Florian Diebold <[email protected]> | 2019-12-08 11:50:49 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-12-08 12:03:13 +0000 |
commit | 5e096def15e992938b0e2838ae6c344939aa10f2 (patch) | |
tree | 3e8c410735959fcf35d4346710e4d78b52924c8a /crates | |
parent | 2223620313e94deb04d1565a75004579aa1a9e07 (diff) |
Expand macros in blocks to expressions for now
Expanding to statements isn't handled properly yet and breaks things.
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 7 | ||||
-rw-r--r-- | crates/ra_hir_expand/src/db.rs | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 71c08f024..cc068ff94 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -437,9 +437,7 @@ where | |||
437 | None => self.alloc_expr(Expr::Missing, syntax_ptr), | 437 | None => self.alloc_expr(Expr::Missing, syntax_ptr), |
438 | } | 438 | } |
439 | } | 439 | } |
440 | 440 | // FIXME expand to statements in statement position | |
441 | // FIXME implement HIR for these: | ||
442 | ast::Expr::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), | ||
443 | ast::Expr::MacroCall(e) => match self.expander.enter_expand(self.db, e) { | 441 | ast::Expr::MacroCall(e) => match self.expander.enter_expand(self.db, e) { |
444 | Some((mark, expansion)) => { | 442 | Some((mark, expansion)) => { |
445 | let id = self.collect_expr(expansion); | 443 | let id = self.collect_expr(expansion); |
@@ -448,6 +446,9 @@ where | |||
448 | } | 446 | } |
449 | None => self.alloc_expr(Expr::Missing, syntax_ptr), | 447 | None => self.alloc_expr(Expr::Missing, syntax_ptr), |
450 | }, | 448 | }, |
449 | |||
450 | // FIXME implement HIR for these: | ||
451 | ast::Expr::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), | ||
451 | } | 452 | } |
452 | } | 453 | } |
453 | 454 | ||
diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs index 4bdb41619..f68aca789 100644 --- a/crates/ra_hir_expand/src/db.rs +++ b/crates/ra_hir_expand/src/db.rs | |||
@@ -183,8 +183,8 @@ fn to_fragment_kind(db: &dyn AstDatabase, macro_call_id: MacroCallId) -> Fragmen | |||
183 | // FIXME: Handle Pattern | 183 | // FIXME: Handle Pattern |
184 | FragmentKind::Expr | 184 | FragmentKind::Expr |
185 | } | 185 | } |
186 | EXPR_STMT => FragmentKind::Statements, | 186 | // FIXME: Expand to statements in appropriate positions; HIR lowering needs to handle that |
187 | BLOCK => FragmentKind::Statements, | 187 | EXPR_STMT | BLOCK => FragmentKind::Expr, |
188 | ARG_LIST => FragmentKind::Expr, | 188 | ARG_LIST => FragmentKind::Expr, |
189 | TRY_EXPR => FragmentKind::Expr, | 189 | TRY_EXPR => FragmentKind::Expr, |
190 | TUPLE_EXPR => FragmentKind::Expr, | 190 | TUPLE_EXPR => FragmentKind::Expr, |