summaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-02-08 05:20:34 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-02-08 05:20:34 +0000
commit0131c5e08abb336780b146664738b3ba2e1ff107 (patch)
treee890db041d94a03b98bc55b932284a0637b2d783 /parse.y
parentd149dcca8cdffb82f3cc778deaaf6c0495b8a165 (diff)
downloadruby-0131c5e08abb336780b146664738b3ba2e1ff107.tar.gz
ruby-0131c5e08abb336780b146664738b3ba2e1ff107.tar.xz
ruby-0131c5e08abb336780b146664738b3ba2e1ff107.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@2058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y4
1 files changed, 4 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index 0081e9fa8..d4229547f 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;