summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-05-01 18:26:01 -0400
committerKevin Newton <kddnewton@gmail.com>2024-05-01 19:19:07 -0400
commitac0f6716b1aabd3b06ac2cd26839109f56d14edf (patch)
tree492abe8354ad5038cbe222e9c70f5990c2d8b066
parent8ea6daa86d4135e74c8f56b9f8706a7e9a723f6d (diff)
[PRISM] Respect frozen_string_literal option in RubyVM::InstructionSequence.compile
-rw-r--r--iseq.c14
-rw-r--r--test/.excludes-prism/TestRubyOptimization.rb1
2 files changed, 14 insertions, 1 deletions
diff --git a/iseq.c b/iseq.c
index 34381c6a46..231cac19b8 100644
--- a/iseq.c
+++ b/iseq.c
@@ -1274,6 +1274,20 @@ pm_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, V
pm_parse_result_t result = { 0 };
pm_options_line_set(&result.options, NUM2INT(line));
+ switch (option.frozen_string_literal) {
+ case ISEQ_FROZEN_STRING_LITERAL_UNSET:
+ break;
+ case ISEQ_FROZEN_STRING_LITERAL_DISABLED:
+ pm_options_frozen_string_literal_set(&result.options, false);
+ break;
+ case ISEQ_FROZEN_STRING_LITERAL_ENABLED:
+ pm_options_frozen_string_literal_set(&result.options, true);
+ break;
+ default:
+ rb_bug("pm_iseq_compile_with_option: invalid frozen_string_literal=%d", option.frozen_string_literal);
+ break;
+ }
+
VALUE error;
if (RB_TYPE_P(src, T_FILE)) {
VALUE filepath = rb_io_path(src);
diff --git a/test/.excludes-prism/TestRubyOptimization.rb b/test/.excludes-prism/TestRubyOptimization.rb
deleted file mode 100644
index df22ca4f71..0000000000
--- a/test/.excludes-prism/TestRubyOptimization.rb
+++ /dev/null
@@ -1 +0,0 @@
-exclude(:test_peephole_string_literal_range, "unknown")