[macruby-changes] [5032] MacRuby/trunk/vm.cpp
source_changes at macosforge.org
source_changes at macosforge.org
Wed Dec 15 01:03:17 PST 2010
Revision: 5032
http://trac.macosforge.org/projects/ruby/changeset/5032
Author: lsansonetti at apple.com
Date: 2010-12-15 01:03:13 -0800 (Wed, 15 Dec 2010)
Log Message:
-----------
when creating a module that already exists, make sure to refresh its outer
Modified Paths:
--------------
MacRuby/trunk/vm.cpp
Modified: MacRuby/trunk/vm.cpp
===================================================================
--- MacRuby/trunk/vm.cpp 2010-12-15 09:01:13 UTC (rev 5031)
+++ MacRuby/trunk/vm.cpp 2010-12-15 09:03:13 UTC (rev 5032)
@@ -1362,6 +1362,25 @@
}
}
+ // Prepare the constant outer.
+ VALUE const_outer;
+ if (flags & DEFINE_OUTER) {
+ const_outer = outer;
+ }
+ else if (flags & DEFINE_SUB_OUTER) {
+ // The Foo::Bar case, the outer here is the outer of the outer.
+ rb_vm_outer_t *o = GET_CORE()->get_outer((Class)outer);
+ if (o != NULL && o->outer != NULL) {
+ const_outer = (VALUE)o->outer->klass;
+ }
+ else {
+ const_outer = rb_cObject;
+ }
+ }
+ else {
+ const_outer = rb_cObject;
+ }
+
VALUE klass = get_klass_const(outer, path, dynamic_class);
if (klass != Qundef) {
// Constant is already defined.
@@ -1371,27 +1390,9 @@
rb_class2name(klass));
}
}
+ rb_vm_set_outer(klass, const_outer);
}
else {
- // Prepare the constant outer.
- VALUE const_outer;
- if (flags & DEFINE_OUTER) {
- const_outer = outer;
- }
- else if (flags & DEFINE_SUB_OUTER) {
- // The Foo::Bar case, the outer here is the outer of the outer.
- rb_vm_outer_t *o = GET_CORE()->get_outer((Class)outer);
- if (o != NULL && o->outer != NULL) {
- const_outer = (VALUE)o->outer->klass;
- }
- else {
- const_outer = rb_cObject;
- }
- }
- else {
- const_outer = rb_cObject;
- }
-
// Define the constant.
if (flags & DEFINE_MODULE) {
assert(super == 0);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101215/6d3657b7/attachment.html>
More information about the macruby-changes
mailing list