22
33mod lower_use;
44
5- use crate :: { db :: DefDatabase , intern:: Interned } ;
5+ use crate :: intern:: Interned ;
66use std:: sync:: Arc ;
77
88use either:: Either ;
@@ -20,11 +20,7 @@ pub(super) use lower_use::lower_use_tree;
2020
2121/// Converts an `ast::Path` to `Path`. Works with use trees.
2222/// It correctly handles `$crate` based path from macro call.
23- pub ( super ) fn lower_path (
24- db : & dyn DefDatabase ,
25- mut path : ast:: Path ,
26- ctx : & LowerCtx ,
27- ) -> Option < Path > {
23+ pub ( super ) fn lower_path ( mut path : ast:: Path , ctx : & LowerCtx ) -> Option < Path > {
2824 let mut kind = PathKind :: Plain ;
2925 let mut type_anchor = None ;
3026 let mut segments = Vec :: new ( ) ;
@@ -40,7 +36,7 @@ pub(super) fn lower_path(
4036 match segment. kind ( ) ? {
4137 ast:: PathSegmentKind :: Name ( name_ref) => {
4238 // FIXME: this should just return name
43- match hygiene. name_ref_to_name ( db. upcast ( ) , name_ref) {
39+ match hygiene. name_ref_to_name ( ctx . db . upcast ( ) , name_ref) {
4440 Either :: Left ( name) => {
4541 let args = segment
4642 . generic_arg_list ( )
@@ -75,7 +71,7 @@ pub(super) fn lower_path(
7571 }
7672 // <T as Trait<A>>::Foo desugars to Trait<Self=T, A>::Foo
7773 Some ( trait_ref) => {
78- let path = Path :: from_src ( db , trait_ref. path ( ) ?, ctx) ?;
74+ let path = Path :: from_src ( trait_ref. path ( ) ?, ctx) ?;
7975 let mod_path = ( * path. mod_path ) . clone ( ) ;
8076 let num_segments = path. mod_path . segments . len ( ) ;
8177 kind = mod_path. kind ;
@@ -137,7 +133,7 @@ pub(super) fn lower_path(
137133 // We follow what it did anyway :)
138134 if segments. len ( ) == 1 && kind == PathKind :: Plain {
139135 if let Some ( _macro_call) = path. syntax ( ) . parent ( ) . and_then ( ast:: MacroCall :: cast) {
140- if let Some ( crate_id) = hygiene. local_inner_macros ( db. upcast ( ) , path) {
136+ if let Some ( crate_id) = hygiene. local_inner_macros ( ctx . db . upcast ( ) , path) {
141137 kind = PathKind :: DollarCrate ( crate_id) ;
142138 }
143139 }
0 commit comments