From 61c5936da378bacada4500979737bcd9c44256b7 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Tue, 20 Feb 2024 11:11:12 -0500 Subject: [PATCH] [PRISM] Remove more dummy line usage * source files * source encodings * source lines --- prism_compile.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/prism_compile.c b/prism_compile.c index 11c558de9b..20be456cad 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -7771,33 +7771,29 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, return; } case PM_SOURCE_ENCODING_NODE: { - // Source encoding nodes are generated by the __ENCODING__ syntax. They - // reference the encoding object corresponding to the encoding of the - // source file, and can be changed by a magic encoding comment. + // __ENCODING__ + // ^^^^^^^^^^^^ if (!popped) { VALUE value = pm_static_literal_value(node, scope_node); - ADD_INSN1(ret, &dummy_line_node, putobject, value); - RB_OBJ_WRITTEN(iseq, Qundef, value); + PUSH_INSN1(ret, location, putobject, value); } return; } case PM_SOURCE_FILE_NODE: { - // Source file nodes are generated by the __FILE__ syntax. They - // reference the file name of the source file. + // __FILE__ + // ^^^^^^^^ if (!popped) { VALUE value = pm_static_literal_value(node, scope_node); - ADD_INSN1(ret, &dummy_line_node, putstring, value); - RB_OBJ_WRITTEN(iseq, Qundef, value); + PUSH_INSN1(ret, location, putstring, value); } return; } case PM_SOURCE_LINE_NODE: { - // Source line nodes are generated by the __LINE__ syntax. They - // reference the line number where they occur in the source file. + // __LINE__ + // ^^^^^^^^ if (!popped) { VALUE value = pm_static_literal_value(node, scope_node); - ADD_INSN1(ret, &dummy_line_node, putobject, value); - RB_OBJ_WRITTEN(iseq, Qundef, value); + PUSH_INSN1(ret, location, putobject, value); } return; }