@@ -10355,12 +10355,18 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const no
10355
10355
debugp_param ("nd_lit" , get_string_value (node ));
10356
10356
if (!popped ) {
10357
10357
VALUE lit = get_string_value (node );
10358
- if (!frozen_string_literal_p (iseq )) {
10358
+ switch (ISEQ_COMPILE_DATA (iseq )-> option -> frozen_string_literal ) {
10359
+ case -1 : // unspecified
10360
+ lit = rb_fstring (lit );
10361
+ ADD_INSN1 (ret , node , putchilledstring , lit );
10362
+ RB_OBJ_WRITTEN (iseq , Qundef , lit );
10363
+ break ;
10364
+ case 0 : // disabled
10359
10365
lit = rb_fstring (lit );
10360
10366
ADD_INSN1 (ret , node , putstring , lit );
10361
10367
RB_OBJ_WRITTEN (iseq , Qundef , lit );
10362
- }
10363
- else {
10368
+ break ;
10369
+ case 1 : // enabled
10364
10370
if (ISEQ_COMPILE_DATA (iseq )-> option -> debug_frozen_string_literal || RTEST (ruby_debug )) {
10365
10371
VALUE debug_info = rb_ary_new_from_args (2 , rb_iseq_path (iseq ), INT2FIX (line ));
10366
10372
lit = rb_str_dup (lit );
@@ -10372,6 +10378,9 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const no
10372
10378
}
10373
10379
ADD_INSN1 (ret , node , putobject , lit );
10374
10380
RB_OBJ_WRITTEN (iseq , Qundef , lit );
10381
+ break ;
10382
+ default :
10383
+ rb_bug ("invalid frozen_string_literal" );
10375
10384
}
10376
10385
}
10377
10386
break ;
0 commit comments