summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-03-15 09:47:49 -0400
committerKevin Newton <kddnewton@gmail.com>2024-03-15 09:47:49 -0400
commitb4f3f3c1031cc9ef5c6741042236db497be6602b (patch)
tree9aabea382287380f344bc5d44749e60e7f3a5c81
parent043c90e16194e21006e185084199332059574da5 (diff)
[PRISM] Fix up source file when not frozen
-rw-r--r--prism_compile.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/prism_compile.c b/prism_compile.c
index 56b11b40b0..8417d09bd1 100644
--- a/prism_compile.c
+++ b/prism_compile.c
@@ -7919,8 +7919,16 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
// __FILE__
// ^^^^^^^^
if (!popped) {
- VALUE value = pm_static_literal_value(node, scope_node);
- PUSH_INSN1(ret, location, putstring, value);
+ const pm_source_file_node_t *cast = (const pm_source_file_node_t *) node;
+ VALUE string = parse_string(scope_node, &cast->filepath);
+
+ if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FROZEN)) {
+ string = rb_fstring(string);
+ PUSH_INSN1(ret, location, putobject, string);
+ }
+ else {
+ PUSH_INSN1(ret, location, putstring, string);
+ }
}
return;
}