diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-01 08:31:24 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-01 08:31:24 +0000 |
commit | 43284b6bf8324a762808537d5cd2c0774b662a84 (patch) | |
tree | 1bc00e36f49d5dd744264261004d72eeed14cf2e /vm_insnhelper.c | |
parent | d9acd1965dfe9a241315c7e94c9942f6df1ed3fd (diff) | |
download | ruby-43284b6bf8324a762808537d5cd2c0774b662a84.tar.gz |
* insns.def (defineclass), vm_insnhelper.c (vm_get_cvar_base): see
also inherited constants for classes without superclass and
modules. [ruby-core:37698] [Bug #3423]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index e79d4a092d..91c335c99b 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1253,6 +1253,16 @@ vm_get_cvar_base(NODE *cref) return klass; } +static int +vm_const_defined_at(VALUE cbase, ID id, int newclass) +{ + int ret = rb_const_defined_at(cbase, id); + if (!ret && !newclass) { + while ((cbase = RCLASS_SUPER(cbase)) != 0 && cbase != rb_cObject && + !(ret = rb_const_defined_at(cbase, id))); + } + return ret; +} #ifndef USE_IC_FOR_IVAR #define USE_IC_FOR_IVAR 1 |