From 026e1858383555ede7b307dc9484a11d71dd5e1d Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 13 Sep 2002 09:36:28 +0000 Subject: * eval.c (rb_eval): avoid uninitialized global/class variable warnings at `||='. [ruby-dev:18278] * parse.y (stmt, arg): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'parse.y') 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; } } -- cgit v1.2.3