aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/path.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-01-05 15:32:07 +0000
committerFlorian Diebold <[email protected]>2019-01-05 21:41:12 +0000
commit136aba1cf32646278c4034541ee415f656f8bb5e (patch)
treec15e7be7bfdae8074aa42f0c216e315bf8d7db49 /crates/ra_hir/src/path.rs
parenta6f33b4ca5e70a056c60b24cb8cb3283d8209624 (diff)
Add HIR Expr machinery
Diffstat (limited to 'crates/ra_hir/src/path.rs')
-rw-r--r--crates/ra_hir/src/path.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs
index 9fdfa0d13..2e42caffe 100644
--- a/crates/ra_hir/src/path.rs
+++ b/crates/ra_hir/src/path.rs
@@ -65,6 +65,14 @@ impl Path {
65 } 65 }
66 } 66 }
67 67
68 /// Converts an `ast::NameRef` into a single-identifier `Path`.
69 pub fn from_name_ref(name_ref: ast::NameRef) -> Path {
70 Path {
71 kind: PathKind::Plain,
72 segments: vec![name_ref.as_name()],
73 }
74 }
75
68 /// `true` is this path is a single identifier, like `foo` 76 /// `true` is this path is a single identifier, like `foo`
69 pub fn is_ident(&self) -> bool { 77 pub fn is_ident(&self) -> bool {
70 self.kind == PathKind::Plain && self.segments.len() == 1 78 self.kind == PathKind::Plain && self.segments.len() == 1