@@ -945,7 +945,7 @@ pm_arguments_node_create(pm_parser_t *parser) {
945
945
.type = PM_ARGUMENTS_NODE,
946
946
.location = PM_LOCATION_NULL_VALUE(parser)
947
947
},
948
- .arguments = PM_EMPTY_NODE_LIST
948
+ .arguments = { 0 }
949
949
};
950
950
951
951
return node;
@@ -981,7 +981,7 @@ pm_array_node_create(pm_parser_t *parser, const pm_token_t *opening) {
981
981
},
982
982
.opening_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(opening),
983
983
.closing_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(opening),
984
- .elements = PM_EMPTY_NODE_LIST
984
+ .elements = { 0 }
985
985
};
986
986
987
987
return node;
@@ -1034,8 +1034,8 @@ pm_array_pattern_node_node_list_create(pm_parser_t *parser, pm_node_list_t *node
1034
1034
},
1035
1035
.constant = NULL,
1036
1036
.rest = NULL,
1037
- .requireds = PM_EMPTY_NODE_LIST ,
1038
- .posts = PM_EMPTY_NODE_LIST ,
1037
+ .requireds = { 0 } ,
1038
+ .posts = { 0 } ,
1039
1039
.opening_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE,
1040
1040
.closing_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE
1041
1041
};
@@ -1071,8 +1071,8 @@ pm_array_pattern_node_rest_create(pm_parser_t *parser, pm_node_t *rest) {
1071
1071
},
1072
1072
.constant = NULL,
1073
1073
.rest = rest,
1074
- .requireds = PM_EMPTY_NODE_LIST ,
1075
- .posts = PM_EMPTY_NODE_LIST ,
1074
+ .requireds = { 0 } ,
1075
+ .posts = { 0 } ,
1076
1076
.opening_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE,
1077
1077
.closing_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE
1078
1078
};
@@ -1098,8 +1098,8 @@ pm_array_pattern_node_constant_create(pm_parser_t *parser, pm_node_t *constant,
1098
1098
.rest = NULL,
1099
1099
.opening_loc = PM_LOCATION_TOKEN_VALUE(opening),
1100
1100
.closing_loc = PM_LOCATION_TOKEN_VALUE(closing),
1101
- .requireds = PM_EMPTY_NODE_LIST ,
1102
- .posts = PM_EMPTY_NODE_LIST
1101
+ .requireds = { 0 } ,
1102
+ .posts = { 0 }
1103
1103
};
1104
1104
1105
1105
return node;
@@ -1123,8 +1123,8 @@ pm_array_pattern_node_empty_create(pm_parser_t *parser, const pm_token_t *openin
1123
1123
.rest = NULL,
1124
1124
.opening_loc = PM_LOCATION_TOKEN_VALUE(opening),
1125
1125
.closing_loc = PM_LOCATION_TOKEN_VALUE(closing),
1126
- .requireds = PM_EMPTY_NODE_LIST ,
1127
- .posts = PM_EMPTY_NODE_LIST
1126
+ .requireds = { 0 } ,
1127
+ .posts = { 0 }
1128
1128
};
1129
1129
1130
1130
return node;
@@ -1362,7 +1362,7 @@ pm_block_parameters_node_create(pm_parser_t *parser, pm_parameters_node_t *param
1362
1362
.parameters = parameters,
1363
1363
.opening_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(opening),
1364
1364
.closing_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE,
1365
- .locals = PM_EMPTY_NODE_LIST
1365
+ .locals = { 0 }
1366
1366
};
1367
1367
1368
1368
return node;
@@ -1923,7 +1923,7 @@ pm_case_node_create(pm_parser_t *parser, const pm_token_t *case_keyword, pm_node
1923
1923
.consequent = consequent,
1924
1924
.case_keyword_loc = PM_LOCATION_TOKEN_VALUE(case_keyword),
1925
1925
.end_keyword_loc = PM_LOCATION_TOKEN_VALUE(end_keyword),
1926
- .conditions = PM_EMPTY_NODE_LIST
1926
+ .conditions = { 0 }
1927
1927
};
1928
1928
1929
1929
return node;
@@ -2498,7 +2498,7 @@ pm_find_pattern_node_create(pm_parser_t *parser, pm_node_list_t *nodes) {
2498
2498
.constant = NULL,
2499
2499
.left = left,
2500
2500
.right = right,
2501
- .requireds = PM_EMPTY_NODE_LIST ,
2501
+ .requireds = { 0 } ,
2502
2502
.opening_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE,
2503
2503
.closing_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE
2504
2504
};
@@ -2689,7 +2689,7 @@ pm_hash_pattern_node_empty_create(pm_parser_t *parser, const pm_token_t *opening
2689
2689
.constant = NULL,
2690
2690
.opening_loc = PM_LOCATION_TOKEN_VALUE(opening),
2691
2691
.closing_loc = PM_LOCATION_TOKEN_VALUE(closing),
2692
- .elements = PM_EMPTY_NODE_LIST ,
2692
+ .elements = { 0 } ,
2693
2693
.rest = NULL
2694
2694
};
2695
2695
@@ -2727,7 +2727,7 @@ pm_hash_pattern_node_node_list_create(pm_parser_t *parser, pm_node_list_t *eleme
2727
2727
},
2728
2728
},
2729
2729
.constant = NULL,
2730
- .elements = PM_EMPTY_NODE_LIST ,
2730
+ .elements = { 0 } ,
2731
2731
.rest = rest,
2732
2732
.opening_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE,
2733
2733
.closing_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE
@@ -2880,7 +2880,7 @@ pm_hash_node_create(pm_parser_t *parser, const pm_token_t *opening) {
2880
2880
},
2881
2881
.opening_loc = PM_LOCATION_TOKEN_VALUE(opening),
2882
2882
.closing_loc = PM_LOCATION_NULL_VALUE(parser),
2883
- .elements = PM_EMPTY_NODE_LIST
2883
+ .elements = { 0 }
2884
2884
};
2885
2885
2886
2886
return node;
@@ -3272,7 +3272,7 @@ pm_interpolated_regular_expression_node_create(pm_parser_t *parser, const pm_tok
3272
3272
},
3273
3273
.opening_loc = PM_LOCATION_TOKEN_VALUE(opening),
3274
3274
.closing_loc = PM_LOCATION_TOKEN_VALUE(opening),
3275
- .parts = PM_EMPTY_NODE_LIST
3275
+ .parts = { 0 }
3276
3276
};
3277
3277
3278
3278
return node;
@@ -3311,9 +3311,13 @@ pm_interpolated_string_node_create(pm_parser_t *parser, const pm_token_t *openin
3311
3311
},
3312
3312
.opening_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(opening),
3313
3313
.closing_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(closing),
3314
- .parts = parts == NULL ? PM_EMPTY_NODE_LIST : *parts
3314
+ .parts = { 0 }
3315
3315
};
3316
3316
3317
+ if (parts != NULL) {
3318
+ node->parts = *parts;
3319
+ }
3320
+
3317
3321
return node;
3318
3322
}
3319
3323
@@ -3350,9 +3354,13 @@ pm_interpolated_symbol_node_create(pm_parser_t *parser, const pm_token_t *openin
3350
3354
},
3351
3355
.opening_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(opening),
3352
3356
.closing_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(closing),
3353
- .parts = parts == NULL ? PM_EMPTY_NODE_LIST : *parts
3357
+ .parts = { 0 }
3354
3358
};
3355
3359
3360
+ if (parts != NULL) {
3361
+ node->parts = *parts;
3362
+ }
3363
+
3356
3364
return node;
3357
3365
}
3358
3366
@@ -3381,7 +3389,7 @@ pm_interpolated_xstring_node_create(pm_parser_t *parser, const pm_token_t *openi
3381
3389
},
3382
3390
.opening_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(opening),
3383
3391
.closing_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(closing),
3384
- .parts = PM_EMPTY_NODE_LIST
3392
+ .parts = { 0 }
3385
3393
};
3386
3394
3387
3395
return node;
@@ -3409,7 +3417,7 @@ pm_keyword_hash_node_create(pm_parser_t *parser) {
3409
3417
.type = PM_KEYWORD_HASH_NODE,
3410
3418
.location = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE
3411
3419
},
3412
- .elements = PM_EMPTY_NODE_LIST
3420
+ .elements = { 0 }
3413
3421
};
3414
3422
3415
3423
return node;
@@ -3752,9 +3760,9 @@ pm_multi_target_node_create(pm_parser_t *parser) {
3752
3760
.type = PM_MULTI_TARGET_NODE,
3753
3761
.location = { .start = NULL, .end = NULL }
3754
3762
},
3755
- .lefts = PM_EMPTY_NODE_LIST ,
3763
+ .lefts = { 0 } ,
3756
3764
.rest = NULL,
3757
- .rights = PM_EMPTY_NODE_LIST ,
3765
+ .rights = { 0 } ,
3758
3766
.lparen_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE,
3759
3767
.rparen_loc = PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE
3760
3768
};
@@ -3961,10 +3969,10 @@ pm_parameters_node_create(pm_parser_t *parser) {
3961
3969
.rest = NULL,
3962
3970
.keyword_rest = NULL,
3963
3971
.block = NULL,
3964
- .requireds = PM_EMPTY_NODE_LIST ,
3965
- .optionals = PM_EMPTY_NODE_LIST ,
3966
- .posts = PM_EMPTY_NODE_LIST ,
3967
- .keywords = PM_EMPTY_NODE_LIST
3972
+ .requireds = { 0 } ,
3973
+ .optionals = { 0 } ,
3974
+ .posts = { 0 } ,
3975
+ .keywords = { 0 }
3968
3976
};
3969
3977
3970
3978
return node;
@@ -4295,7 +4303,7 @@ pm_rescue_node_create(pm_parser_t *parser, const pm_token_t *keyword) {
4295
4303
.reference = NULL,
4296
4304
.statements = NULL,
4297
4305
.consequent = NULL,
4298
- .exceptions = PM_EMPTY_NODE_LIST
4306
+ .exceptions = { 0 }
4299
4307
};
4300
4308
4301
4309
return node;
@@ -4503,7 +4511,7 @@ pm_statements_node_create(pm_parser_t *parser) {
4503
4511
.type = PM_STATEMENTS_NODE,
4504
4512
.location = PM_LOCATION_NULL_VALUE(parser)
4505
4513
},
4506
- .body = PM_EMPTY_NODE_LIST
4514
+ .body = { 0 }
4507
4515
};
4508
4516
4509
4517
return node;
@@ -4812,7 +4820,7 @@ pm_undef_node_create(pm_parser_t *parser, const pm_token_t *token) {
4812
4820
.location = PM_LOCATION_TOKEN_VALUE(token),
4813
4821
},
4814
4822
.keyword_loc = PM_LOCATION_TOKEN_VALUE(token),
4815
- .names = PM_EMPTY_NODE_LIST
4823
+ .names = { 0 }
4816
4824
};
4817
4825
4818
4826
return node;
@@ -4952,7 +4960,7 @@ pm_when_node_create(pm_parser_t *parser, const pm_token_t *keyword) {
4952
4960
},
4953
4961
.keyword_loc = PM_LOCATION_TOKEN_VALUE(keyword),
4954
4962
.statements = NULL,
4955
- .conditions = PM_EMPTY_NODE_LIST
4963
+ .conditions = { 0 }
4956
4964
};
4957
4965
4958
4966
return node;
@@ -11418,7 +11426,7 @@ parse_symbol(pm_parser_t *parser, pm_lex_mode_t *lex_mode, pm_lex_state_t next_s
11418
11426
11419
11427
// Create a node_list first. We'll use this to check if it should be an
11420
11428
// InterpolatedSymbolNode or a SymbolNode.
11421
- pm_node_list_t node_list = PM_EMPTY_NODE_LIST ;
11429
+ pm_node_list_t node_list = { 0 } ;
11422
11430
if (part) pm_node_list_append(&node_list, part);
11423
11431
11424
11432
while (!match2(parser, PM_TOKEN_STRING_END, PM_TOKEN_EOF)) {
@@ -11861,7 +11869,7 @@ parse_pattern_keyword_rest(pm_parser_t *parser) {
11861
11869
// Parse a hash pattern.
11862
11870
static pm_hash_pattern_node_t *
11863
11871
parse_pattern_hash(pm_parser_t *parser, pm_node_t *first_assoc) {
11864
- pm_node_list_t assocs = PM_EMPTY_NODE_LIST ;
11872
+ pm_node_list_t assocs = { 0 } ;
11865
11873
pm_node_t *rest = NULL;
11866
11874
11867
11875
switch (PM_NODE_TYPE(first_assoc)) {
@@ -12308,7 +12316,7 @@ parse_pattern(pm_parser_t *parser, bool top_pattern, pm_diagnostic_id_t diag_id)
12308
12316
// If we have a comma, then we are now parsing either an array pattern or a
12309
12317
// find pattern. We need to parse all of the patterns, put them into a big
12310
12318
// list, and then determine which type of node we have.
12311
- pm_node_list_t nodes = PM_EMPTY_NODE_LIST ;
12319
+ pm_node_list_t nodes = { 0 } ;
12312
12320
pm_node_list_append(&nodes, node);
12313
12321
12314
12322
// Gather up all of the patterns into the list.
@@ -12448,7 +12456,7 @@ parse_strings(pm_parser_t *parser) {
12448
12456
// In that case we need to switch to an interpolated string to
12449
12457
// be able to contain all of the parts.
12450
12458
if (match1(parser, PM_TOKEN_STRING_CONTENT)) {
12451
- pm_node_list_t parts = PM_EMPTY_NODE_LIST ;
12459
+ pm_node_list_t parts = { 0 } ;
12452
12460
12453
12461
pm_token_t delimiters = not_provided(parser);
12454
12462
pm_node_t *part = (pm_node_t *) pm_string_node_create_unescaped(parser, &delimiters, &content, &delimiters, &unescaped);
@@ -12485,7 +12493,7 @@ parse_strings(pm_parser_t *parser) {
12485
12493
} else {
12486
12494
// If we get here, then we have interpolation so we'll need
12487
12495
// to create a string or symbol node with interpolation.
12488
- pm_node_list_t parts = PM_EMPTY_NODE_LIST ;
12496
+ pm_node_list_t parts = { 0 } ;
12489
12497
pm_token_t string_opening = not_provided(parser);
12490
12498
pm_token_t string_closing = not_provided(parser);
12491
12499
@@ -12509,7 +12517,7 @@ parse_strings(pm_parser_t *parser) {
12509
12517
// If we get here, then the first part of the string is not plain
12510
12518
// string content, in which case we need to parse the string as an
12511
12519
// interpolated string.
12512
- pm_node_list_t parts = PM_EMPTY_NODE_LIST ;
12520
+ pm_node_list_t parts = { 0 } ;
12513
12521
pm_node_t *part;
12514
12522
12515
12523
while (!match3(parser, PM_TOKEN_STRING_END, PM_TOKEN_LABEL_END, PM_TOKEN_EOF)) {
@@ -13025,7 +13033,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power) {
13025
13033
// If we get here, then we have multiple parts in the heredoc,
13026
13034
// so we'll need to create an interpolated string node to hold
13027
13035
// them all.
13028
- pm_node_list_t parts = PM_EMPTY_NODE_LIST ;
13036
+ pm_node_list_t parts = { 0 } ;
13029
13037
pm_node_list_append(&parts, part);
13030
13038
13031
13039
while (!match2(parser, PM_TOKEN_HEREDOC_END, PM_TOKEN_EOF)) {
0 commit comments