mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Merge #2238
2238: Slightly better naming r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
267f194c28
2 changed files with 7 additions and 10 deletions
|
@ -33,7 +33,7 @@ impl Expander {
|
|||
Expander { crate_def_map, current_file_id, hygiene, module }
|
||||
}
|
||||
|
||||
fn expand(
|
||||
fn enter_expand(
|
||||
&mut self,
|
||||
db: &impl DefDatabase2,
|
||||
macro_call: ast::MacroCall,
|
||||
|
@ -50,7 +50,11 @@ impl Expander {
|
|||
if let Some(node) = db.parse_or_expand(file_id) {
|
||||
if let Some(expr) = ast::Expr::cast(node) {
|
||||
log::debug!("macro expansion {:#?}", expr.syntax());
|
||||
let mark = self.enter(db, file_id);
|
||||
|
||||
let mark = Mark { file_id: self.current_file_id };
|
||||
self.hygiene = Hygiene::new(db, file_id);
|
||||
self.current_file_id = file_id;
|
||||
|
||||
return Some((mark, expr));
|
||||
}
|
||||
}
|
||||
|
@ -62,13 +66,6 @@ impl Expander {
|
|||
None
|
||||
}
|
||||
|
||||
fn enter(&mut self, db: &impl DefDatabase2, file_id: HirFileId) -> Mark {
|
||||
let mark = Mark { file_id: self.current_file_id };
|
||||
self.hygiene = Hygiene::new(db, file_id);
|
||||
self.current_file_id = file_id;
|
||||
mark
|
||||
}
|
||||
|
||||
fn exit(&mut self, db: &impl DefDatabase2, mark: Mark) {
|
||||
self.hygiene = Hygiene::new(db, mark.file_id);
|
||||
self.current_file_id = mark.file_id;
|
||||
|
|
|
@ -430,7 +430,7 @@ where
|
|||
// FIXME implement HIR for these:
|
||||
ast::Expr::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr),
|
||||
ast::Expr::RangeExpr(_e) => self.alloc_expr(Expr::Missing, syntax_ptr),
|
||||
ast::Expr::MacroCall(e) => match self.expander.expand(self.db, e) {
|
||||
ast::Expr::MacroCall(e) => match self.expander.enter_expand(self.db, e) {
|
||||
Some((mark, expansion)) => {
|
||||
let id = self.collect_expr(expansion);
|
||||
self.expander.exit(self.db, mark);
|
||||
|
|
Loading…
Reference in a new issue