fn create_closure(
      &mut self,
      env: &mut Environment,
      gc: &mut Memory,
      function_id: Opr24,
   ) -> GcRaw<Closure> {
      let function = unsafe { env.get_function_unchecked_mut(function_id) };
      let mut captures = Vec::new();
      if let FunctionKind::Bytecode {
         captured_locals, ..
      } = &function.kind
      {
         for capture in captured_locals {
            captures.push(match capture {
               CaptureKind::Local(slot) => {
                  self.get_upvalue_for_local(self.stack_bottom as u32 + u32::from(*slot))
               }
               CaptureKind::Upvalue(index) => {
                  let closure = unsafe { self.closure.unwrap_unchecked() };
                  let closure = unsafe { closure.get() };
                  Pin::clone(&closure.captures[u32::from(*index) as usize])
               }
            });
         }
      }
      gc.allocate(Closure {
         function_id,
         captures,
      })
   }
/// Constructs a closure from surrounding stack variables and upvalues.
Constructs a closure from surrounding stack variables and upvalues.
Constructs a closure from surrounding stack variables and upvalues .
fn create_closure(
      &mut self,
      env: &mut Environment,
      gc: &mut Memory,
      function_id: Opr24,
   ) -> GcRaw<Closure> {
      let function = unsafe { env.get_function_unchecked_mut(function_id) };
      let mut captures = Vec::new();
      if let FunctionKind::Bytecode {
         captured_locals, ..
      } = &function.kind
      {
         for capture in captured_locals {
            captures.push(match capture {
               CaptureKind::Local(slot) => {
                  self.get_upvalue_for_local(self.stack_bottom as u32 + u32::from(*slot))
               }
               CaptureKind::Upvalue(index) => {
                  let closure = unsafe { self.closure.unwrap_unchecked() };
                  let closure = unsafe { closure.get() };
                  Pin::clone(&closure.captures[u32::from(*index) as usize])
               }
            });
         }
      }
      gc.allocate(Closure {
         function_id,
         captures,
      })
   }
fn create_closure ( & mut self , env : & mut Environment , gc : & mut Memory , function_id : Opr24 , ) -> GcRaw < Closure > { let function = unsafe { env . get_function_unchecked_mut ( function_id ) } ; let mut captures = Vec :: new ( ) ; if let FunctionKind :: Bytecode { captured_locals , .. } = & function . kind { for capture in captured_locals { captures . push ( match capture { CaptureKind :: Local ( slot ) => { self . get_upvalue_for_local ( self . stack_bottom as u32 + u32 :: from ( * slot ) ) } CaptureKind :: Upvalue ( index ) => { let closure = unsafe { self . closure . unwrap_unchecked ( ) } ; let closure = unsafe { closure . get ( ) } ; Pin :: clone ( & closure . captures [ u32 :: from ( * index ) as usize ] ) } } ) ; } } gc . allocate ( Closure { function_id , captures , } ) }
Constructs a closure from surrounding stack variables and upvalues.
Constructs a closure from surrounding stack variables and upvalues .
&mut self
env
&mut Environment
gc
&mut Memory
function_id
Opr24