summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-23 11:48:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-23 11:48:55 +0000
commitefe97f7f7b0175cc2ecea591d57c814fd03fe70d (patch)
treead5ac5fe9283fa894de6c0771f526e269ff2f522 /parse.y
parent282a0556128af0ce6e9a0ce7781df068e8ba3688 (diff)
* parse.y (args): splat other than direct array literal.
[ruby-dev:39771] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@26160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y10
1 files changed, 6 insertions, 4 deletions
diff --git a/parse.y b/parse.y
index 11be7c4c68..ed61a7ce80 100644
--- a/parse.y
+++ b/parse.y
@@ -1455,7 +1455,7 @@ args : arg_value
| tSTAR arg_value
{
/*%%%*/
- $$ = splat_array($2);
+ if (!($$ = splat_array($2))) $$ = NEW_SPLAT($2);
/*%
$$ = arg_add_star(arg_new(), $2);
%*/
@@ -1569,14 +1569,15 @@ primary : literal
{
$$ = NEW_COLON3($2);
}
- | tLBRACK aref_args ']'
+ | tLBRACK {$<num>$ = ruby_sourceline;} aref_args ']'
{
- if ($2 == 0) {
+ if ($3 == 0) {
$$ = NEW_ZARRAY(); /* zero length array*/
}
else {
- $$ = $2;
+ $$ = $3;
}
+ nd_set_line($$, $<num>2);
}
| tLBRACE assoc_list '}'
{
@@ -5312,6 +5313,7 @@ static NODE *
splat_array(node)
NODE* node;
{
+ if (nd_type(node) == NODE_NEWLINE) node = node->nd_next;
if (nd_type(node) == NODE_SPLAT) node = node->nd_head;
if (nd_type(node) == NODE_ARRAY) return node;
return 0;