prism 0.30.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -1
  3. data/README.md +3 -1
  4. data/config.yml +185 -126
  5. data/docs/serialization.md +3 -0
  6. data/ext/prism/api_node.c +2843 -2085
  7. data/ext/prism/extconf.rb +1 -1
  8. data/ext/prism/extension.c +35 -25
  9. data/ext/prism/extension.h +2 -2
  10. data/include/prism/ast.h +1048 -69
  11. data/include/prism/defines.h +9 -0
  12. data/include/prism/diagnostic.h +11 -3
  13. data/include/prism/options.h +55 -1
  14. data/include/prism/parser.h +27 -3
  15. data/include/prism/regexp.h +2 -1
  16. data/include/prism/util/pm_integer.h +6 -6
  17. data/include/prism/util/pm_newline_list.h +11 -0
  18. data/include/prism/util/pm_string.h +1 -0
  19. data/include/prism/version.h +3 -3
  20. data/lib/prism/desugar_compiler.rb +111 -74
  21. data/lib/prism/dispatcher.rb +2 -1
  22. data/lib/prism/dot_visitor.rb +21 -31
  23. data/lib/prism/dsl.rb +656 -471
  24. data/lib/prism/ffi.rb +3 -0
  25. data/lib/prism/inspect_visitor.rb +285 -57
  26. data/lib/prism/mutation_compiler.rb +5 -5
  27. data/lib/prism/node.rb +2282 -4754
  28. data/lib/prism/node_ext.rb +72 -11
  29. data/lib/prism/parse_result/errors.rb +65 -0
  30. data/lib/prism/parse_result/newlines.rb +28 -28
  31. data/lib/prism/parse_result.rb +25 -2
  32. data/lib/prism/reflection.rb +7 -7
  33. data/lib/prism/serialize.rb +468 -610
  34. data/lib/prism/translation/parser/compiler.rb +18 -18
  35. data/lib/prism/translation/parser/lexer.rb +1 -1
  36. data/lib/prism/translation/parser.rb +3 -3
  37. data/lib/prism/translation/ripper.rb +14 -14
  38. data/lib/prism/translation/ruby_parser.rb +43 -7
  39. data/prism.gemspec +3 -1
  40. data/rbi/prism/dsl.rbi +521 -0
  41. data/rbi/prism/node.rbi +1456 -5616
  42. data/rbi/prism.rbi +16 -16
  43. data/sig/prism/dsl.rbs +189 -305
  44. data/sig/prism/node.rbs +702 -603
  45. data/sig/prism/parse_result.rbs +2 -0
  46. data/src/diagnostic.c +22 -6
  47. data/src/node.c +277 -284
  48. data/src/options.c +18 -0
  49. data/src/prettyprint.c +99 -108
  50. data/src/prism.c +1282 -760
  51. data/src/regexp.c +72 -4
  52. data/src/serialize.c +165 -50
  53. data/src/token_type.c +2 -2
  54. data/src/util/pm_integer.c +14 -14
  55. data/src/util/pm_newline_list.c +29 -0
  56. data/src/util/pm_string.c +9 -5
  57. metadata +4 -2
data/src/serialize.c CHANGED
@@ -1,10 +1,10 @@
1
- /******************************************************************************/
1
+ /*----------------------------------------------------------------------------*/
2
2
  /* This file is generated by the templates/template.rb script and should not */
3
3
  /* be modified manually. See */
4
4
  /* templates/src/serialize.c.erb */
5
5
  /* if you are looking to modify the */
6
6
  /* template */
7
- /******************************************************************************/
7
+ /*----------------------------------------------------------------------------*/
8
8
 
9
9
  #include "prism.h"
10
10
 
@@ -82,6 +82,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
82
82
 
83
83
  size_t offset = buffer->length;
84
84
 
85
+ pm_buffer_append_varuint(buffer, node->node_id);
85
86
  pm_serialize_location(parser, &node->location, buffer);
86
87
 
87
88
  switch (PM_NODE_TYPE(node)) {
@@ -90,31 +91,35 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
90
91
  case PM_SCOPE_NODE:
91
92
  return;
92
93
  case PM_ALIAS_GLOBAL_VARIABLE_NODE: {
94
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
93
95
  pm_serialize_node(parser, (pm_node_t *)((pm_alias_global_variable_node_t *)node)->new_name, buffer);
94
96
  pm_serialize_node(parser, (pm_node_t *)((pm_alias_global_variable_node_t *)node)->old_name, buffer);
95
97
  pm_serialize_location(parser, &((pm_alias_global_variable_node_t *)node)->keyword_loc, buffer);
96
98
  break;
97
99
  }
98
100
  case PM_ALIAS_METHOD_NODE: {
101
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
99
102
  pm_serialize_node(parser, (pm_node_t *)((pm_alias_method_node_t *)node)->new_name, buffer);
100
103
  pm_serialize_node(parser, (pm_node_t *)((pm_alias_method_node_t *)node)->old_name, buffer);
101
104
  pm_serialize_location(parser, &((pm_alias_method_node_t *)node)->keyword_loc, buffer);
102
105
  break;
103
106
  }
104
107
  case PM_ALTERNATION_PATTERN_NODE: {
108
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
105
109
  pm_serialize_node(parser, (pm_node_t *)((pm_alternation_pattern_node_t *)node)->left, buffer);
106
110
  pm_serialize_node(parser, (pm_node_t *)((pm_alternation_pattern_node_t *)node)->right, buffer);
107
111
  pm_serialize_location(parser, &((pm_alternation_pattern_node_t *)node)->operator_loc, buffer);
108
112
  break;
109
113
  }
110
114
  case PM_AND_NODE: {
115
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
111
116
  pm_serialize_node(parser, (pm_node_t *)((pm_and_node_t *)node)->left, buffer);
112
117
  pm_serialize_node(parser, (pm_node_t *)((pm_and_node_t *)node)->right, buffer);
113
118
  pm_serialize_location(parser, &((pm_and_node_t *)node)->operator_loc, buffer);
114
119
  break;
115
120
  }
116
121
  case PM_ARGUMENTS_NODE: {
117
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
122
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
118
123
  uint32_t arguments_size = pm_sizet_to_u32(((pm_arguments_node_t *)node)->arguments.size);
119
124
  pm_buffer_append_varuint(buffer, arguments_size);
120
125
  for (uint32_t index = 0; index < arguments_size; index++) {
@@ -123,7 +128,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
123
128
  break;
124
129
  }
125
130
  case PM_ARRAY_NODE: {
126
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
131
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
127
132
  uint32_t elements_size = pm_sizet_to_u32(((pm_array_node_t *)node)->elements.size);
128
133
  pm_buffer_append_varuint(buffer, elements_size);
129
134
  for (uint32_t index = 0; index < elements_size; index++) {
@@ -144,6 +149,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
144
149
  break;
145
150
  }
146
151
  case PM_ARRAY_PATTERN_NODE: {
152
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
147
153
  if (((pm_array_pattern_node_t *)node)->constant == NULL) {
148
154
  pm_buffer_append_byte(buffer, 0);
149
155
  } else {
@@ -179,6 +185,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
179
185
  break;
180
186
  }
181
187
  case PM_ASSOC_NODE: {
188
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
182
189
  pm_serialize_node(parser, (pm_node_t *)((pm_assoc_node_t *)node)->key, buffer);
183
190
  pm_serialize_node(parser, (pm_node_t *)((pm_assoc_node_t *)node)->value, buffer);
184
191
  if (((pm_assoc_node_t *)node)->operator_loc.start == NULL) {
@@ -190,6 +197,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
190
197
  break;
191
198
  }
192
199
  case PM_ASSOC_SPLAT_NODE: {
200
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
193
201
  if (((pm_assoc_splat_node_t *)node)->value == NULL) {
194
202
  pm_buffer_append_byte(buffer, 0);
195
203
  } else {
@@ -199,10 +207,12 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
199
207
  break;
200
208
  }
201
209
  case PM_BACK_REFERENCE_READ_NODE: {
210
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
202
211
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_back_reference_read_node_t *)node)->name));
203
212
  break;
204
213
  }
205
214
  case PM_BEGIN_NODE: {
215
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
206
216
  if (((pm_begin_node_t *)node)->begin_keyword_loc.start == NULL) {
207
217
  pm_buffer_append_byte(buffer, 0);
208
218
  } else {
@@ -238,6 +248,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
238
248
  break;
239
249
  }
240
250
  case PM_BLOCK_ARGUMENT_NODE: {
251
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
241
252
  if (((pm_block_argument_node_t *)node)->expression == NULL) {
242
253
  pm_buffer_append_byte(buffer, 0);
243
254
  } else {
@@ -247,11 +258,12 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
247
258
  break;
248
259
  }
249
260
  case PM_BLOCK_LOCAL_VARIABLE_NODE: {
250
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
261
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
251
262
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_block_local_variable_node_t *)node)->name));
252
263
  break;
253
264
  }
254
265
  case PM_BLOCK_NODE: {
266
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
255
267
  uint32_t locals_size = pm_sizet_to_u32(((pm_block_node_t *)node)->locals.size);
256
268
  pm_buffer_append_varuint(buffer, locals_size);
257
269
  for (uint32_t index = 0; index < locals_size; index++) {
@@ -272,7 +284,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
272
284
  break;
273
285
  }
274
286
  case PM_BLOCK_PARAMETER_NODE: {
275
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
287
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
276
288
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_block_parameter_node_t *)node)->name));
277
289
  if (((pm_block_parameter_node_t *)node)->name_loc.start == NULL) {
278
290
  pm_buffer_append_byte(buffer, 0);
@@ -284,6 +296,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
284
296
  break;
285
297
  }
286
298
  case PM_BLOCK_PARAMETERS_NODE: {
299
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
287
300
  if (((pm_block_parameters_node_t *)node)->parameters == NULL) {
288
301
  pm_buffer_append_byte(buffer, 0);
289
302
  } else {
@@ -309,6 +322,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
309
322
  break;
310
323
  }
311
324
  case PM_BREAK_NODE: {
325
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
312
326
  if (((pm_break_node_t *)node)->arguments == NULL) {
313
327
  pm_buffer_append_byte(buffer, 0);
314
328
  } else {
@@ -318,7 +332,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
318
332
  break;
319
333
  }
320
334
  case PM_CALL_AND_WRITE_NODE: {
321
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
335
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
322
336
  if (((pm_call_and_write_node_t *)node)->receiver == NULL) {
323
337
  pm_buffer_append_byte(buffer, 0);
324
338
  } else {
@@ -343,7 +357,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
343
357
  break;
344
358
  }
345
359
  case PM_CALL_NODE: {
346
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
360
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
347
361
  if (((pm_call_node_t *)node)->receiver == NULL) {
348
362
  pm_buffer_append_byte(buffer, 0);
349
363
  } else {
@@ -387,7 +401,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
387
401
  break;
388
402
  }
389
403
  case PM_CALL_OPERATOR_WRITE_NODE: {
390
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
404
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
391
405
  if (((pm_call_operator_write_node_t *)node)->receiver == NULL) {
392
406
  pm_buffer_append_byte(buffer, 0);
393
407
  } else {
@@ -413,7 +427,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
413
427
  break;
414
428
  }
415
429
  case PM_CALL_OR_WRITE_NODE: {
416
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
430
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
417
431
  if (((pm_call_or_write_node_t *)node)->receiver == NULL) {
418
432
  pm_buffer_append_byte(buffer, 0);
419
433
  } else {
@@ -438,7 +452,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
438
452
  break;
439
453
  }
440
454
  case PM_CALL_TARGET_NODE: {
441
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
455
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
442
456
  pm_serialize_node(parser, (pm_node_t *)((pm_call_target_node_t *)node)->receiver, buffer);
443
457
  pm_serialize_location(parser, &((pm_call_target_node_t *)node)->call_operator_loc, buffer);
444
458
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_call_target_node_t *)node)->name));
@@ -446,12 +460,14 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
446
460
  break;
447
461
  }
448
462
  case PM_CAPTURE_PATTERN_NODE: {
463
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
449
464
  pm_serialize_node(parser, (pm_node_t *)((pm_capture_pattern_node_t *)node)->value, buffer);
450
465
  pm_serialize_node(parser, (pm_node_t *)((pm_capture_pattern_node_t *)node)->target, buffer);
451
466
  pm_serialize_location(parser, &((pm_capture_pattern_node_t *)node)->operator_loc, buffer);
452
467
  break;
453
468
  }
454
469
  case PM_CASE_MATCH_NODE: {
470
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
455
471
  if (((pm_case_match_node_t *)node)->predicate == NULL) {
456
472
  pm_buffer_append_byte(buffer, 0);
457
473
  } else {
@@ -462,16 +478,17 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
462
478
  for (uint32_t index = 0; index < conditions_size; index++) {
463
479
  pm_serialize_node(parser, (pm_node_t *) ((pm_case_match_node_t *)node)->conditions.nodes[index], buffer);
464
480
  }
465
- if (((pm_case_match_node_t *)node)->consequent == NULL) {
481
+ if (((pm_case_match_node_t *)node)->else_clause == NULL) {
466
482
  pm_buffer_append_byte(buffer, 0);
467
483
  } else {
468
- pm_serialize_node(parser, (pm_node_t *)((pm_case_match_node_t *)node)->consequent, buffer);
484
+ pm_serialize_node(parser, (pm_node_t *)((pm_case_match_node_t *)node)->else_clause, buffer);
469
485
  }
470
486
  pm_serialize_location(parser, &((pm_case_match_node_t *)node)->case_keyword_loc, buffer);
471
487
  pm_serialize_location(parser, &((pm_case_match_node_t *)node)->end_keyword_loc, buffer);
472
488
  break;
473
489
  }
474
490
  case PM_CASE_NODE: {
491
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
475
492
  if (((pm_case_node_t *)node)->predicate == NULL) {
476
493
  pm_buffer_append_byte(buffer, 0);
477
494
  } else {
@@ -482,16 +499,17 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
482
499
  for (uint32_t index = 0; index < conditions_size; index++) {
483
500
  pm_serialize_node(parser, (pm_node_t *) ((pm_case_node_t *)node)->conditions.nodes[index], buffer);
484
501
  }
485
- if (((pm_case_node_t *)node)->consequent == NULL) {
502
+ if (((pm_case_node_t *)node)->else_clause == NULL) {
486
503
  pm_buffer_append_byte(buffer, 0);
487
504
  } else {
488
- pm_serialize_node(parser, (pm_node_t *)((pm_case_node_t *)node)->consequent, buffer);
505
+ pm_serialize_node(parser, (pm_node_t *)((pm_case_node_t *)node)->else_clause, buffer);
489
506
  }
490
507
  pm_serialize_location(parser, &((pm_case_node_t *)node)->case_keyword_loc, buffer);
491
508
  pm_serialize_location(parser, &((pm_case_node_t *)node)->end_keyword_loc, buffer);
492
509
  break;
493
510
  }
494
511
  case PM_CLASS_NODE: {
512
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
495
513
  uint32_t locals_size = pm_sizet_to_u32(((pm_class_node_t *)node)->locals.size);
496
514
  pm_buffer_append_varuint(buffer, locals_size);
497
515
  for (uint32_t index = 0; index < locals_size; index++) {
@@ -520,6 +538,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
520
538
  break;
521
539
  }
522
540
  case PM_CLASS_VARIABLE_AND_WRITE_NODE: {
541
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
523
542
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_class_variable_and_write_node_t *)node)->name));
524
543
  pm_serialize_location(parser, &((pm_class_variable_and_write_node_t *)node)->name_loc, buffer);
525
544
  pm_serialize_location(parser, &((pm_class_variable_and_write_node_t *)node)->operator_loc, buffer);
@@ -527,6 +546,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
527
546
  break;
528
547
  }
529
548
  case PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE: {
549
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
530
550
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_class_variable_operator_write_node_t *)node)->name));
531
551
  pm_serialize_location(parser, &((pm_class_variable_operator_write_node_t *)node)->name_loc, buffer);
532
552
  pm_serialize_location(parser, &((pm_class_variable_operator_write_node_t *)node)->binary_operator_loc, buffer);
@@ -535,6 +555,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
535
555
  break;
536
556
  }
537
557
  case PM_CLASS_VARIABLE_OR_WRITE_NODE: {
558
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
538
559
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_class_variable_or_write_node_t *)node)->name));
539
560
  pm_serialize_location(parser, &((pm_class_variable_or_write_node_t *)node)->name_loc, buffer);
540
561
  pm_serialize_location(parser, &((pm_class_variable_or_write_node_t *)node)->operator_loc, buffer);
@@ -542,14 +563,17 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
542
563
  break;
543
564
  }
544
565
  case PM_CLASS_VARIABLE_READ_NODE: {
566
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
545
567
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_class_variable_read_node_t *)node)->name));
546
568
  break;
547
569
  }
548
570
  case PM_CLASS_VARIABLE_TARGET_NODE: {
571
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
549
572
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_class_variable_target_node_t *)node)->name));
550
573
  break;
551
574
  }
552
575
  case PM_CLASS_VARIABLE_WRITE_NODE: {
576
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
553
577
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_class_variable_write_node_t *)node)->name));
554
578
  pm_serialize_location(parser, &((pm_class_variable_write_node_t *)node)->name_loc, buffer);
555
579
  pm_serialize_node(parser, (pm_node_t *)((pm_class_variable_write_node_t *)node)->value, buffer);
@@ -557,6 +581,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
557
581
  break;
558
582
  }
559
583
  case PM_CONSTANT_AND_WRITE_NODE: {
584
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
560
585
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_constant_and_write_node_t *)node)->name));
561
586
  pm_serialize_location(parser, &((pm_constant_and_write_node_t *)node)->name_loc, buffer);
562
587
  pm_serialize_location(parser, &((pm_constant_and_write_node_t *)node)->operator_loc, buffer);
@@ -564,6 +589,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
564
589
  break;
565
590
  }
566
591
  case PM_CONSTANT_OPERATOR_WRITE_NODE: {
592
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
567
593
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_constant_operator_write_node_t *)node)->name));
568
594
  pm_serialize_location(parser, &((pm_constant_operator_write_node_t *)node)->name_loc, buffer);
569
595
  pm_serialize_location(parser, &((pm_constant_operator_write_node_t *)node)->binary_operator_loc, buffer);
@@ -572,6 +598,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
572
598
  break;
573
599
  }
574
600
  case PM_CONSTANT_OR_WRITE_NODE: {
601
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
575
602
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_constant_or_write_node_t *)node)->name));
576
603
  pm_serialize_location(parser, &((pm_constant_or_write_node_t *)node)->name_loc, buffer);
577
604
  pm_serialize_location(parser, &((pm_constant_or_write_node_t *)node)->operator_loc, buffer);
@@ -579,12 +606,14 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
579
606
  break;
580
607
  }
581
608
  case PM_CONSTANT_PATH_AND_WRITE_NODE: {
609
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
582
610
  pm_serialize_node(parser, (pm_node_t *)((pm_constant_path_and_write_node_t *)node)->target, buffer);
583
611
  pm_serialize_location(parser, &((pm_constant_path_and_write_node_t *)node)->operator_loc, buffer);
584
612
  pm_serialize_node(parser, (pm_node_t *)((pm_constant_path_and_write_node_t *)node)->value, buffer);
585
613
  break;
586
614
  }
587
615
  case PM_CONSTANT_PATH_NODE: {
616
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
588
617
  if (((pm_constant_path_node_t *)node)->parent == NULL) {
589
618
  pm_buffer_append_byte(buffer, 0);
590
619
  } else {
@@ -596,6 +625,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
596
625
  break;
597
626
  }
598
627
  case PM_CONSTANT_PATH_OPERATOR_WRITE_NODE: {
628
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
599
629
  pm_serialize_node(parser, (pm_node_t *)((pm_constant_path_operator_write_node_t *)node)->target, buffer);
600
630
  pm_serialize_location(parser, &((pm_constant_path_operator_write_node_t *)node)->binary_operator_loc, buffer);
601
631
  pm_serialize_node(parser, (pm_node_t *)((pm_constant_path_operator_write_node_t *)node)->value, buffer);
@@ -603,12 +633,14 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
603
633
  break;
604
634
  }
605
635
  case PM_CONSTANT_PATH_OR_WRITE_NODE: {
636
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
606
637
  pm_serialize_node(parser, (pm_node_t *)((pm_constant_path_or_write_node_t *)node)->target, buffer);
607
638
  pm_serialize_location(parser, &((pm_constant_path_or_write_node_t *)node)->operator_loc, buffer);
608
639
  pm_serialize_node(parser, (pm_node_t *)((pm_constant_path_or_write_node_t *)node)->value, buffer);
609
640
  break;
610
641
  }
611
642
  case PM_CONSTANT_PATH_TARGET_NODE: {
643
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
612
644
  if (((pm_constant_path_target_node_t *)node)->parent == NULL) {
613
645
  pm_buffer_append_byte(buffer, 0);
614
646
  } else {
@@ -620,20 +652,24 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
620
652
  break;
621
653
  }
622
654
  case PM_CONSTANT_PATH_WRITE_NODE: {
655
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
623
656
  pm_serialize_node(parser, (pm_node_t *)((pm_constant_path_write_node_t *)node)->target, buffer);
624
657
  pm_serialize_location(parser, &((pm_constant_path_write_node_t *)node)->operator_loc, buffer);
625
658
  pm_serialize_node(parser, (pm_node_t *)((pm_constant_path_write_node_t *)node)->value, buffer);
626
659
  break;
627
660
  }
628
661
  case PM_CONSTANT_READ_NODE: {
662
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
629
663
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_constant_read_node_t *)node)->name));
630
664
  break;
631
665
  }
632
666
  case PM_CONSTANT_TARGET_NODE: {
667
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
633
668
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_constant_target_node_t *)node)->name));
634
669
  break;
635
670
  }
636
671
  case PM_CONSTANT_WRITE_NODE: {
672
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
637
673
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_constant_write_node_t *)node)->name));
638
674
  pm_serialize_location(parser, &((pm_constant_write_node_t *)node)->name_loc, buffer);
639
675
  pm_serialize_node(parser, (pm_node_t *)((pm_constant_write_node_t *)node)->value, buffer);
@@ -645,6 +681,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
645
681
  // encoding of location u32s make us need to save this offset.
646
682
  size_t length_offset = buffer->length;
647
683
  pm_buffer_append_string(buffer, "\0\0\0\0", 4); /* consume 4 bytes, updated below */
684
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
648
685
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_def_node_t *)node)->name));
649
686
  pm_serialize_location(parser, &((pm_def_node_t *)node)->name_loc, buffer);
650
687
  if (((pm_def_node_t *)node)->receiver == NULL) {
@@ -704,6 +741,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
704
741
  break;
705
742
  }
706
743
  case PM_DEFINED_NODE: {
744
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
707
745
  if (((pm_defined_node_t *)node)->lparen_loc.start == NULL) {
708
746
  pm_buffer_append_byte(buffer, 0);
709
747
  } else {
@@ -721,6 +759,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
721
759
  break;
722
760
  }
723
761
  case PM_ELSE_NODE: {
762
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
724
763
  pm_serialize_location(parser, &((pm_else_node_t *)node)->else_keyword_loc, buffer);
725
764
  if (((pm_else_node_t *)node)->statements == NULL) {
726
765
  pm_buffer_append_byte(buffer, 0);
@@ -736,6 +775,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
736
775
  break;
737
776
  }
738
777
  case PM_EMBEDDED_STATEMENTS_NODE: {
778
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
739
779
  pm_serialize_location(parser, &((pm_embedded_statements_node_t *)node)->opening_loc, buffer);
740
780
  if (((pm_embedded_statements_node_t *)node)->statements == NULL) {
741
781
  pm_buffer_append_byte(buffer, 0);
@@ -746,11 +786,13 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
746
786
  break;
747
787
  }
748
788
  case PM_EMBEDDED_VARIABLE_NODE: {
789
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
749
790
  pm_serialize_location(parser, &((pm_embedded_variable_node_t *)node)->operator_loc, buffer);
750
791
  pm_serialize_node(parser, (pm_node_t *)((pm_embedded_variable_node_t *)node)->variable, buffer);
751
792
  break;
752
793
  }
753
794
  case PM_ENSURE_NODE: {
795
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
754
796
  pm_serialize_location(parser, &((pm_ensure_node_t *)node)->ensure_keyword_loc, buffer);
755
797
  if (((pm_ensure_node_t *)node)->statements == NULL) {
756
798
  pm_buffer_append_byte(buffer, 0);
@@ -761,9 +803,11 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
761
803
  break;
762
804
  }
763
805
  case PM_FALSE_NODE: {
806
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
764
807
  break;
765
808
  }
766
809
  case PM_FIND_PATTERN_NODE: {
810
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
767
811
  if (((pm_find_pattern_node_t *)node)->constant == NULL) {
768
812
  pm_buffer_append_byte(buffer, 0);
769
813
  } else {
@@ -791,7 +835,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
791
835
  break;
792
836
  }
793
837
  case PM_FLIP_FLOP_NODE: {
794
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
838
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
795
839
  if (((pm_flip_flop_node_t *)node)->left == NULL) {
796
840
  pm_buffer_append_byte(buffer, 0);
797
841
  } else {
@@ -806,10 +850,12 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
806
850
  break;
807
851
  }
808
852
  case PM_FLOAT_NODE: {
853
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
809
854
  pm_buffer_append_double(buffer, ((pm_float_node_t *)node)->value);
810
855
  break;
811
856
  }
812
857
  case PM_FOR_NODE: {
858
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
813
859
  pm_serialize_node(parser, (pm_node_t *)((pm_for_node_t *)node)->index, buffer);
814
860
  pm_serialize_node(parser, (pm_node_t *)((pm_for_node_t *)node)->collection, buffer);
815
861
  if (((pm_for_node_t *)node)->statements == NULL) {
@@ -829,12 +875,15 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
829
875
  break;
830
876
  }
831
877
  case PM_FORWARDING_ARGUMENTS_NODE: {
878
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
832
879
  break;
833
880
  }
834
881
  case PM_FORWARDING_PARAMETER_NODE: {
882
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
835
883
  break;
836
884
  }
837
885
  case PM_FORWARDING_SUPER_NODE: {
886
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
838
887
  if (((pm_forwarding_super_node_t *)node)->block == NULL) {
839
888
  pm_buffer_append_byte(buffer, 0);
840
889
  } else {
@@ -843,6 +892,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
843
892
  break;
844
893
  }
845
894
  case PM_GLOBAL_VARIABLE_AND_WRITE_NODE: {
895
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
846
896
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_global_variable_and_write_node_t *)node)->name));
847
897
  pm_serialize_location(parser, &((pm_global_variable_and_write_node_t *)node)->name_loc, buffer);
848
898
  pm_serialize_location(parser, &((pm_global_variable_and_write_node_t *)node)->operator_loc, buffer);
@@ -850,6 +900,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
850
900
  break;
851
901
  }
852
902
  case PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: {
903
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
853
904
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_global_variable_operator_write_node_t *)node)->name));
854
905
  pm_serialize_location(parser, &((pm_global_variable_operator_write_node_t *)node)->name_loc, buffer);
855
906
  pm_serialize_location(parser, &((pm_global_variable_operator_write_node_t *)node)->binary_operator_loc, buffer);
@@ -858,6 +909,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
858
909
  break;
859
910
  }
860
911
  case PM_GLOBAL_VARIABLE_OR_WRITE_NODE: {
912
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
861
913
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_global_variable_or_write_node_t *)node)->name));
862
914
  pm_serialize_location(parser, &((pm_global_variable_or_write_node_t *)node)->name_loc, buffer);
863
915
  pm_serialize_location(parser, &((pm_global_variable_or_write_node_t *)node)->operator_loc, buffer);
@@ -865,14 +917,17 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
865
917
  break;
866
918
  }
867
919
  case PM_GLOBAL_VARIABLE_READ_NODE: {
920
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
868
921
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_global_variable_read_node_t *)node)->name));
869
922
  break;
870
923
  }
871
924
  case PM_GLOBAL_VARIABLE_TARGET_NODE: {
925
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
872
926
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_global_variable_target_node_t *)node)->name));
873
927
  break;
874
928
  }
875
929
  case PM_GLOBAL_VARIABLE_WRITE_NODE: {
930
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
876
931
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_global_variable_write_node_t *)node)->name));
877
932
  pm_serialize_location(parser, &((pm_global_variable_write_node_t *)node)->name_loc, buffer);
878
933
  pm_serialize_node(parser, (pm_node_t *)((pm_global_variable_write_node_t *)node)->value, buffer);
@@ -880,6 +935,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
880
935
  break;
881
936
  }
882
937
  case PM_HASH_NODE: {
938
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
883
939
  pm_serialize_location(parser, &((pm_hash_node_t *)node)->opening_loc, buffer);
884
940
  uint32_t elements_size = pm_sizet_to_u32(((pm_hash_node_t *)node)->elements.size);
885
941
  pm_buffer_append_varuint(buffer, elements_size);
@@ -890,6 +946,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
890
946
  break;
891
947
  }
892
948
  case PM_HASH_PATTERN_NODE: {
949
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
893
950
  if (((pm_hash_pattern_node_t *)node)->constant == NULL) {
894
951
  pm_buffer_append_byte(buffer, 0);
895
952
  } else {
@@ -920,6 +977,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
920
977
  break;
921
978
  }
922
979
  case PM_IF_NODE: {
980
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
923
981
  if (((pm_if_node_t *)node)->if_keyword_loc.start == NULL) {
924
982
  pm_buffer_append_byte(buffer, 0);
925
983
  } else {
@@ -938,10 +996,10 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
938
996
  } else {
939
997
  pm_serialize_node(parser, (pm_node_t *)((pm_if_node_t *)node)->statements, buffer);
940
998
  }
941
- if (((pm_if_node_t *)node)->consequent == NULL) {
999
+ if (((pm_if_node_t *)node)->subsequent == NULL) {
942
1000
  pm_buffer_append_byte(buffer, 0);
943
1001
  } else {
944
- pm_serialize_node(parser, (pm_node_t *)((pm_if_node_t *)node)->consequent, buffer);
1002
+ pm_serialize_node(parser, (pm_node_t *)((pm_if_node_t *)node)->subsequent, buffer);
945
1003
  }
946
1004
  if (((pm_if_node_t *)node)->end_keyword_loc.start == NULL) {
947
1005
  pm_buffer_append_byte(buffer, 0);
@@ -952,17 +1010,21 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
952
1010
  break;
953
1011
  }
954
1012
  case PM_IMAGINARY_NODE: {
1013
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
955
1014
  pm_serialize_node(parser, (pm_node_t *)((pm_imaginary_node_t *)node)->numeric, buffer);
956
1015
  break;
957
1016
  }
958
1017
  case PM_IMPLICIT_NODE: {
1018
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
959
1019
  pm_serialize_node(parser, (pm_node_t *)((pm_implicit_node_t *)node)->value, buffer);
960
1020
  break;
961
1021
  }
962
1022
  case PM_IMPLICIT_REST_NODE: {
1023
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
963
1024
  break;
964
1025
  }
965
1026
  case PM_IN_NODE: {
1027
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
966
1028
  pm_serialize_node(parser, (pm_node_t *)((pm_in_node_t *)node)->pattern, buffer);
967
1029
  if (((pm_in_node_t *)node)->statements == NULL) {
968
1030
  pm_buffer_append_byte(buffer, 0);
@@ -979,7 +1041,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
979
1041
  break;
980
1042
  }
981
1043
  case PM_INDEX_AND_WRITE_NODE: {
982
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1044
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
983
1045
  if (((pm_index_and_write_node_t *)node)->receiver == NULL) {
984
1046
  pm_buffer_append_byte(buffer, 0);
985
1047
  } else {
@@ -1008,7 +1070,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1008
1070
  break;
1009
1071
  }
1010
1072
  case PM_INDEX_OPERATOR_WRITE_NODE: {
1011
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1073
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1012
1074
  if (((pm_index_operator_write_node_t *)node)->receiver == NULL) {
1013
1075
  pm_buffer_append_byte(buffer, 0);
1014
1076
  } else {
@@ -1038,7 +1100,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1038
1100
  break;
1039
1101
  }
1040
1102
  case PM_INDEX_OR_WRITE_NODE: {
1041
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1103
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1042
1104
  if (((pm_index_or_write_node_t *)node)->receiver == NULL) {
1043
1105
  pm_buffer_append_byte(buffer, 0);
1044
1106
  } else {
@@ -1067,7 +1129,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1067
1129
  break;
1068
1130
  }
1069
1131
  case PM_INDEX_TARGET_NODE: {
1070
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1132
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1071
1133
  pm_serialize_node(parser, (pm_node_t *)((pm_index_target_node_t *)node)->receiver, buffer);
1072
1134
  pm_serialize_location(parser, &((pm_index_target_node_t *)node)->opening_loc, buffer);
1073
1135
  if (((pm_index_target_node_t *)node)->arguments == NULL) {
@@ -1084,6 +1146,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1084
1146
  break;
1085
1147
  }
1086
1148
  case PM_INSTANCE_VARIABLE_AND_WRITE_NODE: {
1149
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1087
1150
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_instance_variable_and_write_node_t *)node)->name));
1088
1151
  pm_serialize_location(parser, &((pm_instance_variable_and_write_node_t *)node)->name_loc, buffer);
1089
1152
  pm_serialize_location(parser, &((pm_instance_variable_and_write_node_t *)node)->operator_loc, buffer);
@@ -1091,6 +1154,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1091
1154
  break;
1092
1155
  }
1093
1156
  case PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: {
1157
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1094
1158
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_instance_variable_operator_write_node_t *)node)->name));
1095
1159
  pm_serialize_location(parser, &((pm_instance_variable_operator_write_node_t *)node)->name_loc, buffer);
1096
1160
  pm_serialize_location(parser, &((pm_instance_variable_operator_write_node_t *)node)->binary_operator_loc, buffer);
@@ -1099,6 +1163,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1099
1163
  break;
1100
1164
  }
1101
1165
  case PM_INSTANCE_VARIABLE_OR_WRITE_NODE: {
1166
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1102
1167
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_instance_variable_or_write_node_t *)node)->name));
1103
1168
  pm_serialize_location(parser, &((pm_instance_variable_or_write_node_t *)node)->name_loc, buffer);
1104
1169
  pm_serialize_location(parser, &((pm_instance_variable_or_write_node_t *)node)->operator_loc, buffer);
@@ -1106,14 +1171,17 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1106
1171
  break;
1107
1172
  }
1108
1173
  case PM_INSTANCE_VARIABLE_READ_NODE: {
1174
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1109
1175
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_instance_variable_read_node_t *)node)->name));
1110
1176
  break;
1111
1177
  }
1112
1178
  case PM_INSTANCE_VARIABLE_TARGET_NODE: {
1179
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1113
1180
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_instance_variable_target_node_t *)node)->name));
1114
1181
  break;
1115
1182
  }
1116
1183
  case PM_INSTANCE_VARIABLE_WRITE_NODE: {
1184
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1117
1185
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_instance_variable_write_node_t *)node)->name));
1118
1186
  pm_serialize_location(parser, &((pm_instance_variable_write_node_t *)node)->name_loc, buffer);
1119
1187
  pm_serialize_node(parser, (pm_node_t *)((pm_instance_variable_write_node_t *)node)->value, buffer);
@@ -1121,12 +1189,12 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1121
1189
  break;
1122
1190
  }
1123
1191
  case PM_INTEGER_NODE: {
1124
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1192
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1125
1193
  pm_serialize_integer(&((pm_integer_node_t *)node)->value, buffer);
1126
1194
  break;
1127
1195
  }
1128
1196
  case PM_INTERPOLATED_MATCH_LAST_LINE_NODE: {
1129
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1197
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1130
1198
  pm_serialize_location(parser, &((pm_interpolated_match_last_line_node_t *)node)->opening_loc, buffer);
1131
1199
  uint32_t parts_size = pm_sizet_to_u32(((pm_interpolated_match_last_line_node_t *)node)->parts.size);
1132
1200
  pm_buffer_append_varuint(buffer, parts_size);
@@ -1137,7 +1205,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1137
1205
  break;
1138
1206
  }
1139
1207
  case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE: {
1140
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1208
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1141
1209
  pm_serialize_location(parser, &((pm_interpolated_regular_expression_node_t *)node)->opening_loc, buffer);
1142
1210
  uint32_t parts_size = pm_sizet_to_u32(((pm_interpolated_regular_expression_node_t *)node)->parts.size);
1143
1211
  pm_buffer_append_varuint(buffer, parts_size);
@@ -1148,7 +1216,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1148
1216
  break;
1149
1217
  }
1150
1218
  case PM_INTERPOLATED_STRING_NODE: {
1151
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1219
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1152
1220
  if (((pm_interpolated_string_node_t *)node)->opening_loc.start == NULL) {
1153
1221
  pm_buffer_append_byte(buffer, 0);
1154
1222
  } else {
@@ -1169,6 +1237,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1169
1237
  break;
1170
1238
  }
1171
1239
  case PM_INTERPOLATED_SYMBOL_NODE: {
1240
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1172
1241
  if (((pm_interpolated_symbol_node_t *)node)->opening_loc.start == NULL) {
1173
1242
  pm_buffer_append_byte(buffer, 0);
1174
1243
  } else {
@@ -1189,6 +1258,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1189
1258
  break;
1190
1259
  }
1191
1260
  case PM_INTERPOLATED_X_STRING_NODE: {
1261
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1192
1262
  pm_serialize_location(parser, &((pm_interpolated_x_string_node_t *)node)->opening_loc, buffer);
1193
1263
  uint32_t parts_size = pm_sizet_to_u32(((pm_interpolated_x_string_node_t *)node)->parts.size);
1194
1264
  pm_buffer_append_varuint(buffer, parts_size);
@@ -1199,13 +1269,15 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1199
1269
  break;
1200
1270
  }
1201
1271
  case PM_IT_LOCAL_VARIABLE_READ_NODE: {
1272
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1202
1273
  break;
1203
1274
  }
1204
1275
  case PM_IT_PARAMETERS_NODE: {
1276
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1205
1277
  break;
1206
1278
  }
1207
1279
  case PM_KEYWORD_HASH_NODE: {
1208
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1280
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1209
1281
  uint32_t elements_size = pm_sizet_to_u32(((pm_keyword_hash_node_t *)node)->elements.size);
1210
1282
  pm_buffer_append_varuint(buffer, elements_size);
1211
1283
  for (uint32_t index = 0; index < elements_size; index++) {
@@ -1214,7 +1286,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1214
1286
  break;
1215
1287
  }
1216
1288
  case PM_KEYWORD_REST_PARAMETER_NODE: {
1217
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1289
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1218
1290
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_keyword_rest_parameter_node_t *)node)->name));
1219
1291
  if (((pm_keyword_rest_parameter_node_t *)node)->name_loc.start == NULL) {
1220
1292
  pm_buffer_append_byte(buffer, 0);
@@ -1226,6 +1298,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1226
1298
  break;
1227
1299
  }
1228
1300
  case PM_LAMBDA_NODE: {
1301
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1229
1302
  uint32_t locals_size = pm_sizet_to_u32(((pm_lambda_node_t *)node)->locals.size);
1230
1303
  pm_buffer_append_varuint(buffer, locals_size);
1231
1304
  for (uint32_t index = 0; index < locals_size; index++) {
@@ -1247,6 +1320,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1247
1320
  break;
1248
1321
  }
1249
1322
  case PM_LOCAL_VARIABLE_AND_WRITE_NODE: {
1323
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1250
1324
  pm_serialize_location(parser, &((pm_local_variable_and_write_node_t *)node)->name_loc, buffer);
1251
1325
  pm_serialize_location(parser, &((pm_local_variable_and_write_node_t *)node)->operator_loc, buffer);
1252
1326
  pm_serialize_node(parser, (pm_node_t *)((pm_local_variable_and_write_node_t *)node)->value, buffer);
@@ -1255,6 +1329,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1255
1329
  break;
1256
1330
  }
1257
1331
  case PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: {
1332
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1258
1333
  pm_serialize_location(parser, &((pm_local_variable_operator_write_node_t *)node)->name_loc, buffer);
1259
1334
  pm_serialize_location(parser, &((pm_local_variable_operator_write_node_t *)node)->binary_operator_loc, buffer);
1260
1335
  pm_serialize_node(parser, (pm_node_t *)((pm_local_variable_operator_write_node_t *)node)->value, buffer);
@@ -1264,6 +1339,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1264
1339
  break;
1265
1340
  }
1266
1341
  case PM_LOCAL_VARIABLE_OR_WRITE_NODE: {
1342
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1267
1343
  pm_serialize_location(parser, &((pm_local_variable_or_write_node_t *)node)->name_loc, buffer);
1268
1344
  pm_serialize_location(parser, &((pm_local_variable_or_write_node_t *)node)->operator_loc, buffer);
1269
1345
  pm_serialize_node(parser, (pm_node_t *)((pm_local_variable_or_write_node_t *)node)->value, buffer);
@@ -1272,16 +1348,19 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1272
1348
  break;
1273
1349
  }
1274
1350
  case PM_LOCAL_VARIABLE_READ_NODE: {
1351
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1275
1352
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_local_variable_read_node_t *)node)->name));
1276
1353
  pm_buffer_append_varuint(buffer, ((pm_local_variable_read_node_t *)node)->depth);
1277
1354
  break;
1278
1355
  }
1279
1356
  case PM_LOCAL_VARIABLE_TARGET_NODE: {
1357
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1280
1358
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_local_variable_target_node_t *)node)->name));
1281
1359
  pm_buffer_append_varuint(buffer, ((pm_local_variable_target_node_t *)node)->depth);
1282
1360
  break;
1283
1361
  }
1284
1362
  case PM_LOCAL_VARIABLE_WRITE_NODE: {
1363
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1285
1364
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_local_variable_write_node_t *)node)->name));
1286
1365
  pm_buffer_append_varuint(buffer, ((pm_local_variable_write_node_t *)node)->depth);
1287
1366
  pm_serialize_location(parser, &((pm_local_variable_write_node_t *)node)->name_loc, buffer);
@@ -1290,7 +1369,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1290
1369
  break;
1291
1370
  }
1292
1371
  case PM_MATCH_LAST_LINE_NODE: {
1293
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1372
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1294
1373
  pm_serialize_location(parser, &((pm_match_last_line_node_t *)node)->opening_loc, buffer);
1295
1374
  pm_serialize_location(parser, &((pm_match_last_line_node_t *)node)->content_loc, buffer);
1296
1375
  pm_serialize_location(parser, &((pm_match_last_line_node_t *)node)->closing_loc, buffer);
@@ -1298,18 +1377,21 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1298
1377
  break;
1299
1378
  }
1300
1379
  case PM_MATCH_PREDICATE_NODE: {
1380
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1301
1381
  pm_serialize_node(parser, (pm_node_t *)((pm_match_predicate_node_t *)node)->value, buffer);
1302
1382
  pm_serialize_node(parser, (pm_node_t *)((pm_match_predicate_node_t *)node)->pattern, buffer);
1303
1383
  pm_serialize_location(parser, &((pm_match_predicate_node_t *)node)->operator_loc, buffer);
1304
1384
  break;
1305
1385
  }
1306
1386
  case PM_MATCH_REQUIRED_NODE: {
1387
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1307
1388
  pm_serialize_node(parser, (pm_node_t *)((pm_match_required_node_t *)node)->value, buffer);
1308
1389
  pm_serialize_node(parser, (pm_node_t *)((pm_match_required_node_t *)node)->pattern, buffer);
1309
1390
  pm_serialize_location(parser, &((pm_match_required_node_t *)node)->operator_loc, buffer);
1310
1391
  break;
1311
1392
  }
1312
1393
  case PM_MATCH_WRITE_NODE: {
1394
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1313
1395
  pm_serialize_node(parser, (pm_node_t *)((pm_match_write_node_t *)node)->call, buffer);
1314
1396
  uint32_t targets_size = pm_sizet_to_u32(((pm_match_write_node_t *)node)->targets.size);
1315
1397
  pm_buffer_append_varuint(buffer, targets_size);
@@ -1319,9 +1401,11 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1319
1401
  break;
1320
1402
  }
1321
1403
  case PM_MISSING_NODE: {
1404
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1322
1405
  break;
1323
1406
  }
1324
1407
  case PM_MODULE_NODE: {
1408
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1325
1409
  uint32_t locals_size = pm_sizet_to_u32(((pm_module_node_t *)node)->locals.size);
1326
1410
  pm_buffer_append_varuint(buffer, locals_size);
1327
1411
  for (uint32_t index = 0; index < locals_size; index++) {
@@ -1339,6 +1423,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1339
1423
  break;
1340
1424
  }
1341
1425
  case PM_MULTI_TARGET_NODE: {
1426
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1342
1427
  uint32_t lefts_size = pm_sizet_to_u32(((pm_multi_target_node_t *)node)->lefts.size);
1343
1428
  pm_buffer_append_varuint(buffer, lefts_size);
1344
1429
  for (uint32_t index = 0; index < lefts_size; index++) {
@@ -1369,6 +1454,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1369
1454
  break;
1370
1455
  }
1371
1456
  case PM_MULTI_WRITE_NODE: {
1457
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1372
1458
  uint32_t lefts_size = pm_sizet_to_u32(((pm_multi_write_node_t *)node)->lefts.size);
1373
1459
  pm_buffer_append_varuint(buffer, lefts_size);
1374
1460
  for (uint32_t index = 0; index < lefts_size; index++) {
@@ -1401,6 +1487,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1401
1487
  break;
1402
1488
  }
1403
1489
  case PM_NEXT_NODE: {
1490
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1404
1491
  if (((pm_next_node_t *)node)->arguments == NULL) {
1405
1492
  pm_buffer_append_byte(buffer, 0);
1406
1493
  } else {
@@ -1410,30 +1497,34 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1410
1497
  break;
1411
1498
  }
1412
1499
  case PM_NIL_NODE: {
1500
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1413
1501
  break;
1414
1502
  }
1415
1503
  case PM_NO_KEYWORDS_PARAMETER_NODE: {
1504
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1416
1505
  pm_serialize_location(parser, &((pm_no_keywords_parameter_node_t *)node)->operator_loc, buffer);
1417
1506
  pm_serialize_location(parser, &((pm_no_keywords_parameter_node_t *)node)->keyword_loc, buffer);
1418
1507
  break;
1419
1508
  }
1420
1509
  case PM_NUMBERED_PARAMETERS_NODE: {
1510
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1421
1511
  pm_buffer_append_byte(buffer, ((pm_numbered_parameters_node_t *)node)->maximum);
1422
1512
  break;
1423
1513
  }
1424
1514
  case PM_NUMBERED_REFERENCE_READ_NODE: {
1515
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1425
1516
  pm_buffer_append_varuint(buffer, ((pm_numbered_reference_read_node_t *)node)->number);
1426
1517
  break;
1427
1518
  }
1428
1519
  case PM_OPTIONAL_KEYWORD_PARAMETER_NODE: {
1429
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1520
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1430
1521
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_optional_keyword_parameter_node_t *)node)->name));
1431
1522
  pm_serialize_location(parser, &((pm_optional_keyword_parameter_node_t *)node)->name_loc, buffer);
1432
1523
  pm_serialize_node(parser, (pm_node_t *)((pm_optional_keyword_parameter_node_t *)node)->value, buffer);
1433
1524
  break;
1434
1525
  }
1435
1526
  case PM_OPTIONAL_PARAMETER_NODE: {
1436
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1527
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1437
1528
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_optional_parameter_node_t *)node)->name));
1438
1529
  pm_serialize_location(parser, &((pm_optional_parameter_node_t *)node)->name_loc, buffer);
1439
1530
  pm_serialize_location(parser, &((pm_optional_parameter_node_t *)node)->operator_loc, buffer);
@@ -1441,12 +1532,14 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1441
1532
  break;
1442
1533
  }
1443
1534
  case PM_OR_NODE: {
1535
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1444
1536
  pm_serialize_node(parser, (pm_node_t *)((pm_or_node_t *)node)->left, buffer);
1445
1537
  pm_serialize_node(parser, (pm_node_t *)((pm_or_node_t *)node)->right, buffer);
1446
1538
  pm_serialize_location(parser, &((pm_or_node_t *)node)->operator_loc, buffer);
1447
1539
  break;
1448
1540
  }
1449
1541
  case PM_PARAMETERS_NODE: {
1542
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1450
1543
  uint32_t requireds_size = pm_sizet_to_u32(((pm_parameters_node_t *)node)->requireds.size);
1451
1544
  pm_buffer_append_varuint(buffer, requireds_size);
1452
1545
  for (uint32_t index = 0; index < requireds_size; index++) {
@@ -1485,6 +1578,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1485
1578
  break;
1486
1579
  }
1487
1580
  case PM_PARENTHESES_NODE: {
1581
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1488
1582
  if (((pm_parentheses_node_t *)node)->body == NULL) {
1489
1583
  pm_buffer_append_byte(buffer, 0);
1490
1584
  } else {
@@ -1495,6 +1589,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1495
1589
  break;
1496
1590
  }
1497
1591
  case PM_PINNED_EXPRESSION_NODE: {
1592
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1498
1593
  pm_serialize_node(parser, (pm_node_t *)((pm_pinned_expression_node_t *)node)->expression, buffer);
1499
1594
  pm_serialize_location(parser, &((pm_pinned_expression_node_t *)node)->operator_loc, buffer);
1500
1595
  pm_serialize_location(parser, &((pm_pinned_expression_node_t *)node)->lparen_loc, buffer);
@@ -1502,11 +1597,13 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1502
1597
  break;
1503
1598
  }
1504
1599
  case PM_PINNED_VARIABLE_NODE: {
1600
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1505
1601
  pm_serialize_node(parser, (pm_node_t *)((pm_pinned_variable_node_t *)node)->variable, buffer);
1506
1602
  pm_serialize_location(parser, &((pm_pinned_variable_node_t *)node)->operator_loc, buffer);
1507
1603
  break;
1508
1604
  }
1509
1605
  case PM_POST_EXECUTION_NODE: {
1606
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1510
1607
  if (((pm_post_execution_node_t *)node)->statements == NULL) {
1511
1608
  pm_buffer_append_byte(buffer, 0);
1512
1609
  } else {
@@ -1518,6 +1615,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1518
1615
  break;
1519
1616
  }
1520
1617
  case PM_PRE_EXECUTION_NODE: {
1618
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1521
1619
  if (((pm_pre_execution_node_t *)node)->statements == NULL) {
1522
1620
  pm_buffer_append_byte(buffer, 0);
1523
1621
  } else {
@@ -1529,6 +1627,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1529
1627
  break;
1530
1628
  }
1531
1629
  case PM_PROGRAM_NODE: {
1630
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1532
1631
  uint32_t locals_size = pm_sizet_to_u32(((pm_program_node_t *)node)->locals.size);
1533
1632
  pm_buffer_append_varuint(buffer, locals_size);
1534
1633
  for (uint32_t index = 0; index < locals_size; index++) {
@@ -1538,7 +1637,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1538
1637
  break;
1539
1638
  }
1540
1639
  case PM_RANGE_NODE: {
1541
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1640
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1542
1641
  if (((pm_range_node_t *)node)->left == NULL) {
1543
1642
  pm_buffer_append_byte(buffer, 0);
1544
1643
  } else {
@@ -1553,16 +1652,17 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1553
1652
  break;
1554
1653
  }
1555
1654
  case PM_RATIONAL_NODE: {
1556
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1655
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1557
1656
  pm_serialize_integer(&((pm_rational_node_t *)node)->numerator, buffer);
1558
1657
  pm_serialize_integer(&((pm_rational_node_t *)node)->denominator, buffer);
1559
1658
  break;
1560
1659
  }
1561
1660
  case PM_REDO_NODE: {
1661
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1562
1662
  break;
1563
1663
  }
1564
1664
  case PM_REGULAR_EXPRESSION_NODE: {
1565
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1665
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1566
1666
  pm_serialize_location(parser, &((pm_regular_expression_node_t *)node)->opening_loc, buffer);
1567
1667
  pm_serialize_location(parser, &((pm_regular_expression_node_t *)node)->content_loc, buffer);
1568
1668
  pm_serialize_location(parser, &((pm_regular_expression_node_t *)node)->closing_loc, buffer);
@@ -1570,23 +1670,25 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1570
1670
  break;
1571
1671
  }
1572
1672
  case PM_REQUIRED_KEYWORD_PARAMETER_NODE: {
1573
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1673
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1574
1674
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_required_keyword_parameter_node_t *)node)->name));
1575
1675
  pm_serialize_location(parser, &((pm_required_keyword_parameter_node_t *)node)->name_loc, buffer);
1576
1676
  break;
1577
1677
  }
1578
1678
  case PM_REQUIRED_PARAMETER_NODE: {
1579
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1679
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1580
1680
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_required_parameter_node_t *)node)->name));
1581
1681
  break;
1582
1682
  }
1583
1683
  case PM_RESCUE_MODIFIER_NODE: {
1684
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1584
1685
  pm_serialize_node(parser, (pm_node_t *)((pm_rescue_modifier_node_t *)node)->expression, buffer);
1585
1686
  pm_serialize_location(parser, &((pm_rescue_modifier_node_t *)node)->keyword_loc, buffer);
1586
1687
  pm_serialize_node(parser, (pm_node_t *)((pm_rescue_modifier_node_t *)node)->rescue_expression, buffer);
1587
1688
  break;
1588
1689
  }
1589
1690
  case PM_RESCUE_NODE: {
1691
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1590
1692
  pm_serialize_location(parser, &((pm_rescue_node_t *)node)->keyword_loc, buffer);
1591
1693
  uint32_t exceptions_size = pm_sizet_to_u32(((pm_rescue_node_t *)node)->exceptions.size);
1592
1694
  pm_buffer_append_varuint(buffer, exceptions_size);
@@ -1609,15 +1711,15 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1609
1711
  } else {
1610
1712
  pm_serialize_node(parser, (pm_node_t *)((pm_rescue_node_t *)node)->statements, buffer);
1611
1713
  }
1612
- if (((pm_rescue_node_t *)node)->consequent == NULL) {
1714
+ if (((pm_rescue_node_t *)node)->subsequent == NULL) {
1613
1715
  pm_buffer_append_byte(buffer, 0);
1614
1716
  } else {
1615
- pm_serialize_node(parser, (pm_node_t *)((pm_rescue_node_t *)node)->consequent, buffer);
1717
+ pm_serialize_node(parser, (pm_node_t *)((pm_rescue_node_t *)node)->subsequent, buffer);
1616
1718
  }
1617
1719
  break;
1618
1720
  }
1619
1721
  case PM_REST_PARAMETER_NODE: {
1620
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1722
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1621
1723
  pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_rest_parameter_node_t *)node)->name));
1622
1724
  if (((pm_rest_parameter_node_t *)node)->name_loc.start == NULL) {
1623
1725
  pm_buffer_append_byte(buffer, 0);
@@ -1629,10 +1731,11 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1629
1731
  break;
1630
1732
  }
1631
1733
  case PM_RETRY_NODE: {
1734
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1632
1735
  break;
1633
1736
  }
1634
1737
  case PM_RETURN_NODE: {
1635
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1738
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1636
1739
  pm_serialize_location(parser, &((pm_return_node_t *)node)->keyword_loc, buffer);
1637
1740
  if (((pm_return_node_t *)node)->arguments == NULL) {
1638
1741
  pm_buffer_append_byte(buffer, 0);
@@ -1642,14 +1745,16 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1642
1745
  break;
1643
1746
  }
1644
1747
  case PM_SELF_NODE: {
1748
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1645
1749
  break;
1646
1750
  }
1647
1751
  case PM_SHAREABLE_CONSTANT_NODE: {
1648
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1752
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1649
1753
  pm_serialize_node(parser, (pm_node_t *)((pm_shareable_constant_node_t *)node)->write, buffer);
1650
1754
  break;
1651
1755
  }
1652
1756
  case PM_SINGLETON_CLASS_NODE: {
1757
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1653
1758
  uint32_t locals_size = pm_sizet_to_u32(((pm_singleton_class_node_t *)node)->locals.size);
1654
1759
  pm_buffer_append_varuint(buffer, locals_size);
1655
1760
  for (uint32_t index = 0; index < locals_size; index++) {
@@ -1667,17 +1772,20 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1667
1772
  break;
1668
1773
  }
1669
1774
  case PM_SOURCE_ENCODING_NODE: {
1775
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1670
1776
  break;
1671
1777
  }
1672
1778
  case PM_SOURCE_FILE_NODE: {
1673
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1779
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1674
1780
  pm_serialize_string(parser, &((pm_source_file_node_t *)node)->filepath, buffer);
1675
1781
  break;
1676
1782
  }
1677
1783
  case PM_SOURCE_LINE_NODE: {
1784
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1678
1785
  break;
1679
1786
  }
1680
1787
  case PM_SPLAT_NODE: {
1788
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1681
1789
  pm_serialize_location(parser, &((pm_splat_node_t *)node)->operator_loc, buffer);
1682
1790
  if (((pm_splat_node_t *)node)->expression == NULL) {
1683
1791
  pm_buffer_append_byte(buffer, 0);
@@ -1687,6 +1795,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1687
1795
  break;
1688
1796
  }
1689
1797
  case PM_STATEMENTS_NODE: {
1798
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1690
1799
  uint32_t body_size = pm_sizet_to_u32(((pm_statements_node_t *)node)->body.size);
1691
1800
  pm_buffer_append_varuint(buffer, body_size);
1692
1801
  for (uint32_t index = 0; index < body_size; index++) {
@@ -1695,7 +1804,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1695
1804
  break;
1696
1805
  }
1697
1806
  case PM_STRING_NODE: {
1698
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1807
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1699
1808
  if (((pm_string_node_t *)node)->opening_loc.start == NULL) {
1700
1809
  pm_buffer_append_byte(buffer, 0);
1701
1810
  } else {
@@ -1713,6 +1822,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1713
1822
  break;
1714
1823
  }
1715
1824
  case PM_SUPER_NODE: {
1825
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1716
1826
  pm_serialize_location(parser, &((pm_super_node_t *)node)->keyword_loc, buffer);
1717
1827
  if (((pm_super_node_t *)node)->lparen_loc.start == NULL) {
1718
1828
  pm_buffer_append_byte(buffer, 0);
@@ -1739,7 +1849,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1739
1849
  break;
1740
1850
  }
1741
1851
  case PM_SYMBOL_NODE: {
1742
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1852
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1743
1853
  if (((pm_symbol_node_t *)node)->opening_loc.start == NULL) {
1744
1854
  pm_buffer_append_byte(buffer, 0);
1745
1855
  } else {
@@ -1762,9 +1872,11 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1762
1872
  break;
1763
1873
  }
1764
1874
  case PM_TRUE_NODE: {
1875
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1765
1876
  break;
1766
1877
  }
1767
1878
  case PM_UNDEF_NODE: {
1879
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1768
1880
  uint32_t names_size = pm_sizet_to_u32(((pm_undef_node_t *)node)->names.size);
1769
1881
  pm_buffer_append_varuint(buffer, names_size);
1770
1882
  for (uint32_t index = 0; index < names_size; index++) {
@@ -1774,6 +1886,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1774
1886
  break;
1775
1887
  }
1776
1888
  case PM_UNLESS_NODE: {
1889
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1777
1890
  pm_serialize_location(parser, &((pm_unless_node_t *)node)->keyword_loc, buffer);
1778
1891
  pm_serialize_node(parser, (pm_node_t *)((pm_unless_node_t *)node)->predicate, buffer);
1779
1892
  if (((pm_unless_node_t *)node)->then_keyword_loc.start == NULL) {
@@ -1787,10 +1900,10 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1787
1900
  } else {
1788
1901
  pm_serialize_node(parser, (pm_node_t *)((pm_unless_node_t *)node)->statements, buffer);
1789
1902
  }
1790
- if (((pm_unless_node_t *)node)->consequent == NULL) {
1903
+ if (((pm_unless_node_t *)node)->else_clause == NULL) {
1791
1904
  pm_buffer_append_byte(buffer, 0);
1792
1905
  } else {
1793
- pm_serialize_node(parser, (pm_node_t *)((pm_unless_node_t *)node)->consequent, buffer);
1906
+ pm_serialize_node(parser, (pm_node_t *)((pm_unless_node_t *)node)->else_clause, buffer);
1794
1907
  }
1795
1908
  if (((pm_unless_node_t *)node)->end_keyword_loc.start == NULL) {
1796
1909
  pm_buffer_append_byte(buffer, 0);
@@ -1801,7 +1914,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1801
1914
  break;
1802
1915
  }
1803
1916
  case PM_UNTIL_NODE: {
1804
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1917
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1805
1918
  pm_serialize_location(parser, &((pm_until_node_t *)node)->keyword_loc, buffer);
1806
1919
  if (((pm_until_node_t *)node)->closing_loc.start == NULL) {
1807
1920
  pm_buffer_append_byte(buffer, 0);
@@ -1818,6 +1931,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1818
1931
  break;
1819
1932
  }
1820
1933
  case PM_WHEN_NODE: {
1934
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1821
1935
  pm_serialize_location(parser, &((pm_when_node_t *)node)->keyword_loc, buffer);
1822
1936
  uint32_t conditions_size = pm_sizet_to_u32(((pm_when_node_t *)node)->conditions.size);
1823
1937
  pm_buffer_append_varuint(buffer, conditions_size);
@@ -1838,7 +1952,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1838
1952
  break;
1839
1953
  }
1840
1954
  case PM_WHILE_NODE: {
1841
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1955
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1842
1956
  pm_serialize_location(parser, &((pm_while_node_t *)node)->keyword_loc, buffer);
1843
1957
  if (((pm_while_node_t *)node)->closing_loc.start == NULL) {
1844
1958
  pm_buffer_append_byte(buffer, 0);
@@ -1855,7 +1969,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1855
1969
  break;
1856
1970
  }
1857
1971
  case PM_X_STRING_NODE: {
1858
- pm_buffer_append_varuint(buffer, (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1972
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1859
1973
  pm_serialize_location(parser, &((pm_x_string_node_t *)node)->opening_loc, buffer);
1860
1974
  pm_serialize_location(parser, &((pm_x_string_node_t *)node)->content_loc, buffer);
1861
1975
  pm_serialize_location(parser, &((pm_x_string_node_t *)node)->closing_loc, buffer);
@@ -1863,6 +1977,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
1863
1977
  break;
1864
1978
  }
1865
1979
  case PM_YIELD_NODE: {
1980
+ pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
1866
1981
  pm_serialize_location(parser, &((pm_yield_node_t *)node)->keyword_loc, buffer);
1867
1982
  if (((pm_yield_node_t *)node)->lparen_loc.start == NULL) {
1868
1983
  pm_buffer_append_byte(buffer, 0);
@@ -1998,7 +2113,7 @@ pm_serialize_metadata(pm_parser_t *parser, pm_buffer_t *buffer) {
1998
2113
  pm_serialize_diagnostic_list(parser, &parser->warning_list, buffer);
1999
2114
  }
2000
2115
 
2001
- #line 271 "serialize.c.erb"
2116
+ #line 275 "prism/templates/src/serialize.c.erb"
2002
2117
  /**
2003
2118
  * Serialize the metadata, nodes, and constant pool.
2004
2119
  */