From 85b5d4c8bf4cdcba4f1af65f2bc0c8ac716cb795 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 13 Jan 2021 16:49:05 +0900 Subject: Revert "[Bug #11213] let defined?(super) call respond_to_missing?" This reverts commit fac2498e0299f13dffe4f09a7dd7657fb49bf643 for now, due to [Bug #17509], the breakage in the case `super` is called in `respond_to?`. --- vm_method.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'vm_method.c') diff --git a/vm_method.c b/vm_method.c index a933729faa..61b27da513 100644 --- a/vm_method.c +++ b/vm_method.c @@ -2435,8 +2435,9 @@ basic_obj_respond_to_missing(rb_execution_context_t *ec, VALUE klass, VALUE obj, } static inline int -basic_obj_respond_to(rb_execution_context_t *ec, VALUE klass, VALUE obj, ID id, int pub) +basic_obj_respond_to(rb_execution_context_t *ec, VALUE obj, ID id, int pub) { + VALUE klass = CLASS_OF(obj); VALUE ret; switch (method_boundp(klass, id, pub|BOUND_RESPONDS)) { @@ -2506,14 +2507,15 @@ int rb_obj_respond_to(VALUE obj, ID id, int priv) { rb_execution_context_t *ec = GET_EC(); - return rb_ec_obj_respond_to(ec, CLASS_OF(obj), obj, id, priv); + return rb_ec_obj_respond_to(ec, obj, id, priv); } int -rb_ec_obj_respond_to(rb_execution_context_t *ec, VALUE klass, VALUE obj, ID id, int priv) +rb_ec_obj_respond_to(rb_execution_context_t *ec, VALUE obj, ID id, int priv) { + VALUE klass = CLASS_OF(obj); int ret = vm_respond_to(ec, klass, obj, id, priv); - if (ret == -1) ret = basic_obj_respond_to(ec, klass, obj, id, !priv); + if (ret == -1) ret = basic_obj_respond_to(ec, obj, id, !priv); return ret; } @@ -2558,7 +2560,7 @@ obj_respond_to(int argc, VALUE *argv, VALUE obj) if (ret == Qundef) ret = Qfalse; return ret; } - if (basic_obj_respond_to(ec, CLASS_OF(obj), obj, id, !RTEST(priv))) + if (basic_obj_respond_to(ec, obj, id, !RTEST(priv))) return Qtrue; return Qfalse; } -- cgit v1.2.3