opportunistic move

should be way faster now
This commit is contained in:
2023-09-16 12:57:50 +01:00
parent 0bcf10659b
commit 1078835e8b
36 changed files with 535 additions and 521 deletions

View File

@@ -2,8 +2,7 @@ use std::fmt::Display;
use std::rc::Rc;
use crate::foreign::ExternError;
use crate::systems::cast_exprinst::with_str;
use crate::{define_fn, ConstTree, Interner};
use crate::{define_fn, ConstTree, Interner, OrcString};
/// An unrecoverable error in Orchid land. Because Orchid is lazy, this only
/// invalidates expressions that reference the one that generated it.
@@ -19,10 +18,10 @@ impl ExternError for OrchidPanic {}
define_fn! {
/// Takes a message, returns an [ExternError] unconditionally.
Panic = |x| with_str(x, |s| {
let msg = Rc::new(s.get_string());
Panic = |x| {
let msg = Rc::new(x.downcast::<OrcString>()?.get_string());
Err(OrchidPanic(msg).into_extern())
})
}
}
pub fn panic(i: &Interner) -> ConstTree {