summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-02-17 16:08:08 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-02-17 16:08:08 +0000
commitd16c035975f45d67a09a84d3d7e574fb80aa0a55 (patch)
treec2a330f2738ea2ce499b13bb1fd7028e65b86e59
parent110a9f783d1ae87a059fdb20f711ef5b9b8e49cc (diff)
* variable.c (rb_const_get_0): skip ruby_wrapper in const search
to give it lower priority (just above Object). need not to change rb_const_defined_0() since it's only a precedence matter; they are defined anyway. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--env.h2
-rw-r--r--eval.c2
-rw-r--r--variable.c16
4 files changed, 19 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 4ca1a09e27..e964058e48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sat Feb 18 01:01:17 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_const_get_0): skip ruby_wrapper in const search
+ to give it lower priority (just above Object). need not to
+ change rb_const_defined_0() since it's only a precedence matter;
+ they are defined anyway.
+
Sat Feb 18 00:22:39 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/tracer.rb: merged a minor clarification patch from Daniel
diff --git a/env.h b/env.h
index 68346172db..c6b079d301 100644
--- a/env.h
+++ b/env.h
@@ -85,4 +85,6 @@ struct BLOCK {
#define BLOCK_LAMBDA 2
#define BLOCK_FROM_METHOD 4
+RUBY_EXTERN VALUE ruby_wrapper;
+
#endif /* ENV_H */
diff --git a/eval.c b/eval.c
index 1b411fa161..3f00a86024 100644
--- a/eval.c
+++ b/eval.c
@@ -951,7 +951,7 @@ static struct tag *prot_tag;
#define TAG_THREAD 0xa
#define TAG_MASK 0xf
-static VALUE ruby_wrapper; /* security wrapper */
+VALUE ruby_wrapper; /* security wrapper */
static NODE *ruby_cref = 0;
static NODE *top_cref;
diff --git a/variable.c b/variable.c
index 79e2a4f1fb..aaa3153378 100644
--- a/variable.c
+++ b/variable.c
@@ -1297,18 +1297,21 @@ rb_const_get_0(VALUE klass, ID id, int exclude, int recurse, NODE *fallback)
if (!recurse) break;
tmp = RCLASS(tmp)->super;
if (tmp == rb_cObject) break;
+ if (ruby_wrapper && tmp && RBASIC(tmp)->klass == ruby_wrapper) {
+ tmp = RCLASS(tmp)->super;
+ }
}
if (recurse) {
+ if (!n_retry) {
+ n_retry = 1;
+ tmp = ruby_wrapper ? ruby_wrapper : rb_cObject;
+ goto retry;
+ }
if (fallback) {
tmp = fallback->nd_clss;
fallback = fallback->nd_next;
goto retry;
}
- if (!n_retry) {
- n_retry = 1;
- tmp = rb_cObject;
- goto retry;
- }
}
return const_missing(klass, id);
}
@@ -1464,12 +1467,11 @@ rb_const_defined_0(VALUE klass, ID id, int exclude, int recurse, NODE* fallback)
}
if (!recurse) break;
tmp = RCLASS(tmp)->super;
- if (tmp == rb_cObject) break;
}
if (recurse) {
if (!n_retry) {
n_retry = 1;
- tmp = rb_cObject;
+ tmp = ruby_wrapper ? ruby_wrapper : rb_cObject;
goto retry;
}
if (fallback) {