Skip to content

Commit

Permalink
Rename RescueNode#exception to RescueNode#reference
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Aug 4, 2023
1 parent 5646158 commit ad0eb4b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1830,7 +1830,7 @@ nodes:
type: node[]
- name: operator_loc
type: location?
- name: exception
- name: reference
type: node?
- name: statements
type: node?
Expand Down
22 changes: 11 additions & 11 deletions src/yarp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3517,7 +3517,7 @@ yp_rescue_node_create(yp_parser_t *parser, const yp_token_t *keyword) {
},
.keyword_loc = YP_LOCATION_TOKEN_VALUE(keyword),
.operator_loc = YP_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE,
.exception = NULL,
.reference = NULL,
.statements = NULL,
.consequent = NULL,
.exceptions = YP_EMPTY_NODE_LIST
Expand All @@ -3531,11 +3531,11 @@ yp_rescue_node_operator_set(yp_rescue_node_t *node, const yp_token_t *operator)
node->operator_loc = YP_OPTIONAL_LOCATION_TOKEN_VALUE(operator);
}

// Set the exception of a rescue node, and update the location of the node.
// Set the reference of a rescue node, and update the location of the node.
static void
yp_rescue_node_exception_set(yp_rescue_node_t *node, yp_node_t *exception) {
node->exception = exception;
node->base.location.end = exception->location.end;
yp_rescue_node_reference_set(yp_rescue_node_t *node, yp_node_t *reference) {
node->reference = reference;
node->base.location.end = reference->location.end;
}

// Set the statements of a rescue node, and update the location of the node.
Expand Down Expand Up @@ -8610,11 +8610,11 @@ parse_rescues(yp_parser_t *parser, yp_begin_node_t *parent_node) {
parser_lex(parser);
yp_rescue_node_operator_set(rescue, &parser->previous);

yp_node_t *node = parse_expression(parser, YP_BINDING_POWER_INDEX, "Expected an exception variable after `=>` in rescue statement.");
yp_node_t *reference = parse_expression(parser, YP_BINDING_POWER_INDEX, "Expected an exception variable after `=>` in rescue statement.");
yp_token_t operator = not_provided(parser);
node = parse_target(parser, node, &operator, NULL);
reference = parse_target(parser, reference, &operator, NULL);

rescue->exception = node;
yp_rescue_node_reference_set(rescue, reference);
break;
}
case YP_TOKEN_NEWLINE:
Expand All @@ -8641,11 +8641,11 @@ parse_rescues(yp_parser_t *parser, yp_begin_node_t *parent_node) {
if (accept(parser, YP_TOKEN_EQUAL_GREATER)) {
yp_rescue_node_operator_set(rescue, &parser->previous);

yp_node_t *node = parse_expression(parser, YP_BINDING_POWER_INDEX, "Expected an exception variable after `=>` in rescue statement.");
yp_node_t *reference = parse_expression(parser, YP_BINDING_POWER_INDEX, "Expected an exception variable after `=>` in rescue statement.");
yp_token_t operator = not_provided(parser);
node = parse_target(parser, node, &operator, NULL);
reference = parse_target(parser, reference, &operator, NULL);

yp_rescue_node_exception_set(rescue, node);
yp_rescue_node_reference_set(rescue, reference);
break;
}
} while (accept(parser, YP_TOKEN_COMMA));
Expand Down

0 comments on commit ad0eb4b

Please sign in to comment.