aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/compile.c b/compile.c
index d3a9b37b3a..a8935db0af 100644
--- a/compile.c
+++ b/compile.c
@@ -5340,9 +5340,14 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
else {
VALUE str = rb_str_dup(node->nd_lit);
- VALUE debug_info = rb_ary_new_from_args(2, iseq->body->location.path, INT2FIX(line));
- rb_ivar_set(str, id_debug_created_info, rb_obj_freeze(debug_info));
- ADD_INSN1(ret, line, putobject, rb_obj_freeze(str));
+ if (ISEQ_COMPILE_DATA(iseq)->option->debug_frozen_string_literal || RTEST(ruby_debug)) {
+ VALUE debug_info = rb_ary_new_from_args(2, iseq->body->location.path, INT2FIX(line));
+ rb_ivar_set(str, id_debug_created_info, rb_obj_freeze(debug_info));
+ ADD_INSN1(ret, line, putobject, rb_obj_freeze(str));
+ }
+ else {
+ ADD_INSN1(ret, line, putobject, rb_fstring(str));
+ }
iseq_add_mark_object_compile_time(iseq, str);
}
}