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 committed by Aaron Patterson
parent a0a100db49
commit 774eef692c

View File

@ -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));
}
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;
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));
}
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;
number_of_items_pushed++;