@@ -505,7 +505,7 @@ yp_statements_node_body_append(yp_statements_node_t *node, yp_node_t *statement)
505
505
// implement our own arena allocation.
506
506
static inline void *
507
507
yp_alloc_node(YP_ATTRIBUTE_UNUSED yp_parser_t *parser, size_t size) {
508
- void *memory = malloc( size);
508
+ void *memory = calloc(1, size);
509
509
if (memory == NULL) {
510
510
fprintf(stderr, "Failed to allocate %zu bytes\n", size);
511
511
abort();
@@ -2284,7 +2284,8 @@ yp_if_node_create(yp_parser_t *parser,
2284
2284
2285
2285
*node = (yp_if_node_t) {
2286
2286
{
2287
- .type = YP_NODE_IF_NODE | YP_NODE_FLAG_NEWLINE,
2287
+ .flags = YP_NODE_FLAG_NEWLINE,
2288
+ .type = YP_NODE_IF_NODE,
2288
2289
.location = {
2289
2290
.start = if_keyword->start,
2290
2291
.end = end
@@ -2310,7 +2311,8 @@ yp_if_node_modifier_create(yp_parser_t *parser, yp_node_t *statement, const yp_t
2310
2311
2311
2312
*node = (yp_if_node_t) {
2312
2313
{
2313
- .type = YP_NODE_IF_NODE | YP_NODE_FLAG_NEWLINE,
2314
+ .flags = YP_NODE_FLAG_NEWLINE,
2315
+ .type = YP_NODE_IF_NODE,
2314
2316
.location = {
2315
2317
.start = statement->location.start,
2316
2318
.end = predicate->location.end
@@ -2342,7 +2344,8 @@ yp_if_node_ternary_create(yp_parser_t *parser, yp_node_t *predicate, yp_node_t *
2342
2344
2343
2345
*node = (yp_if_node_t) {
2344
2346
{
2345
- .type = YP_NODE_IF_NODE | YP_NODE_FLAG_NEWLINE,
2347
+ .flags = YP_NODE_FLAG_NEWLINE,
2348
+ .type = YP_NODE_IF_NODE,
2346
2349
.location = {
2347
2350
.start = predicate->location.start,
2348
2351
.end = false_expression->location.end,
@@ -3746,7 +3749,7 @@ yp_statements_node_body_append(yp_statements_node_t *node, yp_node_t *statement)
3746
3749
node->base.location.end = statement->location.end;
3747
3750
3748
3751
// Every statement gets marked as a place where a newline can occur.
3749
- statement->type | = YP_NODE_FLAG_NEWLINE;
3752
+ statement->flags = YP_NODE_FLAG_NEWLINE;
3750
3753
}
3751
3754
3752
3755
// Allocate a new StringConcatNode node.
@@ -4004,7 +4007,8 @@ yp_unless_node_create(yp_parser_t *parser, const yp_token_t *keyword, yp_node_t
4004
4007
4005
4008
*node = (yp_unless_node_t) {
4006
4009
{
4007
- .type = YP_NODE_UNLESS_NODE | YP_NODE_FLAG_NEWLINE,
4010
+ .flags = YP_NODE_FLAG_NEWLINE,
4011
+ .type = YP_NODE_UNLESS_NODE,
4008
4012
.location = {
4009
4013
.start = keyword->start,
4010
4014
.end = end
@@ -4030,7 +4034,8 @@ yp_unless_node_modifier_create(yp_parser_t *parser, yp_node_t *statement, const
4030
4034
4031
4035
*node = (yp_unless_node_t) {
4032
4036
{
4033
- .type = YP_NODE_UNLESS_NODE | YP_NODE_FLAG_NEWLINE,
4037
+ .flags = YP_NODE_FLAG_NEWLINE,
4038
+ .type = YP_NODE_UNLESS_NODE,
4034
4039
.location = {
4035
4040
.start = statement->location.start,
4036
4041
.end = predicate->location.end
0 commit comments