зеркало из https://github.com/github/ruby.git
* parse.y (logop): left may be NULL. [ruby-talk:84539]
* eval.c (rb_eval): NODE_CASE nd_head may be NULL. * eval.c (rb_eval): remove never occurred NODE_WHEN branch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
22b8cc47eb
Коммит
cf22db8d69
|
@ -1,3 +1,11 @@
|
|||
Thu Oct 30 13:23:39 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* parse.y (logop): left may be NULL. [ruby-talk:84539]
|
||||
|
||||
* eval.c (rb_eval): NODE_CASE nd_head may be NULL.
|
||||
|
||||
* eval.c (rb_eval): remove never occurred NODE_WHEN branch.
|
||||
|
||||
Thu Oct 30 10:14:51 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||
|
||||
* lib/test/unit/autorunner.rb: make fox runners work.
|
||||
|
|
44
eval.c
44
eval.c
|
@ -2585,42 +2585,6 @@ rb_eval(self, n)
|
|||
}
|
||||
goto again;
|
||||
|
||||
case NODE_WHEN:
|
||||
while (node) {
|
||||
NODE *tag;
|
||||
|
||||
if (nd_type(node) != NODE_WHEN) goto again;
|
||||
tag = node->nd_head;
|
||||
while (tag) {
|
||||
if (trace_func) {
|
||||
call_trace_func("line", tag, self,
|
||||
ruby_frame->last_func,
|
||||
ruby_frame->last_class);
|
||||
}
|
||||
if (nd_type(tag->nd_head) == NODE_WHEN) {
|
||||
VALUE v = rb_eval(self, tag->nd_head->nd_head);
|
||||
long i;
|
||||
|
||||
if (TYPE(v) != T_ARRAY) v = rb_ary_to_ary(v);
|
||||
for (i=0; i<RARRAY(v)->len; i++) {
|
||||
if (RTEST(RARRAY(v)->ptr[i])) {
|
||||
node = node->nd_body;
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
tag = tag->nd_next;
|
||||
continue;
|
||||
}
|
||||
if (RTEST(rb_eval(self, tag->nd_head))) {
|
||||
node = node->nd_body;
|
||||
goto again;
|
||||
}
|
||||
tag = tag->nd_next;
|
||||
}
|
||||
node = node->nd_next;
|
||||
}
|
||||
RETURN(Qnil);
|
||||
|
||||
case NODE_CASE:
|
||||
{
|
||||
VALUE val;
|
||||
|
@ -2640,7 +2604,7 @@ rb_eval(self, n)
|
|||
ruby_frame->last_func,
|
||||
ruby_frame->last_class);
|
||||
}
|
||||
if (nd_type(tag->nd_head) == NODE_WHEN) {
|
||||
if (tag->nd_head && nd_type(tag->nd_head) == NODE_WHEN) {
|
||||
VALUE v = rb_eval(self, tag->nd_head->nd_head);
|
||||
long i;
|
||||
|
||||
|
@ -2973,16 +2937,14 @@ rb_eval(self, n)
|
|||
case NODE_ARGSCAT:
|
||||
{
|
||||
VALUE args = rb_eval(self, node->nd_head);
|
||||
result = rb_ary_concat(args,
|
||||
splat_value(rb_eval(self, node->nd_body)));
|
||||
result = rb_ary_concat(args, splat_value(rb_eval(self, node->nd_body)));
|
||||
}
|
||||
break;
|
||||
|
||||
case NODE_ARGSPUSH:
|
||||
{
|
||||
VALUE args = rb_ary_dup(rb_eval(self, node->nd_head));
|
||||
result = rb_ary_push(args,
|
||||
rb_eval(self, node->nd_body));
|
||||
result = rb_ary_push(args, rb_eval(self, node->nd_body));
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
3
parse.y
3
parse.y
|
@ -1821,7 +1821,6 @@ case_body : kWHEN when_args then
|
|||
$$ = NEW_WHEN($2, $4, $5);
|
||||
}
|
||||
;
|
||||
|
||||
when_args : args
|
||||
| args ',' tSTAR arg_value
|
||||
{
|
||||
|
@ -5317,7 +5316,7 @@ logop(type, left, right)
|
|||
NODE *left, *right;
|
||||
{
|
||||
value_expr(left);
|
||||
if (nd_type(left) == type) {
|
||||
if (left && nd_type(left) == type) {
|
||||
NODE *node = left, *second;
|
||||
while ((second = node->nd_2nd) != 0 && nd_type(second) == type) {
|
||||
node = second;
|
||||
|
|
2
re.c
2
re.c
|
@ -1735,7 +1735,7 @@ ignorecase_setter(val, id)
|
|||
VALUE val;
|
||||
ID id;
|
||||
{
|
||||
rb_warn("modifying %s is deperecated", rb_id2name(id));
|
||||
rb_warn("modifying %s is deprecated", rb_id2name(id));
|
||||
may_need_recompile = 1;
|
||||
ruby_ignorecase = RTEST(val);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче