summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-05-07 09:26:29 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-05-07 09:26:29 +0000
commit13cbec33c1335c5e582360797dfce7601bf60206 (patch)
treee88cf34d1e19ece721133a8ad3582e8ed4727dc6 /parse.y
parent075169f071dbf6e71e91d3872c02e469d2a9ff72 (diff)
* 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
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y21
1 files changed, 8 insertions, 13 deletions
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) {
$<node>3->nd_value = $4;
$$ = NEW_OP_ASGN_OR(gettable($1), $<node>3);
+ if (is_instance_id($1)) {
+ $$->nd_aid = $1;
+ }
}
else if ($2 == tANDOP) {
$<node>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);