summaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-31 01:54:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-31 01:54:14 +0000
commitd766ff977c0a465309c54c2d2466d0fe3031446a (patch)
tree6aac63908ff3865b1d4a52d6c1224c3e4e051c8e /parse.y
parentaff22927c27fca9e5c115173d6fa6adc152a04ec (diff)
downloadruby-d766ff977c0a465309c54c2d2466d0fe3031446a.tar.gz
ruby-d766ff977c0a465309c54c2d2466d0fe3031446a.tar.xz
ruby-d766ff977c0a465309c54c2d2466d0fe3031446a.zip
* parse.y (literal_concat_gen): reduced unnecessary node at string
literal concatenation with empty head dstr. [ruby-dev:38968] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y8
1 files changed, 7 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index e6c921e57..80fef61f3 100644
--- a/parse.y
+++ b/parse.y
@@ -7832,8 +7832,14 @@ literal_concat_gen(struct parser_params *parser, NODE *head, NODE *tail)
rb_gc_force_recycle((VALUE)head);
head = tail;
}
+ else if (NIL_P(tail->nd_lit)) {
+ list_concat(head, tail->nd_next);
+ rb_gc_force_recycle((VALUE)tail);
+ }
else {
- list_concat(head, NEW_ARRAY(tail));
+ nd_set_type(tail, NODE_ARRAY);
+ tail->nd_head = NEW_STR(tail->nd_lit);
+ list_concat(head, tail);
}
break;