opportunistic move
should be way faster now
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user