mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
revert r59017 it fails ruby/test_lambda.rb
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
424b4ffe30
commit
1a6e648075
2 changed files with 7 additions and 5 deletions
4
vm.c
4
vm.c
|
@ -1078,11 +1078,11 @@ check_block_handler(rb_thread_t *th)
|
|||
}
|
||||
|
||||
static VALUE
|
||||
vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const rb_cref_t *cref)
|
||||
vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const rb_cref_t *cref, int is_lambda)
|
||||
{
|
||||
return invoke_block_from_c_bh(th, check_block_handler(th),
|
||||
argc, argv, VM_BLOCK_HANDLER_NONE,
|
||||
cref, FALSE, FALSE);
|
||||
cref, is_lambda, FALSE);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
|
@ -16,7 +16,7 @@ struct local_var_list {
|
|||
};
|
||||
|
||||
static inline VALUE method_missing(VALUE obj, ID id, int argc, const VALUE *argv, enum method_missing_reason call_status);
|
||||
static inline VALUE vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const rb_cref_t *cref);
|
||||
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_force_blockarg(rb_thread_t *th, VALUE args);
|
||||
|
@ -1573,6 +1573,7 @@ yield_under(VALUE under, VALUE self, int argc, const VALUE *argv)
|
|||
struct rb_captured_block new_captured;
|
||||
const VALUE *ep = NULL;
|
||||
rb_cref_t *cref;
|
||||
int is_lambda = FALSE;
|
||||
|
||||
if (block_handler != VM_BLOCK_HANDLER_NONE) {
|
||||
again:
|
||||
|
@ -1588,6 +1589,7 @@ yield_under(VALUE under, VALUE self, int argc, const VALUE *argv)
|
|||
new_block_handler = VM_BH_FROM_IFUNC_BLOCK(&new_captured);
|
||||
break;
|
||||
case block_handler_type_proc:
|
||||
is_lambda = rb_proc_lambda_p(block_handler) != Qfalse;
|
||||
block_handler = vm_proc_to_block_handler(VM_BH_TO_PROC(block_handler));
|
||||
goto again;
|
||||
case block_handler_type_symbol:
|
||||
|
@ -1602,7 +1604,7 @@ yield_under(VALUE under, VALUE self, int argc, const VALUE *argv)
|
|||
}
|
||||
|
||||
cref = vm_cref_push(th, under, ep, TRUE);
|
||||
return vm_yield_with_cref(th, argc, argv, cref);
|
||||
return vm_yield_with_cref(th, argc, argv, cref, is_lambda);
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
@ -1623,7 +1625,7 @@ rb_yield_refine_block(VALUE refinement, VALUE refinements)
|
|||
CREF_REFINEMENTS_SET(cref, refinements);
|
||||
VM_FORCE_WRITE_SPECIAL_CONST(&VM_CF_LEP(th->ec.cfp)[VM_ENV_DATA_INDEX_SPECVAL], new_block_handler);
|
||||
new_captured.self = refinement;
|
||||
return vm_yield_with_cref(th, 0, NULL, cref);
|
||||
return vm_yield_with_cref(th, 0, NULL, cref, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue