diff --git a/ChangeLog b/ChangeLog index 4d052c9f65..59459ffa19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Jul 31 10:54:08 2009 Nobuyoshi Nakada + + * parse.y (literal_concat_gen): reduced unnecessary node at string + literal concatenation with empty head dstr. [ruby-dev:38968] + Fri Jul 31 02:57:39 2009 Yusuke Endoh * parse.y (literal_concat_gen): NODE_DSTR was incorrectly handled as diff --git a/parse.y b/parse.y index e6c921e57a..80fef61f34 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;