diff options
author | Aleksey Kladov <[email protected]> | 2019-12-18 16:06:52 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-18 16:06:52 +0000 |
commit | 88c6109897417e7ab815ea1711f49545bff94601 (patch) | |
tree | 95155272d892e13a08666bbab3e67ec27d95c1e6 /crates | |
parent | d043689735edc12388e22f49b2319362f3b003fa (diff) |
Move PathKindUp
Diffstat (limited to 'crates')
-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. |