diff options
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r-- | crates/ra_hir_def/src/path.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs index c37364f57..e38d924fa 100644 --- a/crates/ra_hir_def/src/path.rs +++ b/crates/ra_hir_def/src/path.rs | |||
@@ -18,6 +18,20 @@ pub struct ModPath { | |||
18 | pub segments: Vec<Name>, | 18 | pub segments: Vec<Name>, |
19 | } | 19 | } |
20 | 20 | ||
21 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
22 | pub enum PathKind { | ||
23 | Plain, | ||
24 | /// `self::` is `Super(0)` | ||
25 | Super(u8), | ||
26 | Crate, | ||
27 | /// Absolute path (::foo) | ||
28 | Abs, | ||
29 | /// Type based path like `<T>::foo` | ||
30 | Type(Box<TypeRef>), | ||
31 | /// `$crate` from macro expansion | ||
32 | DollarCrate(CrateId), | ||
33 | } | ||
34 | |||
21 | impl ModPath { | 35 | impl ModPath { |
22 | pub fn from_src(path: ast::Path, hygiene: &Hygiene) -> Option<ModPath> { | 36 | pub fn from_src(path: ast::Path, hygiene: &Hygiene) -> Option<ModPath> { |
23 | lower::lower_path(path, hygiene).map(|it| it.mod_path) | 37 | lower::lower_path(path, hygiene).map(|it| it.mod_path) |
@@ -97,20 +111,6 @@ pub enum GenericArg { | |||
97 | // or lifetime... | 111 | // or lifetime... |
98 | } | 112 | } |
99 | 113 | ||
100 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
101 | pub enum PathKind { | ||
102 | Plain, | ||
103 | /// `self::` is `Super(0)` | ||
104 | Super(u8), | ||
105 | Crate, | ||
106 | /// Absolute path (::foo) | ||
107 | Abs, | ||
108 | /// Type based path like `<T>::foo` | ||
109 | Type(Box<TypeRef>), | ||
110 | /// `$crate` from macro expansion | ||
111 | DollarCrate(CrateId), | ||
112 | } | ||
113 | |||
114 | impl Path { | 114 | impl Path { |
115 | /// Converts an `ast::Path` to `Path`. Works with use trees. | 115 | /// Converts an `ast::Path` to `Path`. Works with use trees. |
116 | /// DEPRECATED: It does not handle `$crate` from macro call. | 116 | /// DEPRECATED: It does not handle `$crate` from macro call. |