aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--eval.c2
-rw-r--r--parse.y9
3 files changed, 15 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 149edad772..894cba10c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Sep 13 18:35:12 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_eval): avoid uninitialized global/class variable
+ warnings at `||='. [ruby-dev:18278]
+
+ * parse.y (stmt, arg): ditto
+
Fri Sep 13 13:28:04 2002 WATANABE Hirofumi <eban@ruby-lang.org>
* lib/mkmf.rb ($INSTALLFILES): avoid warning when $VERBOSE mode.
diff --git a/eval.c b/eval.c
index 70cb068858..8d93cbcfd5 100644
--- a/eval.c
+++ b/eval.c
@@ -2891,7 +2891,7 @@ rb_eval(self, n)
goto again;
case NODE_OP_ASGN_OR:
- if ((node->nd_aid && !rb_ivar_defined(self, node->nd_aid)) ||
+ if ((node->nd_aid && !is_defined(self, node->nd_head, 0)) ||
!RTEST(result = rb_eval(self, node->nd_head))) {
node = node->nd_value;
goto again;
diff --git a/parse.y b/parse.y
index 6eedddc6d1..a323b7f011 100644
--- a/parse.y
+++ b/parse.y
@@ -49,6 +49,11 @@
#define is_const_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_CONST)
#define is_class_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_CLASS)
+#define is_asgn_or_id(id) ((is_notop_id(id)) && \
+ (((id)&ID_SCOPE_MASK) == ID_GLOBAL || \
+ ((id)&ID_SCOPE_MASK) == ID_INSTANCE || \
+ ((id)&ID_SCOPE_MASK) == ID_CLASS))
+
NODE *ruby_eval_tree_begin = 0;
NODE *ruby_eval_tree = 0;
@@ -462,7 +467,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
if ($2 == tOROP) {
$1->nd_value = $3;
$$ = NEW_OP_ASGN_OR(gettable(vid), $1);
- if (is_instance_id(vid)) {
+ if (is_asgn_or_id(vid)) {
$$->nd_aid = vid;
}
}
@@ -828,7 +833,7 @@ arg : lhs '=' arg
if ($2 == tOROP) {
$1->nd_value = $3;
$$ = NEW_OP_ASGN_OR(gettable(vid), $1);
- if (is_instance_id(vid)) {
+ if (is_asgn_or_id(vid)) {
$$->nd_aid = vid;
}
}