From 13cbec33c1335c5e582360797dfce7601bf60206 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 7 May 2001 09:26:29 +0000 Subject: * parse.y (arg): "||=" should not warn for uninitialized instance variables. * eval.c (rb_eval): ditto. * eval.c (eval): preserve and restore ruby_cref as well. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index f57c942ee6..3b58fd6874 100644 --- a/parse.y +++ b/parse.y @@ -411,15 +411,15 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem { $$ = node_assign($1, $3); } - | expr - -expr : mlhs '=' mrhs + | mlhs '=' mrhs { value_expr($3); $1->nd_value = $3; $$ = $1; } - | kRETURN ret_args + | expr + +expr : kRETURN ret_args { if (!compile_for_eval && !in_def && !in_single) yyerror("return appeared outside of method"); @@ -671,6 +671,9 @@ arg : lhs '=' arg if ($2 == tOROP) { $3->nd_value = $4; $$ = NEW_OP_ASGN_OR(gettable($1), $3); + if (is_instance_id($1)) { + $$->nd_aid = $1; + } } else if ($2 == tANDOP) { $3->nd_value = $4; @@ -903,14 +906,10 @@ arg : lhs '=' arg } aref_args : none - | command_call opt_nl + | command opt_nl { $$ = NEW_LIST($1); } - | args ',' command_call opt_nl - { - $$ = list_append($1, $3); - } | args trailer { $$ = $1; @@ -954,10 +953,6 @@ call_args : command { $$ = NEW_LIST($1); } - | args ',' command - { - $$ = list_append($1, $3); - } | args opt_block_arg { $$ = arg_blk_pass($1, $2); -- cgit v1.2.3