cl-ast: Switch from old string interner to new string interner
Update cl-parser, et. al. to match.
This commit is contained in:
parent
2c57f848ea
commit
3fe5916a4f
@ -9,9 +9,9 @@
|
|||||||
//! - [AssignKind], [BinaryKind], and [UnaryKind] operators
|
//! - [AssignKind], [BinaryKind], and [UnaryKind] operators
|
||||||
//! - [Ty] and [TyKind]: Type qualifiers
|
//! - [Ty] and [TyKind]: Type qualifiers
|
||||||
//! - [Path]: Path expressions
|
//! - [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
|
/// Whether a binding ([Static] or [Let]) or reference is mutable or not
|
||||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||||
|
@ -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::Int(a), ConValue::Int(b)) => Ok(ConValue::Bool(a $op b)),
|
||||||
(ConValue::Bool(a), ConValue::Bool(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::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)
|
_ => Err(Error::TypeError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ pub mod temp_type_impl {
|
|||||||
(Self::Int(a), Self::Int(b)) => Ok(Self::Bool(a $op b)),
|
(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::Bool(a), Self::Bool(b)) => Ok(Self::Bool(a $op b)),
|
||||||
(Self::Char(a), Self::Char(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)
|
_ => Err(Error::TypeError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,8 @@ impl Fold for ModuleInliner {
|
|||||||
/// Traverses down the module tree, entering ever nested directories
|
/// Traverses down the module tree, entering ever nested directories
|
||||||
fn fold_module(&mut self, m: Module) -> Module {
|
fn fold_module(&mut self, m: Module) -> Module {
|
||||||
let Module { name, kind } = m;
|
let Module { name, kind } = m;
|
||||||
let sym = name.0.get().expect("Could not get name!");
|
let sym = name.0;
|
||||||
self.path.push(sym); // cd ./name
|
self.path.push(&*sym); // cd ./name
|
||||||
|
|
||||||
let kind = self.fold_module_kind(kind);
|
let kind = self.fold_module_kind(kind);
|
||||||
|
|
||||||
|
@ -63,8 +63,7 @@ impl<'a> TypeResolvable<'a> for Meta {
|
|||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
fn resolve_type(&'a self, prj: &mut Prj<'a>, id: DefID) -> Result<Self::Out, &'static str> {
|
fn resolve_type(&'a self, prj: &mut Prj<'a>, id: DefID) -> Result<Self::Out, &'static str> {
|
||||||
let Self { name: Identifier(name), kind } = self;
|
let Self { name: Identifier(name), kind } = self;
|
||||||
let name = name.get().unwrap_or_default();
|
match (name.as_ref(), kind) {
|
||||||
match (name.as_str(), kind) {
|
|
||||||
("intrinsic", MetaKind::Equals(Literal::String(intrinsic))) => Ok(DefKind::Type(
|
("intrinsic", MetaKind::Equals(Literal::String(intrinsic))) => Ok(DefKind::Type(
|
||||||
TypeKind::Intrinsic(intrinsic.parse().map_err(|_| "unknown intrinsic type")?),
|
TypeKind::Intrinsic(intrinsic.parse().map_err(|_| "unknown intrinsic type")?),
|
||||||
)),
|
)),
|
||||||
|
Loading…
Reference in New Issue
Block a user