Skip to content

Commit 1fdee24

Browse files
committed
Use src node for analyze source
1 parent 8f1792f commit 1fdee24

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crates/ra_ide/src/expand.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,15 @@ pub(crate) fn descend_into_macros(
7676
) -> InFile<SyntaxToken> {
7777
let src = InFile::new(file_id.into(), token);
7878

79+
let source_analyzer =
80+
hir::SourceAnalyzer::new(db, src.with_value(src.value.parent()).as_ref(), None);
81+
7982
successors(Some(src), |token| {
8083
let macro_call = token.value.ancestors().find_map(ast::MacroCall::cast)?;
8184
let tt = macro_call.token_tree()?;
8285
if !token.value.text_range().is_subrange(&tt.syntax().text_range()) {
8386
return None;
8487
}
85-
let source_analyzer =
86-
hir::SourceAnalyzer::new(db, token.with_value(token.value.parent()).as_ref(), None);
8788
let exp = source_analyzer.expand(db, token.with_value(&macro_call))?;
8889
exp.map_token_down(db, token.as_ref())
8990
})

0 commit comments

Comments
 (0)