aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-12-18 16:06:52 +0000
committerAleksey Kladov <[email protected]>2019-12-18 16:06:52 +0000
commit88c6109897417e7ab815ea1711f49545bff94601 (patch)
tree95155272d892e13a08666bbab3e67ec27d95c1e6
parentd043689735edc12388e22f49b2319362f3b003fa (diff)
Move PathKindUp
-rw-r--r--crates/ra_hir_def/src/path.rs28
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)]
22pub 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
21impl ModPath { 35impl 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)]
101pub 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
114impl Path { 114impl 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.