summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-20 10:01:05 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-20 10:01:05 +0000
commit5a392c71dbf5cdc5af261acd3c56eac39e217988 (patch)
tree669c874771eb57da68840d114b456ce247a81067 /compile.c
parentabc20ed0f4b0067ad912f345245161426d331ed8 (diff)
* compile.c (compile_dstr_fragments): reduced needless literal.
* parse.y (xstring, regexp, dsym, literal_concat, evstr2dstr): literal at the top of dstr is no longer needed if it is empty, since concatstrings and toregexp always create new strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/compile.c b/compile.c
index 636ad31c4c..94c157ebe0 100644
--- a/compile.c
+++ b/compile.c
@@ -2143,11 +2143,14 @@ compile_dstr_fragments(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int *cntp
{
NODE *list = node->nd_next;
VALUE lit = node->nd_lit;
- int cnt = 1;
+ int cnt = 0;
debugp_param("nd_lit", lit);
- hide_obj(lit);
- ADD_INSN1(ret, nd_line(node), putobject, lit);
+ if (!NIL_P(lit)) {
+ hide_obj(lit);
+ cnt++;
+ ADD_INSN1(ret, nd_line(node), putobject, lit);
+ }
while (list) {
COMPILE(ret, "each string", list->nd_head);