[PRISM] Remove more dummy line usage

* source files
* source encodings
* source lines
This commit is contained in:
Kevin Newton 2024-02-20 11:11:12 -05:00
parent 220ced7486
commit 61c5936da3

View File

@ -7771,33 +7771,29 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
return; return;
} }
case PM_SOURCE_ENCODING_NODE: { case PM_SOURCE_ENCODING_NODE: {
// Source encoding nodes are generated by the __ENCODING__ syntax. They // __ENCODING__
// reference the encoding object corresponding to the encoding of the // ^^^^^^^^^^^^
// source file, and can be changed by a magic encoding comment.
if (!popped) { if (!popped) {
VALUE value = pm_static_literal_value(node, scope_node); VALUE value = pm_static_literal_value(node, scope_node);
ADD_INSN1(ret, &dummy_line_node, putobject, value); PUSH_INSN1(ret, location, putobject, value);
RB_OBJ_WRITTEN(iseq, Qundef, value);
} }
return; return;
} }
case PM_SOURCE_FILE_NODE: { case PM_SOURCE_FILE_NODE: {
// Source file nodes are generated by the __FILE__ syntax. They // __FILE__
// reference the file name of the source file. // ^^^^^^^^
if (!popped) { if (!popped) {
VALUE value = pm_static_literal_value(node, scope_node); VALUE value = pm_static_literal_value(node, scope_node);
ADD_INSN1(ret, &dummy_line_node, putstring, value); PUSH_INSN1(ret, location, putstring, value);
RB_OBJ_WRITTEN(iseq, Qundef, value);
} }
return; return;
} }
case PM_SOURCE_LINE_NODE: { case PM_SOURCE_LINE_NODE: {
// Source line nodes are generated by the __LINE__ syntax. They // __LINE__
// reference the line number where they occur in the source file. // ^^^^^^^^
if (!popped) { if (!popped) {
VALUE value = pm_static_literal_value(node, scope_node); VALUE value = pm_static_literal_value(node, scope_node);
ADD_INSN1(ret, &dummy_line_node, putobject, value); PUSH_INSN1(ret, location, putobject, value);
RB_OBJ_WRITTEN(iseq, Qundef, value);
} }
return; return;
} }