Commit f4386402
f4386402d8ffMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 4 files · +2 added · ~2 modified
Description
Merge pull request #951 from ryanseys/rs-class-superclass-object
codegen: Class#superclass returns Object for parentless classes
Details
- Commit
- f4386402d8ff
- Parent
- 125646e40527
- Merge parent
- 1b98c4681c89
spinel_codegen.rbmodifiedView file
@@ -8419,6 +8419,10 @@
84198419
# Parent name might be a built-in (e.g., `class Foo < Numeric`)84208420
ppidx = builtin_class_id_for_name(ppname)84218421
end8422+
else8423+
# No explicit parent → Object. Without this default, `A.superclass`8424+
# returned the -1 nil sentinel and printed empty instead of `Object`.8425+
ppidx = builtin_class_id_for_name("Object")84228426
end84238427
parents_line = parents_line + ppidx.to_s + "LL"84248428
pi_pl = pi_pl + 1test/class_hierarchy.rbmodifiedView file
Loading diff…
test/class_superclass.rbaddedView file
Loading diff…
test/class_superclass.rb.expectedaddedView file
Loading diff…