Removed a copious amount of premature Rc-s

This commit is contained in:
2023-06-18 04:22:20 +01:00
parent aebbf51228
commit 79e28883db
56 changed files with 716 additions and 636 deletions

View File

@@ -0,0 +1,34 @@
use crate::interner::{Interner, Tok};
/// A mutable representation of a namespaced identifier.
///
/// These names may be relative or otherwise partially processed.
///
/// See also [Sym]
pub type VName = Vec<Tok<String>>;
/// An interned representation of a namespaced identifier.
///
/// These names are always absolute.
///
/// See also [VName]
pub type Sym = Tok<Vec<Tok<String>>>;
/// An abstraction over tokenized vs non-tokenized names so that they can be
/// handled together in datastructures
pub trait NameLike: 'static + Clone + Eq {
/// Fully resolve the name for printing
fn to_strv(&self, i: &Interner) -> Vec<String>;
}
impl NameLike for Sym {
fn to_strv(&self, i: &Interner) -> Vec<String> {
i.extern_vec(*self)
}
}
impl NameLike for VName {
fn to_strv(&self, i: &Interner) -> Vec<String> {
i.extern_all(self)
}
}