aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-11-14 08:33:18 +0000
committerAleksey Kladov <[email protected]>2019-11-14 08:33:48 +0000
commit4efd345b09ca6e06fc0580d91a6c13f30b6b7f23 (patch)
tree0103b8fe352818db01c0148afd265e1724c5d0e0
parent2cfa30ac6ab832ac8c1f823afab76ddbbd91a126 (diff)
Slightly better naming
-rw-r--r--crates/ra_hir_def/src/body.rs15
-rw-r--r--crates/ra_hir_def/src/body/lower.rs2
2 files changed, 7 insertions, 10 deletions
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs
index 75bba31c2..bff17fd62 100644
--- a/crates/ra_hir_def/src/body.rs
+++ b/crates/ra_hir_def/src/body.rs
@@ -33,7 +33,7 @@ impl Expander {
33 Expander { crate_def_map, current_file_id, hygiene, module } 33 Expander { crate_def_map, current_file_id, hygiene, module }
34 } 34 }
35 35
36 fn expand( 36 fn enter_expand(
37 &mut self, 37 &mut self,
38 db: &impl DefDatabase2, 38 db: &impl DefDatabase2,
39 macro_call: ast::MacroCall, 39 macro_call: ast::MacroCall,
@@ -50,7 +50,11 @@ impl Expander {
50 if let Some(node) = db.parse_or_expand(file_id) { 50 if let Some(node) = db.parse_or_expand(file_id) {
51 if let Some(expr) = ast::Expr::cast(node) { 51 if let Some(expr) = ast::Expr::cast(node) {
52 log::debug!("macro expansion {:#?}", expr.syntax()); 52 log::debug!("macro expansion {:#?}", expr.syntax());
53 let mark = self.enter(db, file_id); 53
54 let mark = Mark { file_id: self.current_file_id };
55 self.hygiene = Hygiene::new(db, file_id);
56 self.current_file_id = file_id;
57
54 return Some((mark, expr)); 58 return Some((mark, expr));
55 } 59 }
56 } 60 }
@@ -62,13 +66,6 @@ impl Expander {
62 None 66 None
63 } 67 }
64 68
65 fn enter(&mut self, db: &impl DefDatabase2, file_id: HirFileId) -> Mark {
66 let mark = Mark { file_id: self.current_file_id };
67 self.hygiene = Hygiene::new(db, file_id);
68 self.current_file_id = file_id;
69 mark
70 }
71
72 fn exit(&mut self, db: &impl DefDatabase2, mark: Mark) { 69 fn exit(&mut self, db: &impl DefDatabase2, mark: Mark) {
73 self.hygiene = Hygiene::new(db, mark.file_id); 70 self.hygiene = Hygiene::new(db, mark.file_id);
74 self.current_file_id = mark.file_id; 71 self.current_file_id = mark.file_id;
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index f6d79ddf0..a5bb60e85 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -430,7 +430,7 @@ where
430 // FIXME implement HIR for these: 430 // FIXME implement HIR for these:
431 ast::Expr::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), 431 ast::Expr::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr),
432 ast::Expr::RangeExpr(_e) => self.alloc_expr(Expr::Missing, syntax_ptr), 432 ast::Expr::RangeExpr(_e) => self.alloc_expr(Expr::Missing, syntax_ptr),
433 ast::Expr::MacroCall(e) => match self.expander.expand(self.db, e) { 433 ast::Expr::MacroCall(e) => match self.expander.enter_expand(self.db, e) {
434 Some((mark, expansion)) => { 434 Some((mark, expansion)) => {
435 let id = self.collect_expr(expansion); 435 let id = self.collect_expr(expansion);
436 self.expander.exit(self.db, mark); 436 self.expander.exit(self.db, mark);