* eval.c (rb_yield_0): show yielded block position not only yielding

point.  [ruby-dev:20441]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2003-06-24 08:59:34 +00:00
parent 170aaabe4b
commit 5f80d051a6
2 changed files with 17 additions and 8 deletions

View File

@ -1,3 +1,8 @@
Tue Jun 24 17:59:30 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* eval.c (rb_yield_0): show yielded block position not only yielding
point. [ruby-dev:20441]
Tue Jun 24 16:47:07 2003 Minero Aoki <aamine@loveruby.net> Tue Jun 24 16:47:07 2003 Minero Aoki <aamine@loveruby.net>
* lib/net/http.rb (HTTPHeader#proxy_basic_auth): missing `@'. * lib/net/http.rb (HTTPHeader#proxy_basic_auth): missing `@'.

20
eval.c
View File

@ -2350,7 +2350,6 @@ rb_Array(val)
VALUE val; VALUE val;
{ {
VALUE tmp = rb_check_array_type(val); VALUE tmp = rb_check_array_type(val);
ID to_a;
if (NIL_P(tmp)) { if (NIL_P(tmp)) {
/* hack to avoid invoke Object#to_a */ /* hack to avoid invoke Object#to_a */
@ -4080,21 +4079,26 @@ rb_yield_0(val, self, klass, pcall, avalue)
massign(self, block->var, val, pcall); massign(self, block->var, val, pcall);
} }
else { else {
int len = 0;
if (avalue) { if (avalue) {
if (RARRAY(val)->len == 0) { len = RARRAY(val)->len;
goto zero_arg; if (len == 1) {
}
if (RARRAY(val)->len == 1) {
val = RARRAY(val)->ptr[0]; val = RARRAY(val)->ptr[0];
} }
else { else {
rb_warn("multiple values for a block parameter (%d for 1)", RARRAY(val)->len); goto mult_values;
} }
} }
else if (val == Qundef) { else if (val == Qundef) {
zero_arg:
rb_warn("multiple values for a block parameter (0 for 1)");
val = Qnil; val = Qnil;
mult_values:
{
NODE *curr = ruby_current_node;
ruby_current_node = block->var;
rb_warn("multiple values for a block parameter (%d for 1)\n\tfrom %s:%d",
len, curr->nd_file, nd_line(curr));
ruby_current_node = curr;
}
} }
assign(self, block->var, val, pcall); assign(self, block->var, val, pcall);
} }