1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* vm_insnhelper.c (vm_get_cvar_base): reduce duplicated checks and

move a warning outside the loop.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2011-09-20 09:09:00 +00:00
parent 3a902c4dbd
commit f957673826
2 changed files with 13 additions and 5 deletions

View file

@ -1,3 +1,8 @@
Tue Sep 20 18:08:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_insnhelper.c (vm_get_cvar_base): reduce duplicated checks and
move a warning outside the loop.
Mon Sep 19 18:55:51 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
* lib/fileutils.rb (module FileUtils): improve performance of

View file

@ -1235,14 +1235,17 @@ vm_get_cvar_base(NODE *cref)
{
VALUE klass;
while (cref && cref->nd_next &&
if (!cref) {
rb_bug("vm_get_cvar_base: no cref");
}
while (cref->nd_next &&
(NIL_P(cref->nd_clss) || FL_TEST(cref->nd_clss, FL_SINGLETON) ||
(cref->flags & NODE_FL_CREF_PUSHED_BY_EVAL))) {
cref = cref->nd_next;
if (!cref->nd_next) {
rb_warn("class variable access from toplevel");
}
}
if (!cref->nd_next) {
rb_warn("class variable access from toplevel");
}
klass = cref->nd_clss;