summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--eval.c39
-rw-r--r--parse.y4
3 files changed, 29 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index fbd8802d12..a8b2e7421e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Feb 8 23:07:23 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): singleton chech should be moved from yycompile
+ to here.
+
+ * eval.c (is_defined): check should be added here too.
+
Fri Feb 8 05:39:15 2002 Minero Aoki <aamine@loveruby.net>
* lib/net/http.rb: HTTP.Proxy should use self for proxy-class's
diff --git a/eval.c b/eval.c
index 670a9889a6..82f0a06f87 100644
--- a/eval.c
+++ b/eval.c
@@ -1835,17 +1835,20 @@ is_defined(self, node, buf)
break;
case NODE_CVAR:
- if (NIL_P(ruby_cbase)) {
- if (rb_cvar_defined(CLASS_OF(self), node->nd_vid)) {
- return "class variable";
+ if (!ruby_frame || !ruby_frame->last_class ||
+ !FL_TEST(ruby_frame->last_class, FL_SINGLETON)) {
+ if (NIL_P(ruby_cbase)) {
+ if (rb_cvar_defined(CLASS_OF(self), node->nd_vid)) {
+ return "class variable";
+ }
+ break;
}
- break;
- }
- if (!FL_TEST(ruby_cbase, FL_SINGLETON)) {
- if (rb_cvar_defined(ruby_cbase, node->nd_vid)) {
- return "class variable";
+ if (!FL_TEST(ruby_cbase, FL_SINGLETON)) {
+ if (rb_cvar_defined(ruby_cbase, node->nd_vid)) {
+ return "class variable";
+ }
+ break;
}
- break;
}
/* fall through */
case NODE_CVAR2:
@@ -2761,15 +2764,17 @@ rb_eval(self, n)
break;
case NODE_CVAR: /* normal method */
- if (NIL_P(ruby_cbase)) {
- result = rb_cvar_get(CLASS_OF(self), node->nd_vid);
- break;
- }
- if (!FL_TEST(ruby_cbase, FL_SINGLETON)) {
- result = rb_cvar_get(ruby_cbase, node->nd_vid);
- break;
+ if (!ruby_frame || !ruby_frame->last_class ||
+ !FL_TEST(ruby_frame->last_class, FL_SINGLETON)) {
+ if (NIL_P(ruby_cbase)) {
+ result = rb_cvar_get(CLASS_OF(self), node->nd_vid);
+ break;
+ }
+ if (!FL_TEST(ruby_cbase, FL_SINGLETON)) {
+ 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 b6e8387f5d..2d14b1d001 100644
--- a/parse.y
+++ b/parse.y
@@ -1974,10 +1974,6 @@ 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;