Skip to main content

luaur_vm/functions/
validateref.rs

1use crate::functions::validateobjref::validateobjref;
2use crate::macros::gcvalue::gcvalue;
3use crate::macros::iscollectable::iscollectable;
4use crate::macros::ttype::ttype;
5use crate::records::gc_object::GCObject;
6use crate::records::global_state::global_State;
7use crate::type_aliases::t_value::TValue;
8use luaur_common::macros::luau_assert::LUAU_ASSERT;
9
10#[allow(non_snake_case)]
11pub(crate) unsafe fn validateref(g: *mut global_State, f: *mut GCObject, v: *mut TValue) {
12    if iscollectable!(v) {
13        LUAU_ASSERT!(ttype!(v) == (*gcvalue!(v)).gch.tt as i32);
14        validateobjref(g, f, gcvalue!(v));
15    }
16}