Explorar o código

Added vm field to gravity_closure_t (it could be very useful in case of closure execution on bridge)

Marco Bambini %!s(int64=5) %!d(string=hai) anos
pai
achega
6f5473b9a4
Modificáronse 2 ficheiros con 2 adicións e 0 borrados
  1. 1 0
      src/shared/gravity_value.c
  2. 1 0
      src/shared/gravity_value.h

+ 1 - 0
src/shared/gravity_value.c

@@ -1225,6 +1225,7 @@ gravity_closure_t *gravity_closure_new (gravity_vm *vm, gravity_function_t *f) {
     assert(closure);
 
     closure->isa = gravity_class_closure;
+    closure->vm = vm;
     closure->f = f;
 
     // allocate upvalue array (+1 so I can simplify the iterator without the needs to access closure->f->nupvalues)

+ 1 - 0
src/shared/gravity_value.h

@@ -294,6 +294,7 @@ typedef struct gravity_closure_s {
     gravity_class_t         *isa;           // to be an object
     gravity_gc_t            gc;             // to be collectable by the garbage collector
 
+    gravity_vm              *vm;            // vm bound to this closure (useful when executed from a bridge)
     gravity_function_t      *f;             // function prototype
     gravity_object_t        *context;       // context where the closure has been created (or object bound by the user)
     gravity_upvalue_t       **upvalue;      // upvalue array