Skip to main content

patch_seq_push_closure

Function patch_seq_push_closure 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn patch_seq_push_closure( stack: Stack, fn_ptr: u64, capture_count: i32, ) -> Stack
Expand description

Create closure from function pointer and stack values (all-in-one helper)

Pops capture_count values from stack and creates a closure environment indexed bottom-to-top: env[0] is the caller’s deepest capture, env[N-1] is the caller’s shallowest (the value that was on top just before this call). This matches the typechecker’s capture-type vector and preserves the caller’s visual stack order inside the closure body.

§Safety

  • fn_ptr must be a valid function pointer
  • stack must have at least capture_count values