1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* parse.y (arg): "||=" should not warn for uninitialized instance

variables.

* eval.c (rb_eval): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2001-05-07 09:24:34 +00:00
parent fc4434d7d7
commit 17c8fbdd6d
3 changed files with 14 additions and 4 deletions

View file

@ -1,5 +1,10 @@
Mon May 7 15:58:45 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* 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.
Mon May 7 15:45:48 2001 WATANABE Hirofumi <eban@ruby-lang.org>

10
eval.c
View file

@ -2634,10 +2634,12 @@ rb_eval(self, n)
goto again;
case NODE_OP_ASGN_OR:
result = rb_eval(self, node->nd_head);
if (RTEST(result)) break;
node = node->nd_value;
goto again;
if ((node->nd_aid && !rb_ivar_defined(self, node->nd_aid)) ||
!RTEST(result = rb_eval(self, node->nd_head))) {
node = node->nd_value;
goto again;
}
break;
case NODE_MASGN:
result = massign(self, node, rb_eval(self, node->nd_value),0);

View file

@ -672,6 +672,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;