From ceb94d988812e26fa53f55a72ac06305ed959576 Mon Sep 17 00:00:00 2001
From: sorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Thu, 25 Aug 2011 04:13:53 +0000
Subject: * backport r33045 from trunk.

* insns.def (defined): fix to checking class variable.
  A patch by Magnus Holm <judofyr@gmail.com>.  Thanks!

* test/ruby/test_variable.rb: add a test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
---
 insns.def | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'insns.def')

diff --git a/insns.def b/insns.def
index a300189e1d..9cd555e71a 100644
--- a/insns.def
+++ b/insns.def
@@ -773,11 +773,14 @@ defined
 	}
 	break;
       case DEFINED_CVAR:
-	klass = vm_get_cbase(GET_ISEQ(), GET_LFP(), GET_DFP());
+	{
+	NODE *cref = vm_get_cref(GET_ISEQ(), GET_LFP(), GET_DFP());
+	klass = vm_get_cvar_base(cref);
 	if (rb_cvar_defined(klass, SYM2ID(obj))) {
 	    expr_type = "class variable";
 	}
 	break;
+	}
       case DEFINED_CONST:
 	klass = v;
 	if (vm_get_ev_const(th, GET_ISEQ(), klass, SYM2ID(obj), 1)) {
-- 
cgit v1.2.3

