luaur_code_gen/methods/
standalone_code_gen_context_on_destroy_function.rs1use crate::functions::destroy_native_proto_exec_data::destroy_native_proto_exec_data;
2use crate::functions::get_native_proto_exec_data_header_native_proto_exec_data_alt_b::get_native_proto_exec_data_header;
3use crate::records::standalone_code_gen_context::StandaloneCodeGenContext;
4use core::ffi::c_void;
5use luaur_common::FFlag;
6
7impl StandaloneCodeGenContext {
8 pub fn standalone_code_gen_context_on_destroy_function(execdata: *mut c_void) {
9 unsafe {
10 if FFlag::LuauCodegenFreeBlocks.get() {
11 let header = get_native_proto_exec_data_header(execdata as *const u32);
12 (*header).native_module.as_ref().unwrap().release();
13 } else {
14 destroy_native_proto_exec_data(execdata as *mut u32);
15 }
16 }
17 }
18}