cl-ast: Switch from old string interner to new string interner

Update cl-parser, et. al. to match.
This commit is contained in:
John 2024-04-27 20:24:11 -05:00
parent 2c57f848ea
commit 3fe5916a4f
5 changed files with 7 additions and 8 deletions

View File

@ -9,9 +9,9 @@
//! - [AssignKind], [BinaryKind], and [UnaryKind] operators
//! - [Ty] and [TyKind]: Type qualifiers
//! - [Path]: Path expressions
use cl_structures::span::*;
use cl_structures::{intern::interned::Interned, span::*};
pub use cl_structures::arena::global_intern::Sym;
pub type Sym = Interned<'static, str>;
/// Whether a binding ([Static] or [Let]) or reference is mutable or not
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]

View File

@ -243,7 +243,7 @@ macro cmp ($a:expr, $b:expr, $empty:literal, $op:tt) {
(ConValue::Int(a), ConValue::Int(b)) => Ok(ConValue::Bool(a $op b)),
(ConValue::Bool(a), ConValue::Bool(b)) => Ok(ConValue::Bool(a $op b)),
(ConValue::Char(a), ConValue::Char(b)) => Ok(ConValue::Bool(a $op b)),
(ConValue::String(a), ConValue::String(b)) => Ok(ConValue::Bool(a.get() $op b.get())),
(ConValue::String(a), ConValue::String(b)) => Ok(ConValue::Bool(&**a $op &**b)),
_ => Err(Error::TypeError)
}
}

View File

@ -148,7 +148,7 @@ pub mod temp_type_impl {
(Self::Int(a), Self::Int(b)) => Ok(Self::Bool(a $op b)),
(Self::Bool(a), Self::Bool(b)) => Ok(Self::Bool(a $op b)),
(Self::Char(a), Self::Char(b)) => Ok(Self::Bool(a $op b)),
(Self::String(a), Self::String(b)) => Ok(Self::Bool(a.get() $op b.get())),
(Self::String(a), Self::String(b)) => Ok(Self::Bool(&**a $op &**b)),
_ => Err(Error::TypeError)
}
}

View File

@ -64,8 +64,8 @@ impl Fold for ModuleInliner {
/// Traverses down the module tree, entering ever nested directories
fn fold_module(&mut self, m: Module) -> Module {
let Module { name, kind } = m;
let sym = name.0.get().expect("Could not get name!");
self.path.push(sym); // cd ./name
let sym = name.0;
self.path.push(&*sym); // cd ./name
let kind = self.fold_module_kind(kind);

View File

@ -63,8 +63,7 @@ impl<'a> TypeResolvable<'a> for Meta {
#[allow(unused_variables)]
fn resolve_type(&'a self, prj: &mut Prj<'a>, id: DefID) -> Result<Self::Out, &'static str> {
let Self { name: Identifier(name), kind } = self;
let name = name.get().unwrap_or_default();
match (name.as_str(), kind) {
match (name.as_ref(), kind) {
("intrinsic", MetaKind::Equals(Literal::String(intrinsic))) => Ok(DefKind::Type(
TypeKind::Intrinsic(intrinsic.parse().map_err(|_| "unknown intrinsic type")?),
)),