cl-interpret: References, part 3

MODS ARE ASLEEP
POST FAT BEAGLE
This commit is contained in:
2025-03-14 08:33:46 -05:00
parent 9b460afed4
commit fa5244dcf9
3 changed files with 102 additions and 14 deletions

View File

@@ -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() {