* 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
This commit is contained in:
matz 2006-02-17 16:08:08 +00:00
Родитель 110a9f783d
Коммит d16c035975
4 изменённых файлов: 19 добавлений и 8 удалений

Просмотреть файл

@ -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

2
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 */

2
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;

Просмотреть файл

@ -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) {