summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-29 17:47:24 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-29 17:47:24 +0000
commit525336fcc97a0c0fc8dae2e6f9fe63dfc6e645ab (patch)
tree23b84c6d3aa98723fea6577ecedbb3d15a49baba /parse.y
parent2e0b6e28ada7713aab10343c2850f32dec4652ac (diff)
* eval.c (proc_invoke): single array value to normal Proc#call
(i.e. not via lambda call), should be treated just like yield. [ruby-dev:21726] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y17
1 files changed, 16 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index 75fa33e..5c43cd8 100644
--- a/parse.y
+++ b/parse.y
@@ -5377,7 +5377,22 @@ static NODE *
new_yield(node)
NODE *node;
{
- return NEW_YIELD(node, node ? Qtrue : Qfalse);
+ long state = Qtrue;
+
+ if (node) {
+ no_blockarg(node);
+ if (nd_type(node) == NODE_ARRAY && node->nd_next == 0) {
+ node = node->nd_head;
+ state = Qfalse;
+ }
+ if (node && nd_type(node) == NODE_SPLAT) {
+ state = Qtrue;
+ }
+ }
+ else {
+ state = Qfalse;
+ }
+ return NEW_YIELD(node, state);
}
static NODE*