From dc98adf839d0d68c4c18647a1db2fb3dc9be8cc4 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 8 Nov 2001 06:43:14 +0000 Subject: * process.c (security): always give warning for insecure PATH. * dir.c (my_getcwd): do not rely on MAXPATHLEN. * file.c (rb_file_s_readlink): ditto. * file.c (path_check_1): ditto. * eval.c (rb_yield_0): should not call rb_f_block_given_p(). * string.c (rb_str_chomp_bang): should terminate string by NUL. * eval.c (rb_yield_0): better error message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 66 +++++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 28 deletions(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index 917848605b..89c63ab34c 100644 --- a/parse.y +++ b/parse.y @@ -428,24 +428,29 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem | variable tOP_ASGN command_call { NODE *n = assignable($1, 0); - if ($2 == tOROP) { - n->nd_value = $3; - $$ = NEW_OP_ASGN_OR(gettable($1), n); - if (is_instance_id($1)) { - $$->nd_aid = $1; + if (n) { + if ($2 == tOROP) { + n->nd_value = $3; + $$ = NEW_OP_ASGN_OR(gettable($1), n); + if (is_instance_id($1)) { + $$->nd_aid = $1; + } } - } - else if ($2 == tANDOP) { - n->nd_value = $3; - $$ = NEW_OP_ASGN_AND(gettable($1), n); + else if ($2 == tANDOP) { + n->nd_value = $3; + $$ = NEW_OP_ASGN_AND(gettable($1), n); + } + else { + $$ = n; + if ($$) { + $$->nd_value = call_op(gettable($1),$2,1,$3); + } + } + fixpos($$, $3); } else { - $$ = n; - if ($$) { - $$->nd_value = call_op(gettable($1),$2,1,$3); - } + $$ = 0; } - fixpos($$, $3); } | primary '[' aref_args ']' tOP_ASGN command_call { @@ -770,24 +775,29 @@ arg : lhs '=' arg | variable tOP_ASGN arg { NODE *n = assignable($1, 0); - if ($2 == tOROP) { - n->nd_value = $3; - $$ = NEW_OP_ASGN_OR(gettable($1), n); - if (is_instance_id($1)) { - $$->nd_aid = $1; + if (n) { + if ($2 == tOROP) { + n->nd_value = $3; + $$ = NEW_OP_ASGN_OR(gettable($1), n); + if (is_instance_id($1)) { + $$->nd_aid = $1; + } } - } - else if ($2 == tANDOP) { - n->nd_value = $3; - $$ = NEW_OP_ASGN_AND(gettable($1), n); + else if ($2 == tANDOP) { + n->nd_value = $3; + $$ = NEW_OP_ASGN_AND(gettable($1), n); + } + else { + $$ = n; + if ($$) { + $$->nd_value = call_op(gettable($1),$2,1,$3); + } + } + fixpos($$, $3); } else { - $$ = n; - if ($$) { - $$->nd_value = call_op(gettable($1),$2,1,$3); - } + $$ = 0; } - fixpos($$, $3); } | primary '[' aref_args ']' tOP_ASGN arg { -- cgit v1.2.3