aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--class.c4
-rw-r--r--object.c7
-rw-r--r--variable.c7
4 files changed, 18 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index fca190f6ae..9fa0f70f08 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Jan 13 03:42:58 2016 Eric Wong <e@80x24.org>
+
+ * class.c (Init_class_hierarchy): resolve name for rb_cObject ASAP
+ * object.c (rb_mod_const_set): move name resolution to rb_const_set
+ * variable.c (rb_const_set): do class resolution here
+ [ruby-core:72807] [Bug #11977]
+
Wed Jan 13 00:37:12 2016 Satoshi Ohmori <sachin21dev@gmail.com>
* man/ruby.1: fix double word typo. [Fix GH-1194]
diff --git a/class.c b/class.c
index 5c72a4b3c9..b4eaabc250 100644
--- a/class.c
+++ b/class.c
@@ -547,6 +547,10 @@ Init_class_hierarchy(void)
{
rb_cBasicObject = boot_defclass("BasicObject", 0);
rb_cObject = boot_defclass("Object", rb_cBasicObject);
+
+ /* resolve class name ASAP for order-independence */
+ rb_class_name(rb_cObject);
+
rb_cModule = boot_defclass("Module", rb_cObject);
rb_cClass = boot_defclass("Class", rb_cModule);
diff --git a/object.c b/object.c
index 53354e928b..2497043b46 100644
--- a/object.c
+++ b/object.c
@@ -2178,13 +2178,6 @@ rb_mod_const_set(VALUE mod, VALUE name, VALUE value)
if (!id) id = rb_intern_str(name);
rb_const_set(mod, id, value);
- /*
- * Resolve and cache class name immediately to resolve ambiguity
- * and avoid order-dependency on const_tbl
- */
- if (RB_TYPE_P(value, T_MODULE) || RB_TYPE_P(value, T_CLASS)) {
- rb_class_name(value);
- }
return value;
}
diff --git a/variable.c b/variable.c
index 047dbc7e67..842006ed71 100644
--- a/variable.c
+++ b/variable.c
@@ -2569,6 +2569,13 @@ rb_const_set(VALUE klass, ID id, VALUE val)
args.value = val;
const_tbl_update(&args);
}
+ /*
+ * Resolve and cache class name immediately to resolve ambiguity
+ * and avoid order-dependency on const_tbl
+ */
+ if (rb_cObject && (RB_TYPE_P(val, T_MODULE) || RB_TYPE_P(val, T_CLASS))) {
+ rb_class_name(val);
+ }
}
static void