diff options
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -5002,10 +5002,15 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) break; } case NODE_STR:{ - node->nd_lit = rb_fstring(node->nd_lit); debugp_param("nd_lit", node->nd_lit); if (!poped) { - ADD_INSN1(ret, line, putstring, node->nd_lit); + node->nd_lit = rb_fstring(node->nd_lit); + if (iseq->compile_data->option->frozen_string_literal) { + ADD_INSN1(ret, line, putobject, node->nd_lit); /* already frozen */ + } + else { + ADD_INSN1(ret, line, putstring, node->nd_lit); + } } break; } @@ -5015,6 +5020,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) if (poped) { ADD_INSN(ret, line, pop); } + else { + if (iseq->compile_data->option->frozen_string_literal) { + ADD_SEND (ret, line, idFreeze, INT2FIX(0)); + } + } break; } case NODE_XSTR:{ |