diff options
author | Alan Wu <[email protected]> | 2023-09-07 14:56:07 -0400 |
---|---|---|
committer | Alan Wu <[email protected]> | 2023-09-12 11:25:07 -0400 |
commit | 39ee3e22bd3d071c1c283b6b8dbd1af413342fb1 (patch) | |
tree | da6a4f4c93d1887d477776b7f4575d5146f702e4 /vm_args.c | |
parent | b90272b3b661bd2fd557332028b8feb568b6b9df (diff) |
Make Kernel#lambda raise when given non-literal block
Previously, Kernel#lambda returned a non-lambda proc when given a
non-literal block and issued a warning under the `:deprecated` category.
With this change, Kernel#lambda will always return a lambda proc, if it
returns without raising.
Due to interactions with block passing optimizations, we previously had
two separate code paths for detecting whether Kernel#lambda got a
literal block. This change allows us to remove one path, the hack done
with rb_control_frame_t::block_code introduced in 85a337f for supporting
situations where Kernel#lambda returned a non-lambda proc.
[Feature #19777]
Co-authored-by: Takashi Kokubun <[email protected]>
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/8405
Diffstat (limited to 'vm_args.c')
-rw-r--r-- | vm_args.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -885,10 +885,7 @@ vm_caller_setup_arg_block(const rb_execution_context_t *ec, rb_control_frame_t * return VM_BLOCK_HANDLER_NONE; } else if (block_code == rb_block_param_proxy) { - VM_ASSERT(!VM_CFP_IN_HEAP_P(GET_EC(), reg_cfp)); - VALUE handler = VM_CF_BLOCK_HANDLER(reg_cfp); - reg_cfp->block_code = (const void *) handler; - return handler; + return VM_CF_BLOCK_HANDLER(reg_cfp); } else if (SYMBOL_P(block_code) && rb_method_basic_definition_p(rb_cSymbol, idTo_proc)) { const rb_cref_t *cref = vm_env_cref(reg_cfp->ep); |