summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2020-11-12 13:19:41 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2020-11-13 11:46:08 -0500
commit782621054178c5518b76cd5a1ee3588daf69854f (patch)
tree57064782ffbf181103d8335d484cf72237603a63 /class.c
parent1bd98ee295ee339ce36def71d8b031bdb816dc80 (diff)
Use rb_attr_get() for hidden ivar
rb_ivar_get() can issue an uninitialized ivar warning. We never want to issue warnings about hidden ivars as they are not actionable for users.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3763
Diffstat (limited to 'class.c')
-rw-r--r--class.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/class.c b/class.c
index 7cc087f..48450a5 100644
--- a/class.c
+++ b/class.c
@@ -1811,7 +1811,7 @@ singleton_class_of(VALUE obj)
klass = RBASIC(obj)->klass;
if (!(FL_TEST(klass, FL_SINGLETON) &&
- rb_ivar_get(klass, id_attached) == obj)) {
+ rb_attr_get(klass, id_attached) == obj)) {
rb_serial_t serial = RCLASS_SERIAL(klass);
klass = rb_make_metaclass(obj, klass);
RCLASS_SERIAL(klass) = serial;
@@ -1852,7 +1852,7 @@ rb_singleton_class_get(VALUE obj)
}
klass = RBASIC(obj)->klass;
if (!FL_TEST(klass, FL_SINGLETON)) return Qnil;
- if (rb_ivar_get(klass, id_attached) != obj) return Qnil;
+ if (rb_attr_get(klass, id_attached) != obj) return Qnil;
return klass;
}