diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-27 02:57:02 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-27 02:57:02 +0000 |
commit | c8066ebd1781a6f6f536abe3494477bd69df795a (patch) | |
tree | edf5109d9f0629b0910f4f2ac716bd624330bb00 /crates/hir_def/src/expr.rs | |
parent | 9c9376c4cffdd171375fbb21dd3d0f71a97a335e (diff) | |
parent | 8ce15b02dea7152953775904fd937cced2422bc6 (diff) |
Merge #8201
8201: Fix recursive macro statements expansion r=edwin0cheng a=edwin0cheng
This PR attempts to properly handle macro statement expansion by implementing the following:
1. Merge macro expanded statements to parent scope statements.
2. Add a new hir `Expr::MacroStmts` for handle tail expression infer.
PS : The scope of macro expanded statements are so strange that it took more time than I thought to understand and implement it :(
Fixes #8171
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/hir_def/src/expr.rs')
-rw-r--r-- | crates/hir_def/src/expr.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/hir_def/src/expr.rs b/crates/hir_def/src/expr.rs index 24be93773..6c7376fad 100644 --- a/crates/hir_def/src/expr.rs +++ b/crates/hir_def/src/expr.rs | |||
@@ -171,6 +171,9 @@ pub enum Expr { | |||
171 | Unsafe { | 171 | Unsafe { |
172 | body: ExprId, | 172 | body: ExprId, |
173 | }, | 173 | }, |
174 | MacroStmts { | ||
175 | tail: ExprId, | ||
176 | }, | ||
174 | Array(Array), | 177 | Array(Array), |
175 | Literal(Literal), | 178 | Literal(Literal), |
176 | } | 179 | } |
@@ -357,6 +360,7 @@ impl Expr { | |||
357 | f(*repeat) | 360 | f(*repeat) |
358 | } | 361 | } |
359 | }, | 362 | }, |
363 | Expr::MacroStmts { tail } => f(*tail), | ||
360 | Expr::Literal(_) => {} | 364 | Expr::Literal(_) => {} |
361 | } | 365 | } |
362 | } | 366 | } |