From 39563af99459820ada08e30e379c84b4560c3fe9 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 20 Nov 2000 07:31:55 +0000 Subject: matz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index c0d47bf4f6..03ae3775e5 100644 --- a/eval.c +++ b/eval.c @@ -2594,17 +2594,19 @@ rb_eval(self, n) rb_const_set(ruby_class, node->nd_vid, result); break; - case NODE_CVASGN2: - result = rb_eval(self, node->nd_value); - rb_cvar_set_singleton(self, node->nd_vid, result); - break; - case NODE_CVDECL: if (NIL_P(ruby_cbase)) { rb_raise(rb_eTypeError, "no class/module to define class variable"); } + if (!FL_TEST(ruby_cbase, FL_SINGLETON)) { + result = rb_eval(self, node->nd_value); + rb_cvar_declare(ruby_cbase, node->nd_vid, result); + break; + } + /* fall through */ + case NODE_CVASGN2: result = rb_eval(self, node->nd_value); - rb_cvar_declare(ruby_cbase, node->nd_vid, result); + rb_cvar_set_singleton(self, node->nd_vid, result); break; case NODE_LVAR: -- cgit v1.2.3