Skip to main content

luaur_repl_cli/functions/
coverage_track.rs

1use luaur_vm::functions::lua_ref::lua_ref;
2use luaur_vm::type_aliases::lua_state::lua_State;
3
4use crate::functions::coverage_init::G_COVERAGE;
5
6// Faithful port of:
7//     void coverageTrack(lua_State* L, int funcindex) {
8//         int ref = lua_ref(L, funcindex);
9//         gCoverage.functions.push_back(ref);
10//     }
11pub fn coverage_track(l: *mut lua_State, funcindex: i32) {
12    unsafe {
13        let ref_id = lua_ref(l, funcindex);
14        (*core::ptr::addr_of_mut!(G_COVERAGE))
15            .functions
16            .push(ref_id);
17    }
18}