Moved rb_callable_receiver internal
This commit is contained in:
parent
29c54b5e03
commit
68d24bc045
@ -46,7 +46,6 @@ VALUE rb_method_call_with_block(int, const VALUE *, VALUE, VALUE);
|
|||||||
VALUE rb_method_call_with_block_kw(int, const VALUE *, VALUE, VALUE, int);
|
VALUE rb_method_call_with_block_kw(int, const VALUE *, VALUE, VALUE, int);
|
||||||
int rb_mod_method_arity(VALUE, ID);
|
int rb_mod_method_arity(VALUE, ID);
|
||||||
int rb_obj_method_arity(VALUE, ID);
|
int rb_obj_method_arity(VALUE, ID);
|
||||||
VALUE rb_callable_receiver(VALUE);
|
|
||||||
VALUE rb_protect(VALUE (*)(VALUE), VALUE, int*);
|
VALUE rb_protect(VALUE (*)(VALUE), VALUE, int*);
|
||||||
|
|
||||||
RBIMPL_SYMBOL_EXPORT_END()
|
RBIMPL_SYMBOL_EXPORT_END()
|
||||||
|
@ -21,6 +21,7 @@ int rb_block_pair_yield_optimizable(void);
|
|||||||
int rb_block_arity(void);
|
int rb_block_arity(void);
|
||||||
int rb_block_min_max_arity(int *max);
|
int rb_block_min_max_arity(int *max);
|
||||||
VALUE rb_block_to_s(VALUE self, const struct rb_block *block, const char *additional_info);
|
VALUE rb_block_to_s(VALUE self, const struct rb_block *block, const char *additional_info);
|
||||||
|
VALUE rb_callable_receiver(VALUE);
|
||||||
|
|
||||||
MJIT_SYMBOL_EXPORT_BEGIN
|
MJIT_SYMBOL_EXPORT_BEGIN
|
||||||
VALUE rb_func_proc_new(rb_block_call_func_t func, VALUE val);
|
VALUE rb_func_proc_new(rb_block_call_func_t func, VALUE val);
|
||||||
|
9
proc.c
9
proc.c
@ -2740,13 +2740,16 @@ rb_obj_method_arity(VALUE obj, ID id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_callable_receiver(VALUE callable) {
|
rb_callable_receiver(VALUE callable)
|
||||||
|
{
|
||||||
if (rb_obj_is_proc(callable)) {
|
if (rb_obj_is_proc(callable)) {
|
||||||
VALUE binding = rb_funcall(callable, rb_intern("binding"), 0);
|
VALUE binding = rb_funcall(callable, rb_intern("binding"), 0);
|
||||||
return rb_funcall(binding, rb_intern("receiver"), 0);
|
return rb_funcall(binding, rb_intern("receiver"), 0);
|
||||||
} else if (rb_obj_is_method(callable)) {
|
}
|
||||||
|
else if (rb_obj_is_method(callable)) {
|
||||||
return method_receiver(callable);
|
return method_receiver(callable);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return Qundef;
|
return Qundef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user