Skip to content

Commit

Permalink
Add rb_class_get_superclass function
Browse files Browse the repository at this point in the history
  • Loading branch information
andrykonchin committed Apr 1, 2024
1 parent 7a39da5 commit b37527a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/cext/ABI_check.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
17
4 changes: 4 additions & 0 deletions lib/truffle/truffle/cext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,10 @@ def rb_class_real(ruby_class)
ruby_class
end

def rb_class_get_superclass(ruby_class)
ruby_class.superclass || false
end

def rb_obj_respond_to(object, name, priv)
object.respond_to?(name, priv != 0)
end
Expand Down
4 changes: 4 additions & 0 deletions src/main/c/cext/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ VALUE rb_singleton_class(VALUE object) {
return RUBY_CEXT_INVOKE("rb_singleton_class", object);
}

VALUE rb_class_get_superclass(VALUE klass) {
return RUBY_CEXT_INVOKE("rb_class_get_superclass", klass);
}

VALUE rb_obj_alloc(VALUE ruby_class) {
return RUBY_INVOKE(ruby_class, "__allocate__");
}
Expand Down

0 comments on commit b37527a

Please sign in to comment.