mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Rename Source -> InFile
This commit is contained in:
parent
2702fa1c5d
commit
ccd1b0800a
36 changed files with 189 additions and 189 deletions
|
@ -22,7 +22,7 @@ pub(crate) fn expand_macro(db: &RootDatabase, position: FilePosition) -> Option<
|
|||
let name_ref = find_node_at_offset::<ast::NameRef>(file.syntax(), position.offset)?;
|
||||
let mac = name_ref.syntax().ancestors().find_map(ast::MacroCall::cast)?;
|
||||
|
||||
let source = hir::Source::new(position.file_id.into(), mac.syntax());
|
||||
let source = hir::InFile::new(position.file_id.into(), mac.syntax());
|
||||
let expanded = expand_macro_recur(db, source, source.with_value(&mac))?;
|
||||
|
||||
// FIXME:
|
||||
|
@ -34,8 +34,8 @@ pub(crate) fn expand_macro(db: &RootDatabase, position: FilePosition) -> Option<
|
|||
|
||||
fn expand_macro_recur(
|
||||
db: &RootDatabase,
|
||||
source: hir::Source<&SyntaxNode>,
|
||||
macro_call: hir::Source<&ast::MacroCall>,
|
||||
source: hir::InFile<&SyntaxNode>,
|
||||
macro_call: hir::InFile<&ast::MacroCall>,
|
||||
) -> Option<SyntaxNode> {
|
||||
let analyzer = hir::SourceAnalyzer::new(db, source, None);
|
||||
let expansion = analyzer.expand(db, macro_call)?;
|
||||
|
@ -46,7 +46,7 @@ fn expand_macro_recur(
|
|||
let mut replaces = FxHashMap::default();
|
||||
|
||||
for child in children.into_iter() {
|
||||
let node = hir::Source::new(macro_file_id, &child);
|
||||
let node = hir::InFile::new(macro_file_id, &child);
|
||||
if let Some(new_node) = expand_macro_recur(db, source, node) {
|
||||
// Replace the whole node if it is root
|
||||
// `replace_descendants` will not replace the parent node
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue