aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/expand.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/expand.rs')
-rw-r--r--crates/ra_ide/src/expand.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/ra_ide/src/expand.rs b/crates/ra_ide/src/expand.rs
index b82259a3d..9f3aaa3a3 100644
--- a/crates/ra_ide/src/expand.rs
+++ b/crates/ra_ide/src/expand.rs
@@ -3,9 +3,10 @@ use std::iter::successors;
3 3
4use hir::{InFile, Origin}; 4use hir::{InFile, Origin};
5use ra_db::FileId; 5use ra_db::FileId;
6use ra_ide_db::RootDatabase;
6use ra_syntax::{ast, AstNode, SyntaxNode, SyntaxToken, TextRange}; 7use ra_syntax::{ast, AstNode, SyntaxNode, SyntaxToken, TextRange};
7 8
8use crate::{db::RootDatabase, FileRange}; 9use crate::FileRange;
9 10
10pub(crate) fn original_range(db: &RootDatabase, node: InFile<&SyntaxNode>) -> FileRange { 11pub(crate) fn original_range(db: &RootDatabase, node: InFile<&SyntaxNode>) -> FileRange {
11 if let Some((range, Origin::Call)) = original_range_and_origin(db, node) { 12 if let Some((range, Origin::Call)) = original_range_and_origin(db, node) {
@@ -79,6 +80,14 @@ pub(crate) fn descend_into_macros(
79 let source_analyzer = 80 let source_analyzer =
80 hir::SourceAnalyzer::new(db, src.with_value(src.value.parent()).as_ref(), None); 81 hir::SourceAnalyzer::new(db, src.with_value(src.value.parent()).as_ref(), None);
81 82
83 descend_into_macros_with_analyzer(db, &source_analyzer, src)
84}
85
86pub(crate) fn descend_into_macros_with_analyzer(
87 db: &RootDatabase,
88 source_analyzer: &hir::SourceAnalyzer,
89 src: InFile<SyntaxToken>,
90) -> InFile<SyntaxToken> {
82 successors(Some(src), |token| { 91 successors(Some(src), |token| {
83 let macro_call = token.value.ancestors().find_map(ast::MacroCall::cast)?; 92 let macro_call = token.value.ancestors().find_map(ast::MacroCall::cast)?;
84 let tt = macro_call.token_tree()?; 93 let tt = macro_call.token_tree()?;