This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +158
-161
lines changed Expand file tree Collapse file tree 7 files changed +158
-161
lines changed Original file line number Diff line number Diff line change @@ -342,7 +342,7 @@ impl InFile<TextRange> {
342342}
343343
344344impl < N : AstNode > InFile < N > {
345- pub fn original_ast_node ( self , db : & dyn db:: ExpandDatabase ) -> Option < InRealFile < N > > {
345+ pub fn original_ast_node_rooted ( self , db : & dyn db:: ExpandDatabase ) -> Option < InRealFile < N > > {
346346 // This kind of upmapping can only be achieved in attribute expanded files,
347347 // as we don't have node inputs otherwise and therefore can't find an `N` node in the input
348348 let file_id = match self . file_id . repr ( ) {
Original file line number Diff line number Diff line change @@ -512,8 +512,7 @@ impl<'db> SemanticsImpl<'db> {
512512 }
513513
514514 /// Descend the token into its macro call if it is part of one, returning the tokens in the
515- /// expansion that it is associated with. If `offset` points into the token's range, it will
516- /// be considered for the mapping in case of inline format args.
515+ /// expansion that it is associated with.
517516 pub fn descend_into_macros (
518517 & self ,
519518 mode : DescendPreference ,
@@ -850,7 +849,7 @@ impl<'db> SemanticsImpl<'db> {
850849 /// Attempts to map the node out of macro expanded files.
851850 /// This only work for attribute expansions, as other ones do not have nodes as input.
852851 pub fn original_ast_node < N : AstNode > ( & self , node : N ) -> Option < N > {
853- self . wrap_node_infile ( node) . original_ast_node ( self . db . upcast ( ) ) . map (
852+ self . wrap_node_infile ( node) . original_ast_node_rooted ( self . db . upcast ( ) ) . map (
854853 |InRealFile { file_id, value } | {
855854 self . cache ( find_root ( value. syntax ( ) ) , file_id. into ( ) ) ;
856855 value
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ fn add_variant_to_accumulator(
114114 parent : PathParent ,
115115) -> Option < ( ) > {
116116 let db = ctx. db ( ) ;
117- let InRealFile { file_id, value : enum_node } = adt. source ( db) ?. original_ast_node ( db) ?;
117+ let InRealFile { file_id, value : enum_node } = adt. source ( db) ?. original_ast_node_rooted ( db) ?;
118118
119119 acc. add (
120120 AssistId ( "generate_enum_variant" , AssistKind :: Generate ) ,
Original file line number Diff line number Diff line change @@ -516,7 +516,7 @@ fn source_edit_from_def(
516516 if let Definition :: Local ( local) = def {
517517 let mut file_id = None ;
518518 for source in local. sources ( sema. db ) {
519- let source = match source. source . clone ( ) . original_ast_node ( sema. db ) {
519+ let source = match source. source . clone ( ) . original_ast_node_rooted ( sema. db ) {
520520 Some ( source) => source,
521521 None => match source
522522 . source
@@ -560,7 +560,7 @@ fn source_edit_from_def(
560560 }
561561 } else {
562562 // Foo { ref mut field } -> Foo { field: ref mut new_name }
563- // ^ insert `field : `
563+ // original_ast_node_rootedd : `
564564 // ^^^^^ replace this with `new_name`
565565 edit. insert (
566566 pat. syntax ( ) . text_range ( ) . start ( ) ,
You can’t perform that action at this time.
0 commit comments