[PRISM] Fix up source line for 1-indexed line numbers

This commit is contained in:
Kevin Newton 2024-01-22 11:21:04 -05:00
parent eb5797062a
commit 6401f282d2
No known key found for this signature in database
GPG Key ID: 0EAD74C79EC73F26

View File

@ -396,9 +396,7 @@ pm_static_literal_value(const pm_node_t *node, const pm_scope_node_t *scope_node
}
case PM_SOURCE_LINE_NODE: {
int source_line = (int) pm_newline_list_line_column(&scope_node->parser->newline_list, node->location.start).line;
// Ruby treats file lines as 1-indexed
// TODO: Incorporate options which allow for passing a line number
source_line += 1;
return INT2FIX(source_line);
}
case PM_STRING_NODE: