ruby-changes:21253
From: nobu <ko1@a...>
Date: Tue, 20 Sep 2011 18:12:51 +0900 (JST)
Subject: [ruby-changes:21253] nobu:r33302 (trunk): * vm_insnhelper.c (vm_get_cvar_base): reduce duplicated checks and
nobu 2011-09-20 18:09:00 +0900 (Tue, 20 Sep 2011) New Revision: 33302 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33302 Log: * vm_insnhelper.c (vm_get_cvar_base): reduce duplicated checks and move a warning outside the loop. Modified files: trunk/ChangeLog trunk/vm_insnhelper.c Index: ChangeLog =================================================================== --- ChangeLog (revision 33301) +++ ChangeLog (revision 33302) @@ -1,3 +1,8 @@ +Tue Sep 20 18:08:51 2011 Nobuyoshi Nakada <nobu@r...> + + * 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@g...> * lib/fileutils.rb (module FileUtils): improve performance of Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 33301) +++ vm_insnhelper.c (revision 33302) @@ -1235,15 +1235,18 @@ { 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; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/