@@ -2202,7 +2202,7 @@ yp_if_node_create(yp_parser_t *parser,
2202
2202
2203
2203
*node = (yp_if_node_t) {
2204
2204
{
2205
- .type = YP_NODE_IF_NODE,
2205
+ .type = YP_NODE_IF_NODE | YP_NODE_FLAG_NEWLINE ,
2206
2206
.location = {
2207
2207
.start = if_keyword->start,
2208
2208
.end = end
@@ -2228,7 +2228,7 @@ yp_if_node_modifier_create(yp_parser_t *parser, yp_node_t *statement, const yp_t
2228
2228
2229
2229
*node = (yp_if_node_t) {
2230
2230
{
2231
- .type = YP_NODE_IF_NODE,
2231
+ .type = YP_NODE_IF_NODE | YP_NODE_FLAG_NEWLINE ,
2232
2232
.location = {
2233
2233
.start = statement->location.start,
2234
2234
.end = predicate->location.end
@@ -2260,7 +2260,7 @@ yp_if_node_ternary_create(yp_parser_t *parser, yp_node_t *predicate, yp_node_t *
2260
2260
2261
2261
*node = (yp_if_node_t) {
2262
2262
{
2263
- .type = YP_NODE_IF_NODE,
2263
+ .type = YP_NODE_IF_NODE | YP_NODE_FLAG_NEWLINE ,
2264
2264
.location = {
2265
2265
.start = predicate->location.start,
2266
2266
.end = false_expression->location.end,
@@ -3683,6 +3683,9 @@ yp_statements_node_body_append(yp_statements_node_t *node, yp_node_t *statement)
3683
3683
3684
3684
yp_node_list_append(&node->body, statement);
3685
3685
node->base.location.end = statement->location.end;
3686
+
3687
+ // Every statement gets marked as a place where a newline can occur.
3688
+ statement->type |= YP_NODE_FLAG_NEWLINE;
3686
3689
}
3687
3690
3688
3691
// Allocate a new StringConcatNode node.
@@ -3940,7 +3943,7 @@ yp_unless_node_create(yp_parser_t *parser, const yp_token_t *keyword, yp_node_t
3940
3943
3941
3944
*node = (yp_unless_node_t) {
3942
3945
{
3943
- .type = YP_NODE_UNLESS_NODE,
3946
+ .type = YP_NODE_UNLESS_NODE | YP_NODE_FLAG_NEWLINE ,
3944
3947
.location = {
3945
3948
.start = keyword->start,
3946
3949
.end = end
@@ -3966,7 +3969,7 @@ yp_unless_node_modifier_create(yp_parser_t *parser, yp_node_t *statement, const
3966
3969
3967
3970
*node = (yp_unless_node_t) {
3968
3971
{
3969
- .type = YP_NODE_UNLESS_NODE,
3972
+ .type = YP_NODE_UNLESS_NODE | YP_NODE_FLAG_NEWLINE ,
3970
3973
.location = {
3971
3974
.start = statement->location.start,
3972
3975
.end = predicate->location.end
0 commit comments