From 1fdee246083696df8ff0a75f845c6eee8013bddf Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Wed, 8 Jan 2020 00:23:53 +0800 Subject: Use src node for analyze source --- crates/ra_ide/src/expand.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/expand.rs b/crates/ra_ide/src/expand.rs index 7a22bb0a4..b82259a3d 100644 --- a/crates/ra_ide/src/expand.rs +++ b/crates/ra_ide/src/expand.rs @@ -76,14 +76,15 @@ pub(crate) fn descend_into_macros( ) -> InFile { let src = InFile::new(file_id.into(), token); + let source_analyzer = + hir::SourceAnalyzer::new(db, src.with_value(src.value.parent()).as_ref(), None); + successors(Some(src), |token| { let macro_call = token.value.ancestors().find_map(ast::MacroCall::cast)?; let tt = macro_call.token_tree()?; if !token.value.text_range().is_subrange(&tt.syntax().text_range()) { return None; } - let source_analyzer = - hir::SourceAnalyzer::new(db, token.with_value(token.value.parent()).as_ref(), None); let exp = source_analyzer.expand(db, token.with_value(¯o_call))?; exp.map_token_down(db, token.as_ref()) }) -- cgit v1.2.3