Always freeze strings that are in the instructions

Any objects that the instructions reference should be frozen.

Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
This commit is contained in:
Aaron Patterson 2024-01-08 13:32:35 -08:00 коммит произвёл Aaron Patterson
Родитель a0a100db49
Коммит 774eef692c
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -757,7 +757,7 @@ pm_interpolated_node_compile(pm_node_list_t *parts, rb_iseq_t *iseq, NODE dummy_
ADD_INSN1(ret, &dummy_line_node, putobject, rb_str_freeze(current_string)); ADD_INSN1(ret, &dummy_line_node, putobject, rb_str_freeze(current_string));
} }
else { else {
ADD_INSN1(ret, &dummy_line_node, putstring, current_string); ADD_INSN1(ret, &dummy_line_node, putstring, rb_str_freeze(current_string));
} }
current_string = Qnil; current_string = Qnil;
number_of_items_pushed++; number_of_items_pushed++;
@ -776,7 +776,7 @@ pm_interpolated_node_compile(pm_node_list_t *parts, rb_iseq_t *iseq, NODE dummy_
ADD_INSN1(ret, &dummy_line_node, putobject, rb_str_freeze(current_string)); ADD_INSN1(ret, &dummy_line_node, putobject, rb_str_freeze(current_string));
} }
else { else {
ADD_INSN1(ret, &dummy_line_node, putstring, current_string); ADD_INSN1(ret, &dummy_line_node, putstring, rb_str_freeze(current_string));
} }
current_string = Qnil; current_string = Qnil;
number_of_items_pushed++; number_of_items_pushed++;