From 83966a57fe6a271e64fb2629e7bbb8f0c34948a2 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Mon, 29 Jan 2024 16:39:46 -0500 Subject: [PATCH] [PRISM] Method location for calls --- prism_compile.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/prism_compile.c b/prism_compile.c index baab1a55fc9804..46ce25e4855788 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -2697,8 +2697,13 @@ pm_compile_call(rb_iseq_t *iseq, const pm_call_node_t *call_node, LINK_ANCHOR *c { pm_parser_t *parser = scope_node->parser; pm_newline_list_t newline_list = parser->newline_list; - int lineno = (int)pm_newline_list_line_column(&newline_list, ((pm_node_t *)call_node)->location.start).line; + + const uint8_t *call_start = call_node->message_loc.start; + if (call_start == NULL) call_start = call_node->base.location.start; + + int lineno = (int) pm_newline_list_line_column(&newline_list, call_start).line; NODE dummy_line_node = generate_dummy_line_node(lineno, lineno); + LABEL *else_label = NEW_LABEL(lineno); LABEL *end_label = NEW_LABEL(lineno);