@@ -11193,28 +11193,27 @@ parse_expression_prefix(yp_parser_t *parser, yp_binding_power_t binding_power) {
11193
11193
parser_lex(parser);
11194
11194
yp_accepts_block_stack_pop(parser);
11195
11195
11196
- // If we have a single statement and are ending on a right parenthesis,
11197
- // then we need to check if this is possibly a multiple target node.
11196
+ // If we have a single statement and are ending on a right
11197
+ // parenthesis, then we need to check if this is possibly a
11198
+ // multiple target node.
11198
11199
if (binding_power == YP_BINDING_POWER_STATEMENT && YP_NODE_TYPE_P(statement, YP_MULTI_TARGET_NODE)) {
11199
- yp_node_t *target;
11200
- yp_multi_target_node_t *multi_target = (yp_multi_target_node_t *) statement;
11200
+ yp_multi_target_node_t *multi_target;
11201
+ if (((yp_multi_target_node_t *) statement)->lparen_loc.start == NULL) {
11202
+ multi_target = (yp_multi_target_node_t *) statement;
11203
+ } else {
11204
+ multi_target = yp_multi_target_node_create(parser);
11205
+ yp_multi_target_node_targets_append(multi_target, statement);
11206
+ }
11201
11207
11202
11208
yp_location_t lparen_loc = YP_LOCATION_TOKEN_VALUE(&opening);
11203
11209
yp_location_t rparen_loc = YP_LOCATION_TOKEN_VALUE(&parser->previous);
11204
11210
11205
- if (multi_target->lparen_loc.start == NULL) {
11206
- multi_target->base.location.start = lparen_loc.start;
11207
- multi_target->base.location.end = rparen_loc.end;
11208
- multi_target->lparen_loc = lparen_loc;
11209
- multi_target->rparen_loc = rparen_loc;
11210
- target = (yp_node_t *) multi_target;
11211
- } else {
11212
- yp_multi_target_node_t *parent_target = yp_multi_target_node_create(parser);
11213
- yp_multi_target_node_targets_append(parent_target, (yp_node_t *) multi_target);
11214
- target = (yp_node_t *) parent_target;
11215
- }
11211
+ multi_target->lparen_loc = lparen_loc;
11212
+ multi_target->rparen_loc = rparen_loc;
11213
+ multi_target->base.location.start = lparen_loc.start;
11214
+ multi_target->base.location.end = rparen_loc.end;
11216
11215
11217
- return parse_targets(parser, target , YP_BINDING_POWER_INDEX);
11216
+ return parse_targets(parser, (yp_node_t *) multi_target , YP_BINDING_POWER_INDEX);
11218
11217
}
11219
11218
11220
11219
// If we have a single statement and are ending on a right parenthesis
@@ -11226,9 +11225,9 @@ parse_expression_prefix(yp_parser_t *parser, yp_binding_power_t binding_power) {
11226
11225
return (yp_node_t *) yp_parentheses_node_create(parser, &opening, (yp_node_t *) statements, &parser->previous);
11227
11226
}
11228
11227
11229
- // If we have more than one statement in the set of parentheses, then we
11230
- // are going to parse all of them as a list of statements. We'll do that
11231
- // here.
11228
+ // If we have more than one statement in the set of parentheses,
11229
+ // then we are going to parse all of them as a list of statements.
11230
+ // We'll do that here.
11232
11231
context_push(parser, YP_CONTEXT_PARENS);
11233
11232
yp_statements_node_t *statements = yp_statements_node_create(parser);
11234
11233
yp_statements_node_body_append(statements, statement);
@@ -11240,11 +11239,11 @@ parse_expression_prefix(yp_parser_t *parser, yp_binding_power_t binding_power) {
11240
11239
yp_node_t *node = parse_expression(parser, YP_BINDING_POWER_STATEMENT, YP_ERR_CANNOT_PARSE_EXPRESSION);
11241
11240
yp_statements_node_body_append(statements, node);
11242
11241
11243
- // If we're recovering from a syntax error, then we need to stop parsing the
11244
- // statements now.
11242
+ // If we're recovering from a syntax error, then we need to stop
11243
+ // parsing the statements now.
11245
11244
if (parser->recovering) {
11246
- // If this is the level of context where the recovery has happened, then
11247
- // we can mark the parser as done recovering.
11245
+ // If this is the level of context where the recovery has
11246
+ // happened, then we can mark the parser as done recovering.
11248
11247
if (match1(parser, YP_TOKEN_PARENTHESIS_RIGHT)) parser->recovering = false;
11249
11248
break;
11250
11249
}
0 commit comments