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
@@ -13,7 +13,7 @@ pub(crate) fn op_lookup_with<'gc, M: Machine<'gc>>(
mc: &gc_arena::Mutation<'gc>,
) -> Step {
#[allow(clippy::unwrap_used)]
let counter = m.peek_forced(0).as_inline::<i32>().unwrap();
let counter = m.peek_forced(0).downcast::<i32>().unwrap();
let name = reader.read_string_id();
let n = reader.read_u8();
@@ -57,7 +57,7 @@ pub(crate) fn op_lookup_with<'gc, M: Machine<'gc>>(
};
if let Some(val) = namespace
.as_gc::<AttrSet>()
.downcast::<AttrSet>()
.and_then(|attrs| attrs.lookup(name))
{
m.replace(0, val);
@@ -67,7 +67,7 @@ pub(crate) fn op_lookup_with<'gc, M: Machine<'gc>>(
Symbol::from(ctx.resolve_string(name))
)));
} else {
m.replace(0, Value::new_inline(counter + 1));
m.replace(0, Value::new(counter + 1));
reader.set_pc(resume_pc);
}