Skip to content

Commit

Permalink
Merge pull request #1372 from froydnj/froydnj-const-location-variables
Browse files Browse the repository at this point in the history
add some `const` qualifiers to local variables
  • Loading branch information
jemmaissroff authored Aug 31, 2023
2 parents 2d37407 + eb3c6eb commit 21acd69
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/yarp.c
Original file line number Diff line number Diff line change
Expand Up @@ -9890,7 +9890,7 @@ parse_heredoc_common_whitespace(yp_parser_t *parser, yp_node_list_t *nodes) {
yp_node_t *node = nodes->nodes[index];

if (!YP_NODE_TYPE_P(node, YP_NODE_STRING_NODE)) continue;
yp_location_t *content_loc = &((yp_string_node_t *) node)->content_loc;
const yp_location_t *content_loc = &((yp_string_node_t *) node)->content_loc;

// If the previous node wasn't a string node, we don't want to trim
// whitespace. This could happen after an interpolated expression or
Expand Down Expand Up @@ -10235,7 +10235,7 @@ parse_pattern_hash(yp_parser_t *parser, yp_node_t *first_assoc) {
yp_node_t *key = ((yp_assoc_node_t *) first_assoc)->key;

if (YP_NODE_TYPE_P(key, YP_NODE_SYMBOL_NODE)) {
yp_location_t *value_loc = &((yp_symbol_node_t *) key)->value_loc;
const yp_location_t *value_loc = &((yp_symbol_node_t *) key)->value_loc;
yp_parser_local_add_location(parser, value_loc->start, value_loc->end);
}
}
Expand Down Expand Up @@ -10263,7 +10263,7 @@ parse_pattern_hash(yp_parser_t *parser, yp_node_t *first_assoc) {
if (!match_any_type_p(parser, 7, YP_TOKEN_COMMA, YP_TOKEN_KEYWORD_THEN, YP_TOKEN_BRACE_RIGHT, YP_TOKEN_BRACKET_RIGHT, YP_TOKEN_PARENTHESIS_RIGHT, YP_TOKEN_NEWLINE, YP_TOKEN_SEMICOLON)) {
value = parse_pattern(parser, false, "Expected a pattern expression after the key.");
} else {
yp_location_t *value_loc = &((yp_symbol_node_t *) key)->value_loc;
const yp_location_t *value_loc = &((yp_symbol_node_t *) key)->value_loc;
yp_parser_local_add_location(parser, value_loc->start, value_loc->end);
}

Expand Down Expand Up @@ -13215,7 +13215,7 @@ parse_expression_infix(yp_parser_t *parser, yp_node_t *node, yp_binding_power_t
yp_string_list_t named_captures;
yp_string_list_init(&named_captures);

yp_location_t *content_loc = &((yp_regular_expression_node_t *) node)->content_loc;
const yp_location_t *content_loc = &((yp_regular_expression_node_t *) node)->content_loc;

if (yp_regexp_named_capture_group_names(content_loc->start, (size_t) (content_loc->end - content_loc->start), &named_captures, parser->encoding_changed, &parser->encoding)) {
for (size_t index = 0; index < named_captures.length; index++) {
Expand Down

0 comments on commit 21acd69

Please sign in to comment.