ruby-changes:63277
From: Nobuyoshi <ko1@a...>
Date: Tue, 6 Oct 2020 11:33:20 +0900 (JST)
Subject: [ruby-changes:63277] 68d24bc045 (master): Moved rb_callable_receiver internal
https://git.ruby-lang.org/ruby.git/commit/?id=68d24bc045 From 68d24bc04549f04f0bbc40121c115fbbb7caf716 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 6 Oct 2020 09:56:49 +0900 Subject: Moved rb_callable_receiver internal diff --git a/include/ruby/internal/intern/proc.h b/include/ruby/internal/intern/proc.h index 24336a6..d6f77cb 100644 --- a/include/ruby/internal/intern/proc.h +++ b/include/ruby/internal/intern/proc.h @@ -46,7 +46,6 @@ VALUE rb_method_call_with_block(int, const VALUE *, VALUE, VALUE); https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/intern/proc.h#L46 VALUE rb_method_call_with_block_kw(int, const VALUE *, VALUE, VALUE, int); int rb_mod_method_arity(VALUE, ID); int rb_obj_method_arity(VALUE, ID); -VALUE rb_callable_receiver(VALUE); VALUE rb_protect(VALUE (*)(VALUE), VALUE, int*); RBIMPL_SYMBOL_EXPORT_END() diff --git a/internal/proc.h b/internal/proc.h index 3d4c611..5628a1f 100644 --- a/internal/proc.h +++ b/internal/proc.h @@ -21,6 +21,7 @@ int rb_block_pair_yield_optimizable(void); https://github.com/ruby/ruby/blob/trunk/internal/proc.h#L21 int rb_block_arity(void); 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_callable_receiver(VALUE); MJIT_SYMBOL_EXPORT_BEGIN VALUE rb_func_proc_new(rb_block_call_func_t func, VALUE val); diff --git a/proc.c b/proc.c index 96c84d2..b6285b1 100644 --- a/proc.c +++ b/proc.c @@ -2740,13 +2740,16 @@ rb_obj_method_arity(VALUE obj, ID id) https://github.com/ruby/ruby/blob/trunk/proc.c#L2740 } VALUE -rb_callable_receiver(VALUE callable) { +rb_callable_receiver(VALUE callable) +{ if (rb_obj_is_proc(callable)) { VALUE binding = rb_funcall(callable, rb_intern("binding"), 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); - } else { + } + else { return Qundef; } } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/