summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-11 04:46:42 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-11 04:46:42 +0000
commit1571682719525d67ae355e4a0394c002f4aa30f1 (patch)
tree7a430f1db89189d02a0e92664b473906b0d9bc95 /parse.y
parent81ce0e38535d71e53635354bfab6f64a30d556f0 (diff)
parse.y: precedence of duplicated keys
* parse.y (assocs): concatenate splatted literal hashes. the former key has precedence even if duplicated literal keys follow. [ruby-core:65368] [Bug #10315] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y10
1 files changed, 9 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index c0c9036641..768c0ca34e 100644
--- a/parse.y
+++ b/parse.y
@@ -4931,7 +4931,15 @@ assocs : assoc
| assocs ',' assoc
{
/*%%%*/
- $$ = list_concat($1, $3);
+ NODE *assocs = $1;
+ NODE *tail = $3;
+ if (assocs->nd_head &&
+ !tail->nd_head && nd_type(tail->nd_next) == NODE_ARRAY &&
+ nd_type(tail->nd_next->nd_head) == NODE_HASH) {
+ /* DSTAR */
+ tail = tail->nd_next->nd_head->nd_head;
+ }
+ $$ = list_concat(assocs, tail);
/*%
$$ = rb_ary_push($1, $3);
%*/