runtime, macros: unify NaN-boxed value API under ValueVariant trait
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user