From 0a396e3ebb93f26c771b7f3d3721052bffad44ea Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 8 Feb 2002 05:20:34 +0000 Subject: * parse.y (yycompile): should inherit "in_single" if eval happened in a singleton method. * eval.c (rb_eval): class variables from singleton methods defined within singleton class statement should work like ones defined by sington def statements. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'parse.y') diff --git a/parse.y b/parse.y index 0081e9fa81..d4229547f8 100644 --- a/parse.y +++ b/parse.y @@ -2145,6 +2145,10 @@ yycompile(f, line) heredoc_end = 0; ruby_sourcefile = strdup(f); ruby_in_compile = 1; + if (ruby_frame && ruby_frame->last_class && + FL_TEST(ruby_frame->last_class, FL_SINGLETON)) { + in_single = 1; + } n = yyparse(); ruby_debug_lines = 0; compile_for_eval = 0; -- cgit v1.2.3