summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index 26ee3b24fa..07cd7a6100 100644
--- a/compile.c
+++ b/compile.c
@@ -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:{