runtime, macros: unify NaN-boxed value API under ValueVariant trait

This commit is contained in:
2026-07-15 00:01:34 +08:00
parent 7220b42024
commit a1a44a6652
28 changed files with 524 additions and 487 deletions
+4 -4
View File
@@ -13,8 +13,8 @@ pub fn to_path<'gc, M: Machine<'gc>>(
) -> Step {
// coerce to path THEN TO STRING
let val = m.force_and_retry::<StrictValue>(reader, mc)?;
if let Some(Path(s)) = val.as_inline::<Path>() {
return m.return_from_primop(Value::new_inline(s), reader);
if let Some(Path(s)) = val.downcast::<Path>() {
return m.return_from_primop(Value::new(s), reader);
}
let Some(s) = ctx.get_string(val) else {
return m.finish_err(Error::eval_error(format!(
@@ -29,7 +29,7 @@ pub fn to_path<'gc, M: Machine<'gc>>(
}
let canon = canon_path_str(s);
let sid = ctx.intern_string(canon);
m.return_from_primop(Value::new_inline(sid), reader)
m.return_from_primop(Value::new(sid), reader)
}
pub fn is_path<'gc, M: Machine<'gc>>(
@@ -39,5 +39,5 @@ pub fn is_path<'gc, M: Machine<'gc>>(
) -> Step {
let val = m.force_and_retry::<StrictValue>(reader, mc)?;
let is_path = val.is::<Path>();
m.return_from_primop(Value::new_inline(is_path), reader)
m.return_from_primop(Value::new(is_path), reader)
}