mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Slightly better naming
This commit is contained in:
parent
2cfa30ac6a
commit
4efd345b09
2 changed files with 7 additions and 10 deletions
|
@ -33,7 +33,7 @@ impl Expander {
|
||||||
Expander { crate_def_map, current_file_id, hygiene, module }
|
Expander { crate_def_map, current_file_id, hygiene, module }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn expand(
|
fn enter_expand(
|
||||||
&mut self,
|
&mut self,
|
||||||
db: &impl DefDatabase2,
|
db: &impl DefDatabase2,
|
||||||
macro_call: ast::MacroCall,
|
macro_call: ast::MacroCall,
|
||||||
|
@ -50,7 +50,11 @@ impl Expander {
|
||||||
if let Some(node) = db.parse_or_expand(file_id) {
|
if let Some(node) = db.parse_or_expand(file_id) {
|
||||||
if let Some(expr) = ast::Expr::cast(node) {
|
if let Some(expr) = ast::Expr::cast(node) {
|
||||||
log::debug!("macro expansion {:#?}", expr.syntax());
|
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));
|
return Some((mark, expr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,13 +66,6 @@ impl Expander {
|
||||||
None
|
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) {
|
fn exit(&mut self, db: &impl DefDatabase2, mark: Mark) {
|
||||||
self.hygiene = Hygiene::new(db, mark.file_id);
|
self.hygiene = Hygiene::new(db, mark.file_id);
|
||||||
self.current_file_id = mark.file_id;
|
self.current_file_id = mark.file_id;
|
||||||
|
|
|
@ -430,7 +430,7 @@ where
|
||||||
// FIXME implement HIR for these:
|
// FIXME implement HIR for these:
|
||||||
ast::Expr::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr),
|
ast::Expr::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr),
|
||||||
ast::Expr::RangeExpr(_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)) => {
|
Some((mark, expansion)) => {
|
||||||
let id = self.collect_expr(expansion);
|
let id = self.collect_expr(expansion);
|
||||||
self.expander.exit(self.db, mark);
|
self.expander.exit(self.db, mark);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue