summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-23 05:52:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-23 05:52:18 +0000
commit820c58fce0286a3b2daba2fdc5cc18612401d688 (patch)
tree21df453effa65d42d28a2a8f755e20dc24d4d3af /parse.y
parent19d9c8d0c2dcba38c9d49611d906d9752952c25a (diff)
* parse.y (stmt, arg, aref_args): should not make sole splat into
array, in aref_args other than aref with op_asgn. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y8
1 files changed, 6 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index b927a2c..41fd0cd 100644
--- a/parse.y
+++ b/parse.y
@@ -167,7 +167,7 @@ static void top_local_setup();
#define NODE_STRTERM NODE_ZARRAY /* nothing to gc */
#define NODE_HEREDOC NODE_ARRAY /* 1, 3 to gc */
-#define SIGN_EXTEND(x,n) (((1<<(n))-1-((x)&~(~0<<(n))))^~(~0<<(n)))
+#define SIGN_EXTEND(x,n) (((1<<(n)-1)^((x)&~(~0<<(n))))-(1<<(n)-1))
#define nd_func u1.id
#if SIZEOF_SHORT == 2
#define nd_term(node) ((signed short)(node)->u2.id)
@@ -526,6 +526,8 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
value_expr($6);
args = NEW_LIST($6);
+ if ($3 && nd_type($3) != NODE_ARRAY)
+ $3 = NEW_LIST($3);
$3 = list_append($3, NEW_NIL());
list_concat(args, $3);
if ($5 == tOROP) {
@@ -988,6 +990,8 @@ arg : lhs '=' arg
value_expr($6);
args = NEW_LIST($6);
+ if ($3 && nd_type($3) != NODE_ARRAY)
+ $3 = NEW_LIST($3);
$3 = list_append($3, NEW_NIL());
list_concat(args, $3);
if ($5 == tOROP) {
@@ -1228,7 +1232,7 @@ aref_args : none
| tSTAR arg opt_nl
{
value_expr($2);
- $$ = NEW_LIST(NEW_SPLAT($2));
+ $$ = NEW_NEWLINE(NEW_SPLAT($2));
}
;