Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename RescueNode#exception to RescueNode#reference #1204

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading