Skip to content

Commit

Permalink
Fix unary not location
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Feb 12, 2024
1 parent d950a86 commit 861689f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -2891,7 +2891,7 @@ static pm_def_node_t *
pm_def_node_create(
pm_parser_t *parser,
pm_constant_id_t name,
const pm_location_t *name_loc,
const pm_token_t *name_loc,
pm_node_t *receiver,
pm_parameters_node_t *parameters,
pm_node_t *body,
Expand Down Expand Up @@ -2922,7 +2922,7 @@ pm_def_node_create(
.location = { .start = def_keyword->start, .end = end },
},
.name = name,
.name_loc = *name_loc,
.name_loc = PM_LOCATION_TOKEN_VALUE(name_loc),
.receiver = receiver,
.parameters = parameters,
.body = body,
Expand Down Expand Up @@ -15627,13 +15627,12 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
* methods to override the unary operators, we should ignore
* the @ in the same way we do for symbols.
*/
pm_constant_id_t name_id = pm_parser_constant_id_token(parser, &name);
pm_location_t name_loc = { .start = name.start, .end = parse_operator_symbol_name(&name) };
pm_constant_id_t name_id = pm_parser_constant_id_location(parser, name.start, parse_operator_symbol_name(&name));

return (pm_node_t *) pm_def_node_create(
parser,
name_id,
&name_loc,
&name,
receiver,
params,
statements,
Expand Down
4 changes: 2 additions & 2 deletions test/prism/snapshots/seattlerb/defn_unary_not.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 861689f

Please sign in to comment.