[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;
}
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;
}