Skip to content

Commit 8e92596

Browse files
committed
CExt #respond_to? calls a Ruby method instead of Primitive
1 parent fdee011 commit 8e92596

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/truffle/truffle/cext.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def rb_class_real(ruby_class)
413413
end
414414

415415
def rb_obj_respond_to(object, id, priv)
416-
Primitive.object_respond_to?(object, id, priv != 0)
416+
object.respond_to?(id, priv != 0)
417417
end
418418

419419
def rb_check_convert_type(obj, type_name, method)
@@ -843,7 +843,7 @@ def rb_funcall_with_block(recv, meth, args, block)
843843
end
844844

845845
def rb_respond_to(object, name)
846-
object.respond_to?(name)
846+
rb_obj_respond_to(object, name, false);
847847
end
848848

849849
def rb_funcallv_public(recv, meth, args)

src/main/c/cext/range.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ VALUE rb_range_new(VALUE beg, VALUE end, int exclude_end) {
1515
*/
1616
int rb_range_values(VALUE range, VALUE *begp, VALUE *endp, int *exclp) {
1717
if (!rb_obj_is_kind_of(range, rb_cRange)) {
18-
if (!RTEST(RUBY_INVOKE(range, "respond_to?", rb_intern("begin")))) return Qfalse;
19-
if (!RTEST(RUBY_INVOKE(range, "respond_to?", rb_intern("end")))) return Qfalse;
18+
if (!rb_respond_to(range, rb_intern("begin"))) return Qfalse;
19+
if (!rb_respond_to(range, rb_intern("end"))) return Qfalse;
2020
}
2121

2222
*begp = RUBY_INVOKE(range, "begin");

0 commit comments

Comments
 (0)