diff options
Diffstat (limited to 'internal.h')
-rw-r--r-- | internal.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/internal.h b/internal.h index d05d5366dd..a789fd887e 100644 --- a/internal.h +++ b/internal.h @@ -790,15 +790,30 @@ struct vm_throw_data { /* IFUNC */ +struct vm_ifunc_argc { +#if SIZEOF_INT * 2 > SIZEOF_VALUE + int min: (SIZEOF_VALUE * CHAR_BIT) / 2; + int max: (SIZEOF_VALUE * CHAR_BIT) / 2; +#else + int min, max; +#endif +}; + struct vm_ifunc { VALUE flags; VALUE reserved; VALUE (*func)(ANYARGS); const void *data; - ID id; + struct vm_ifunc_argc argc; }; #define IFUNC_NEW(a, b, c) ((struct vm_ifunc *)rb_imemo_new(imemo_ifunc, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0)) +struct vm_ifunc *rb_vm_ifunc_new(VALUE (*func)(ANYARGS), const void *data, int min_argc, int max_argc); +static inline struct vm_ifunc * +rb_vm_ifunc_proc_new(VALUE (*func)(ANYARGS), const void *data) +{ + return rb_vm_ifunc_new(func, data, 0, UNLIMITED_ARGUMENTS); +} /* MEMO */ @@ -1335,8 +1350,9 @@ ID rb_id_attrget(ID id); VALUE rb_proc_location(VALUE self); st_index_t rb_hash_proc(st_index_t hash, VALUE proc); int rb_block_arity(void); +int rb_block_min_max_arity(int *max); VALUE rb_func_proc_new(rb_block_call_func_t func, VALUE val); -VALUE rb_func_lambda_new(rb_block_call_func_t func, VALUE val); +VALUE rb_func_lambda_new(rb_block_call_func_t func, VALUE val, int min_argc, int max_argc); /* process.c */ #define RB_MAX_GROUPS (65536) @@ -1596,6 +1612,9 @@ VALUE rb_check_funcall_default(VALUE, ID, int, const VALUE *, VALUE); VALUE rb_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, int *stateptr); VALUE rb_yield_1(VALUE val); VALUE rb_yield_lambda(VALUE values); +VALUE rb_lambda_call(VALUE obj, ID mid, int argc, const VALUE *argv, + rb_block_call_func_t bl_proc, int min_argc, int max_argc, + VALUE data2); /* vm_insnhelper.c */ VALUE rb_equal_opt(VALUE obj1, VALUE obj2); |