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

This commit is contained in:
2026-07-15 19:11:03 +08:00
parent 7220b42024
commit 09ee923903
28 changed files with 510 additions and 490 deletions
+3 -3
View File
@@ -16,8 +16,8 @@ pub fn to_string<'gc, M: Machine<'gc>>(
if val.is::<StringId>() || val.is::<NixString>() {
return m.return_from_primop(val.relax(), reader);
}
if let Some(p) = val.as_inline::<Path>() {
return m.return_from_primop(Value::new_inline(p.0), reader);
if let Some(p) = val.downcast::<Path>() {
return m.return_from_primop(Value::new(p.0), reader);
}
// TODO: derivations / `__toString` / `outPath`,
// numbers, lists.
@@ -47,5 +47,5 @@ pub fn type_of<'gc, M: Machine<'gc>>(
NixType::Thunk => unreachable!("forced"),
};
let sid = ctx.intern_string(name);
m.return_from_primop(Value::new_inline(sid), reader)
m.return_from_primop(Value::new(sid), reader)
}