ruby-cvs:18861
From: matz ruby-lang.org
Date: Fri, 2 Feb 2007 18:47:55 +0900 (JST)
Subject: [ruby-cvs:18861] Ruby:r11613: * vm.c (eval_get_cvar_base): destination for class variable access
matz 2007-02-02 18:47:55 +0900 (Fri, 02 Feb 2007)
New Revision: 11613
Modified files:
trunk/ChangeLog
trunk/variable.c
trunk/vm.c
Log:
* vm.c (eval_get_cvar_base): destination for class variable access
is now strictly innermost surrounding class or module. warned
if accessed from toplevel.
* variable.c (rb_cvar_get): new class variable look-up scheme:
1) look up in the class. 2) if the class is singleton attached
to a class (i.e. metaclass) then start look up in the attached
class and its ancestors. 3) otherwise, look-up in ancestors of
the class.
* eval.c (cvar_cbase): destination for class variable access is
the class/module that holds the method, or cbase outside of
methods.