diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-19 01:11:12 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-19 01:11:12 +0000 |
commit | 976becf7eb18aa1592c703ac4d86a2cf9dfa701e (patch) | |
tree | ea2cf60b1ebf58b756e896484440036f5f3ba2cd /vm_eval.c | |
parent | a9d575e507e1ce181ed71b9a7d4c3ad4f2f23e59 (diff) |
vm_args.c: arity check of lambda
* vm_eval.c (rb_yield_lambda): new function which yields an array
to a proc and splat to a lambda. mainly for Enumerable only.
* vm_args.c (setup_parameters_complex): remove special lambda
splatting for [Bug #9605]. [ruby-core:77065] [Bug #12705]
* vm_insnhelper.c (vm_callee_setup_block_arg): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r-- | vm_eval.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -19,6 +19,7 @@ static inline VALUE method_missing(VALUE obj, ID id, int argc, const VALUE *argv static inline VALUE vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const rb_cref_t *cref, int is_lambda); static inline VALUE vm_yield(rb_thread_t *th, int argc, const VALUE *argv); static inline VALUE vm_yield_with_block(rb_thread_t *th, int argc, const VALUE *argv, VALUE block_handler); +static inline VALUE vm_yield_lambda_splattable(rb_thread_t *th, VALUE args); static VALUE vm_exec(rb_thread_t *th); static void vm_set_eval_stack(rb_thread_t * th, const rb_iseq_t *iseq, const rb_cref_t *cref, const struct rb_block *base_block); static int vm_collect_local_variables_in_heap(rb_thread_t *th, const VALUE *dfp, const struct local_var_list *vars); @@ -1068,6 +1069,12 @@ rb_yield_splat(VALUE values) } VALUE +rb_yield_lambda(VALUE values) +{ + return vm_yield_lambda_splattable(GET_THREAD(), values); +} + +VALUE rb_yield_block(VALUE val, VALUE arg, int argc, const VALUE *argv, VALUE blockarg) { return vm_yield_with_block(GET_THREAD(), argc, argv, |