cl-interpret: References, part 3
MODS ARE ASLEEP POST FAT BEAGLE
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//! Utils for [Path]
|
||||
use crate::{ast::Path, PathPart, Sym};
|
||||
use crate::{PathPart, Sym, ast::Path};
|
||||
|
||||
impl Path {
|
||||
/// Appends a [PathPart] to this [Path]
|
||||
@@ -21,6 +21,13 @@ impl Path {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_sym(&self) -> Option<Sym> {
|
||||
match self.parts.as_slice() {
|
||||
[PathPart::Ident(name)] => Some(*name),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks whether this path ends in the given [Sym]
|
||||
pub fn ends_with(&self, name: &str) -> bool {
|
||||
match self.parts.as_slice() {
|
||||
|
||||
Reference in New Issue
Block a user