summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--eval.c1
-rw-r--r--parse.y4
3 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 13b0873b73..6d0e335367 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,15 @@ Fri Feb 8 05:31:48 2002 Minero Aoki <aamine@loveruby.net>
* lib/net/http.rb: initialize HTTP.proxy_port by HTTP.port.
+Fri Feb 8 01:27:33 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * 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.
+
Thu Feb 07 13:44:08 2002 akira yamada <akira@arika.org>
* uri/common.rb (URI::join): new method.
diff --git a/eval.c b/eval.c
index 0de33223c4..63953757f2 100644
--- a/eval.c
+++ b/eval.c
@@ -2909,7 +2909,6 @@ rb_eval(self, n)
result = rb_cvar_get(ruby_cbase, node->nd_vid);
break;
}
- self = rb_iv_get(ruby_cbase, "__attached__");
/* fall through */
case NODE_CVAR2: /* singleton method */
result = rb_cvar_get(rb_cvar_singleton(self), node->nd_vid);
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;