summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/iseq.c b/iseq.c
index 3b87cdcc78..28c2d4f80b 100644
--- a/iseq.c
+++ b/iseq.c
@@ -1477,23 +1477,26 @@ iseqw_s_compile_prism(int argc, VALUE *argv, VALUE self)
pm_parser_t parser;
+ pm_string_t input;
if (RB_TYPE_P(src, T_FILE)) {
FilePathValue(src);
file = rb_fstring(src); /* rb_io_t->pathv gets frozen anyways */
- pm_string_t input;
pm_string_mapped_init(&input, RSTRING_PTR(file));
-
- pm_parser_init(&parser, pm_string_source(&input), pm_string_length(&input), &options);
}
else {
- pm_parser_init(&parser, (const uint8_t *) RSTRING_PTR(src), RSTRING_LEN(src), &options);
+ input.source = (const uint8_t *)RSTRING_PTR(src);
+ input.length = RSTRING_LEN(src);
+ input.type = PM_STRING_SHARED;
}
+ pm_parser_init(&parser, pm_string_source(&input), pm_string_length(&input), &options);
+
rb_iseq_t *iseq = iseq_alloc();
iseqw_s_compile_prism_compile(&parser, opt, iseq, file, path, start_line);
pm_parser_free(&parser);
pm_options_free(&options);
+ pm_string_free(&input);
return iseqw_new(iseq);
}