From 4f03f0cb67b0bf6497ffd4051e872905e3b49ead Mon Sep 17 00:00:00 2001
From: ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Wed, 24 Aug 2011 00:52:04 +0000
Subject: * 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/trunk@33045 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 829918c117..0541b344f9 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

