Skip to content

Commit

Permalink
Initialize rb_node_block_t::nd_end at creation
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Dec 27, 2023
1 parent d054601 commit 15c2806
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions parse.y
Expand Up @@ -11252,7 +11252,7 @@ rb_node_block_new(struct parser_params *p, NODE *nd_head, const YYLTYPE *loc)
{
rb_node_block_t *n = NODE_NEWNODE(NODE_BLOCK, rb_node_block_t, loc);
n->nd_head = nd_head;
n->nd_end = 0;
n->nd_end = (NODE *)n;
n->nd_next = 0;

return n;
Expand Down Expand Up @@ -12343,7 +12343,6 @@ block_append(struct parser_params *p, NODE *head, NODE *tail)
switch (nd_type(h)) {
default:
h = end = NEW_BLOCK(head, &head->nd_loc);
RNODE_BLOCK(end)->nd_end = end;
head = end;
break;
case NODE_BLOCK:
Expand All @@ -12369,7 +12368,6 @@ block_append(struct parser_params *p, NODE *head, NODE *tail)

if (!nd_type_p(tail, NODE_BLOCK)) {
tail = NEW_BLOCK(tail, &tail->nd_loc);
RNODE_BLOCK(tail)->nd_end = tail;
}
RNODE_BLOCK(end)->nd_next = tail;
RNODE_BLOCK(h)->nd_end = RNODE_BLOCK(tail)->nd_end;
Expand Down

0 comments on commit 15c2806

Please sign in to comment.