yarp 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -2
- data/Makefile +2 -0
- data/README.md +5 -2
- data/config.yml +54 -267
- data/ext/yarp/api_node.c +135 -579
- data/ext/yarp/extension.c +2 -2
- data/ext/yarp/extension.h +1 -1
- data/include/yarp/ast.h +142 -285
- data/include/yarp/defines.h +5 -0
- data/include/yarp/unescape.h +1 -1
- data/include/yarp/util/yp_buffer.h +9 -1
- data/include/yarp/util/yp_constant_pool.h +3 -0
- data/include/yarp/util/yp_list.h +7 -7
- data/include/yarp/util/yp_newline_list.h +4 -0
- data/include/yarp/util/yp_state_stack.h +1 -1
- data/include/yarp/version.h +2 -2
- data/lib/yarp/ffi.rb +62 -47
- data/lib/yarp/node.rb +504 -1399
- data/lib/yarp/serialize.rb +111 -141
- data/lib/yarp.rb +6 -6
- data/src/node.c +70 -250
- data/src/prettyprint.c +41 -185
- data/src/serialize.c +35 -133
- data/src/unescape.c +29 -35
- data/src/util/yp_buffer.c +18 -0
- data/src/util/yp_list.c +7 -16
- data/src/util/yp_state_stack.c +0 -6
- data/src/yarp.c +265 -670
- data/yarp.gemspec +1 -1
- metadata +2 -2
data/ext/yarp/api_node.c
CHANGED
@@ -17,6 +17,7 @@ extern VALUE rb_cYARPLocation;
|
|
17
17
|
static VALUE rb_cYARPAliasNode;
|
18
18
|
static VALUE rb_cYARPAlternationPatternNode;
|
19
19
|
static VALUE rb_cYARPAndNode;
|
20
|
+
static VALUE rb_cYARPAndWriteNode;
|
20
21
|
static VALUE rb_cYARPArgumentsNode;
|
21
22
|
static VALUE rb_cYARPArrayNode;
|
22
23
|
static VALUE rb_cYARPArrayPatternNode;
|
@@ -36,18 +37,9 @@ static VALUE rb_cYARPCallOperatorWriteNode;
|
|
36
37
|
static VALUE rb_cYARPCapturePatternNode;
|
37
38
|
static VALUE rb_cYARPCaseNode;
|
38
39
|
static VALUE rb_cYARPClassNode;
|
39
|
-
static VALUE rb_cYARPClassVariableOperatorAndWriteNode;
|
40
|
-
static VALUE rb_cYARPClassVariableOperatorOrWriteNode;
|
41
|
-
static VALUE rb_cYARPClassVariableOperatorWriteNode;
|
42
40
|
static VALUE rb_cYARPClassVariableReadNode;
|
43
41
|
static VALUE rb_cYARPClassVariableWriteNode;
|
44
|
-
static VALUE rb_cYARPConstantOperatorAndWriteNode;
|
45
|
-
static VALUE rb_cYARPConstantOperatorOrWriteNode;
|
46
|
-
static VALUE rb_cYARPConstantOperatorWriteNode;
|
47
42
|
static VALUE rb_cYARPConstantPathNode;
|
48
|
-
static VALUE rb_cYARPConstantPathOperatorAndWriteNode;
|
49
|
-
static VALUE rb_cYARPConstantPathOperatorOrWriteNode;
|
50
|
-
static VALUE rb_cYARPConstantPathOperatorWriteNode;
|
51
43
|
static VALUE rb_cYARPConstantPathWriteNode;
|
52
44
|
static VALUE rb_cYARPConstantReadNode;
|
53
45
|
static VALUE rb_cYARPConstantWriteNode;
|
@@ -65,9 +57,6 @@ static VALUE rb_cYARPForNode;
|
|
65
57
|
static VALUE rb_cYARPForwardingArgumentsNode;
|
66
58
|
static VALUE rb_cYARPForwardingParameterNode;
|
67
59
|
static VALUE rb_cYARPForwardingSuperNode;
|
68
|
-
static VALUE rb_cYARPGlobalVariableOperatorAndWriteNode;
|
69
|
-
static VALUE rb_cYARPGlobalVariableOperatorOrWriteNode;
|
70
|
-
static VALUE rb_cYARPGlobalVariableOperatorWriteNode;
|
71
60
|
static VALUE rb_cYARPGlobalVariableReadNode;
|
72
61
|
static VALUE rb_cYARPGlobalVariableWriteNode;
|
73
62
|
static VALUE rb_cYARPHashNode;
|
@@ -75,9 +64,6 @@ static VALUE rb_cYARPHashPatternNode;
|
|
75
64
|
static VALUE rb_cYARPIfNode;
|
76
65
|
static VALUE rb_cYARPImaginaryNode;
|
77
66
|
static VALUE rb_cYARPInNode;
|
78
|
-
static VALUE rb_cYARPInstanceVariableOperatorAndWriteNode;
|
79
|
-
static VALUE rb_cYARPInstanceVariableOperatorOrWriteNode;
|
80
|
-
static VALUE rb_cYARPInstanceVariableOperatorWriteNode;
|
81
67
|
static VALUE rb_cYARPInstanceVariableReadNode;
|
82
68
|
static VALUE rb_cYARPInstanceVariableWriteNode;
|
83
69
|
static VALUE rb_cYARPIntegerNode;
|
@@ -89,9 +75,6 @@ static VALUE rb_cYARPKeywordHashNode;
|
|
89
75
|
static VALUE rb_cYARPKeywordParameterNode;
|
90
76
|
static VALUE rb_cYARPKeywordRestParameterNode;
|
91
77
|
static VALUE rb_cYARPLambdaNode;
|
92
|
-
static VALUE rb_cYARPLocalVariableOperatorAndWriteNode;
|
93
|
-
static VALUE rb_cYARPLocalVariableOperatorOrWriteNode;
|
94
|
-
static VALUE rb_cYARPLocalVariableOperatorWriteNode;
|
95
78
|
static VALUE rb_cYARPLocalVariableReadNode;
|
96
79
|
static VALUE rb_cYARPLocalVariableWriteNode;
|
97
80
|
static VALUE rb_cYARPMatchPredicateNode;
|
@@ -103,8 +86,10 @@ static VALUE rb_cYARPNextNode;
|
|
103
86
|
static VALUE rb_cYARPNilNode;
|
104
87
|
static VALUE rb_cYARPNoKeywordsParameterNode;
|
105
88
|
static VALUE rb_cYARPNumberedReferenceReadNode;
|
89
|
+
static VALUE rb_cYARPOperatorWriteNode;
|
106
90
|
static VALUE rb_cYARPOptionalParameterNode;
|
107
91
|
static VALUE rb_cYARPOrNode;
|
92
|
+
static VALUE rb_cYARPOrWriteNode;
|
108
93
|
static VALUE rb_cYARPParametersNode;
|
109
94
|
static VALUE rb_cYARPParenthesesNode;
|
110
95
|
static VALUE rb_cYARPPinnedExpressionNode;
|
@@ -258,6 +243,13 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
258
243
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->right);
|
259
244
|
break;
|
260
245
|
}
|
246
|
+
#line 111 "api_node.c.erb"
|
247
|
+
case YP_NODE_AND_WRITE_NODE: {
|
248
|
+
yp_and_write_node_t *cast = (yp_and_write_node_t *) node;
|
249
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
|
250
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
251
|
+
break;
|
252
|
+
}
|
261
253
|
#line 111 "api_node.c.erb"
|
262
254
|
case YP_NODE_ARGUMENTS_NODE: {
|
263
255
|
yp_arguments_node_t *cast = (yp_arguments_node_t *) node;
|
@@ -319,7 +311,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
319
311
|
case YP_NODE_BLOCK_NODE: {
|
320
312
|
yp_block_node_t *cast = (yp_block_node_t *) node;
|
321
313
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->parameters);
|
322
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->
|
314
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->body);
|
323
315
|
break;
|
324
316
|
}
|
325
317
|
#line 111 "api_node.c.erb"
|
@@ -385,25 +377,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
385
377
|
yp_class_node_t *cast = (yp_class_node_t *) node;
|
386
378
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->constant_path);
|
387
379
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->superclass);
|
388
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->
|
389
|
-
break;
|
390
|
-
}
|
391
|
-
#line 111 "api_node.c.erb"
|
392
|
-
case YP_NODE_CLASS_VARIABLE_OPERATOR_AND_WRITE_NODE: {
|
393
|
-
yp_class_variable_operator_and_write_node_t *cast = (yp_class_variable_operator_and_write_node_t *) node;
|
394
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
395
|
-
break;
|
396
|
-
}
|
397
|
-
#line 111 "api_node.c.erb"
|
398
|
-
case YP_NODE_CLASS_VARIABLE_OPERATOR_OR_WRITE_NODE: {
|
399
|
-
yp_class_variable_operator_or_write_node_t *cast = (yp_class_variable_operator_or_write_node_t *) node;
|
400
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
401
|
-
break;
|
402
|
-
}
|
403
|
-
#line 111 "api_node.c.erb"
|
404
|
-
case YP_NODE_CLASS_VARIABLE_OPERATOR_WRITE_NODE: {
|
405
|
-
yp_class_variable_operator_write_node_t *cast = (yp_class_variable_operator_write_node_t *) node;
|
406
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
380
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->body);
|
407
381
|
break;
|
408
382
|
}
|
409
383
|
#line 111 "api_node.c.erb"
|
@@ -412,24 +386,6 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
412
386
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
413
387
|
break;
|
414
388
|
}
|
415
|
-
#line 111 "api_node.c.erb"
|
416
|
-
case YP_NODE_CONSTANT_OPERATOR_AND_WRITE_NODE: {
|
417
|
-
yp_constant_operator_and_write_node_t *cast = (yp_constant_operator_and_write_node_t *) node;
|
418
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
419
|
-
break;
|
420
|
-
}
|
421
|
-
#line 111 "api_node.c.erb"
|
422
|
-
case YP_NODE_CONSTANT_OPERATOR_OR_WRITE_NODE: {
|
423
|
-
yp_constant_operator_or_write_node_t *cast = (yp_constant_operator_or_write_node_t *) node;
|
424
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
425
|
-
break;
|
426
|
-
}
|
427
|
-
#line 111 "api_node.c.erb"
|
428
|
-
case YP_NODE_CONSTANT_OPERATOR_WRITE_NODE: {
|
429
|
-
yp_constant_operator_write_node_t *cast = (yp_constant_operator_write_node_t *) node;
|
430
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
431
|
-
break;
|
432
|
-
}
|
433
389
|
#line 111 "api_node.c.erb"
|
434
390
|
case YP_NODE_CONSTANT_PATH_NODE: {
|
435
391
|
yp_constant_path_node_t *cast = (yp_constant_path_node_t *) node;
|
@@ -437,27 +393,6 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
437
393
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->child);
|
438
394
|
break;
|
439
395
|
}
|
440
|
-
#line 111 "api_node.c.erb"
|
441
|
-
case YP_NODE_CONSTANT_PATH_OPERATOR_AND_WRITE_NODE: {
|
442
|
-
yp_constant_path_operator_and_write_node_t *cast = (yp_constant_path_operator_and_write_node_t *) node;
|
443
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
|
444
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
445
|
-
break;
|
446
|
-
}
|
447
|
-
#line 111 "api_node.c.erb"
|
448
|
-
case YP_NODE_CONSTANT_PATH_OPERATOR_OR_WRITE_NODE: {
|
449
|
-
yp_constant_path_operator_or_write_node_t *cast = (yp_constant_path_operator_or_write_node_t *) node;
|
450
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
|
451
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
452
|
-
break;
|
453
|
-
}
|
454
|
-
#line 111 "api_node.c.erb"
|
455
|
-
case YP_NODE_CONSTANT_PATH_OPERATOR_WRITE_NODE: {
|
456
|
-
yp_constant_path_operator_write_node_t *cast = (yp_constant_path_operator_write_node_t *) node;
|
457
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
|
458
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
459
|
-
break;
|
460
|
-
}
|
461
396
|
#line 111 "api_node.c.erb"
|
462
397
|
case YP_NODE_CONSTANT_PATH_WRITE_NODE: {
|
463
398
|
yp_constant_path_write_node_t *cast = (yp_constant_path_write_node_t *) node;
|
@@ -476,7 +411,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
476
411
|
yp_def_node_t *cast = (yp_def_node_t *) node;
|
477
412
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->receiver);
|
478
413
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->parameters);
|
479
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->
|
414
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->body);
|
480
415
|
break;
|
481
416
|
}
|
482
417
|
#line 111 "api_node.c.erb"
|
@@ -541,24 +476,6 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
541
476
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->block);
|
542
477
|
break;
|
543
478
|
}
|
544
|
-
#line 111 "api_node.c.erb"
|
545
|
-
case YP_NODE_GLOBAL_VARIABLE_OPERATOR_AND_WRITE_NODE: {
|
546
|
-
yp_global_variable_operator_and_write_node_t *cast = (yp_global_variable_operator_and_write_node_t *) node;
|
547
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
548
|
-
break;
|
549
|
-
}
|
550
|
-
#line 111 "api_node.c.erb"
|
551
|
-
case YP_NODE_GLOBAL_VARIABLE_OPERATOR_OR_WRITE_NODE: {
|
552
|
-
yp_global_variable_operator_or_write_node_t *cast = (yp_global_variable_operator_or_write_node_t *) node;
|
553
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
554
|
-
break;
|
555
|
-
}
|
556
|
-
#line 111 "api_node.c.erb"
|
557
|
-
case YP_NODE_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: {
|
558
|
-
yp_global_variable_operator_write_node_t *cast = (yp_global_variable_operator_write_node_t *) node;
|
559
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
560
|
-
break;
|
561
|
-
}
|
562
479
|
#line 111 "api_node.c.erb"
|
563
480
|
case YP_NODE_GLOBAL_VARIABLE_WRITE_NODE: {
|
564
481
|
yp_global_variable_write_node_t *cast = (yp_global_variable_write_node_t *) node;
|
@@ -604,24 +521,6 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
604
521
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->statements);
|
605
522
|
break;
|
606
523
|
}
|
607
|
-
#line 111 "api_node.c.erb"
|
608
|
-
case YP_NODE_INSTANCE_VARIABLE_OPERATOR_AND_WRITE_NODE: {
|
609
|
-
yp_instance_variable_operator_and_write_node_t *cast = (yp_instance_variable_operator_and_write_node_t *) node;
|
610
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
611
|
-
break;
|
612
|
-
}
|
613
|
-
#line 111 "api_node.c.erb"
|
614
|
-
case YP_NODE_INSTANCE_VARIABLE_OPERATOR_OR_WRITE_NODE: {
|
615
|
-
yp_instance_variable_operator_or_write_node_t *cast = (yp_instance_variable_operator_or_write_node_t *) node;
|
616
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
617
|
-
break;
|
618
|
-
}
|
619
|
-
#line 111 "api_node.c.erb"
|
620
|
-
case YP_NODE_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: {
|
621
|
-
yp_instance_variable_operator_write_node_t *cast = (yp_instance_variable_operator_write_node_t *) node;
|
622
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
623
|
-
break;
|
624
|
-
}
|
625
524
|
#line 111 "api_node.c.erb"
|
626
525
|
case YP_NODE_INSTANCE_VARIABLE_WRITE_NODE: {
|
627
526
|
yp_instance_variable_write_node_t *cast = (yp_instance_variable_write_node_t *) node;
|
@@ -678,25 +577,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
678
577
|
case YP_NODE_LAMBDA_NODE: {
|
679
578
|
yp_lambda_node_t *cast = (yp_lambda_node_t *) node;
|
680
579
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->parameters);
|
681
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->
|
682
|
-
break;
|
683
|
-
}
|
684
|
-
#line 111 "api_node.c.erb"
|
685
|
-
case YP_NODE_LOCAL_VARIABLE_OPERATOR_AND_WRITE_NODE: {
|
686
|
-
yp_local_variable_operator_and_write_node_t *cast = (yp_local_variable_operator_and_write_node_t *) node;
|
687
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
688
|
-
break;
|
689
|
-
}
|
690
|
-
#line 111 "api_node.c.erb"
|
691
|
-
case YP_NODE_LOCAL_VARIABLE_OPERATOR_OR_WRITE_NODE: {
|
692
|
-
yp_local_variable_operator_or_write_node_t *cast = (yp_local_variable_operator_or_write_node_t *) node;
|
693
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
694
|
-
break;
|
695
|
-
}
|
696
|
-
#line 111 "api_node.c.erb"
|
697
|
-
case YP_NODE_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: {
|
698
|
-
yp_local_variable_operator_write_node_t *cast = (yp_local_variable_operator_write_node_t *) node;
|
699
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
580
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->body);
|
700
581
|
break;
|
701
582
|
}
|
702
583
|
#line 111 "api_node.c.erb"
|
@@ -723,7 +604,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
723
604
|
case YP_NODE_MODULE_NODE: {
|
724
605
|
yp_module_node_t *cast = (yp_module_node_t *) node;
|
725
606
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->constant_path);
|
726
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->
|
607
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->body);
|
727
608
|
break;
|
728
609
|
}
|
729
610
|
#line 111 "api_node.c.erb"
|
@@ -741,6 +622,13 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
741
622
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->arguments);
|
742
623
|
break;
|
743
624
|
}
|
625
|
+
#line 111 "api_node.c.erb"
|
626
|
+
case YP_NODE_OPERATOR_WRITE_NODE: {
|
627
|
+
yp_operator_write_node_t *cast = (yp_operator_write_node_t *) node;
|
628
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
|
629
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
630
|
+
break;
|
631
|
+
}
|
744
632
|
#line 111 "api_node.c.erb"
|
745
633
|
case YP_NODE_OPTIONAL_PARAMETER_NODE: {
|
746
634
|
yp_optional_parameter_node_t *cast = (yp_optional_parameter_node_t *) node;
|
@@ -754,6 +642,13 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
754
642
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->right);
|
755
643
|
break;
|
756
644
|
}
|
645
|
+
#line 111 "api_node.c.erb"
|
646
|
+
case YP_NODE_OR_WRITE_NODE: {
|
647
|
+
yp_or_write_node_t *cast = (yp_or_write_node_t *) node;
|
648
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
|
649
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
650
|
+
break;
|
651
|
+
}
|
757
652
|
#line 111 "api_node.c.erb"
|
758
653
|
case YP_NODE_PARAMETERS_NODE: {
|
759
654
|
yp_parameters_node_t *cast = (yp_parameters_node_t *) node;
|
@@ -777,7 +672,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
777
672
|
#line 111 "api_node.c.erb"
|
778
673
|
case YP_NODE_PARENTHESES_NODE: {
|
779
674
|
yp_parentheses_node_t *cast = (yp_parentheses_node_t *) node;
|
780
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->
|
675
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->body);
|
781
676
|
break;
|
782
677
|
}
|
783
678
|
#line 111 "api_node.c.erb"
|
@@ -859,7 +754,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
859
754
|
case YP_NODE_SINGLETON_CLASS_NODE: {
|
860
755
|
yp_singleton_class_node_t *cast = (yp_singleton_class_node_t *) node;
|
861
756
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->expression);
|
862
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->
|
757
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->body);
|
863
758
|
break;
|
864
759
|
}
|
865
760
|
#line 111 "api_node.c.erb"
|
@@ -1003,13 +898,33 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1003
898
|
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPAndNode));
|
1004
899
|
break;
|
1005
900
|
}
|
901
|
+
#line 137 "api_node.c.erb"
|
902
|
+
case YP_NODE_AND_WRITE_NODE: {
|
903
|
+
yp_and_write_node_t *cast = (yp_and_write_node_t *) node;
|
904
|
+
VALUE argv[4];
|
905
|
+
|
906
|
+
// target
|
907
|
+
argv[0] = rb_ary_pop(value_stack);
|
908
|
+
|
909
|
+
// value
|
910
|
+
argv[1] = rb_ary_pop(value_stack);
|
911
|
+
|
912
|
+
// operator_loc
|
913
|
+
argv[2] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
914
|
+
|
915
|
+
// location
|
916
|
+
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
917
|
+
|
918
|
+
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPAndWriteNode));
|
919
|
+
break;
|
920
|
+
}
|
1006
921
|
#line 137 "api_node.c.erb"
|
1007
922
|
case YP_NODE_ARGUMENTS_NODE: {
|
1008
923
|
yp_arguments_node_t *cast = (yp_arguments_node_t *) node;
|
1009
924
|
VALUE argv[2];
|
1010
925
|
|
1011
926
|
// arguments
|
1012
|
-
argv[0] =
|
927
|
+
argv[0] = rb_ary_new_capa(cast->arguments.size);
|
1013
928
|
for (size_t index = 0; index < cast->arguments.size; index++) {
|
1014
929
|
rb_ary_push(argv[0], rb_ary_pop(value_stack));
|
1015
930
|
}
|
@@ -1026,7 +941,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1026
941
|
VALUE argv[4];
|
1027
942
|
|
1028
943
|
// elements
|
1029
|
-
argv[0] =
|
944
|
+
argv[0] = rb_ary_new_capa(cast->elements.size);
|
1030
945
|
for (size_t index = 0; index < cast->elements.size; index++) {
|
1031
946
|
rb_ary_push(argv[0], rb_ary_pop(value_stack));
|
1032
947
|
}
|
@@ -1052,7 +967,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1052
967
|
argv[0] = rb_ary_pop(value_stack);
|
1053
968
|
|
1054
969
|
// requireds
|
1055
|
-
argv[1] =
|
970
|
+
argv[1] = rb_ary_new_capa(cast->requireds.size);
|
1056
971
|
for (size_t index = 0; index < cast->requireds.size; index++) {
|
1057
972
|
rb_ary_push(argv[1], rb_ary_pop(value_stack));
|
1058
973
|
}
|
@@ -1061,7 +976,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1061
976
|
argv[2] = rb_ary_pop(value_stack);
|
1062
977
|
|
1063
978
|
// posts
|
1064
|
-
argv[3] =
|
979
|
+
argv[3] = rb_ary_new_capa(cast->posts.size);
|
1065
980
|
for (size_t index = 0; index < cast->posts.size; index++) {
|
1066
981
|
rb_ary_push(argv[3], rb_ary_pop(value_stack));
|
1067
982
|
}
|
@@ -1177,7 +1092,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1177
1092
|
VALUE argv[6];
|
1178
1093
|
|
1179
1094
|
// locals
|
1180
|
-
argv[0] =
|
1095
|
+
argv[0] = rb_ary_new_capa(cast->locals.size);
|
1181
1096
|
for (size_t index = 0; index < cast->locals.size; index++) {
|
1182
1097
|
rb_ary_push(argv[0], rb_id2sym(constants[cast->locals.ids[index] - 1]));
|
1183
1098
|
}
|
@@ -1185,7 +1100,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1185
1100
|
// parameters
|
1186
1101
|
argv[1] = rb_ary_pop(value_stack);
|
1187
1102
|
|
1188
|
-
//
|
1103
|
+
// body
|
1189
1104
|
argv[2] = rb_ary_pop(value_stack);
|
1190
1105
|
|
1191
1106
|
// opening_loc
|
@@ -1226,7 +1141,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1226
1141
|
argv[0] = rb_ary_pop(value_stack);
|
1227
1142
|
|
1228
1143
|
// locals
|
1229
|
-
argv[1] =
|
1144
|
+
argv[1] = rb_ary_new_capa(cast->locals.size);
|
1230
1145
|
for (size_t index = 0; index < cast->locals.size; index++) {
|
1231
1146
|
yp_location_t location = cast->locals.locations[index];
|
1232
1147
|
rb_ary_push(argv[1], yp_location_new(parser, location.start, location.end, source));
|
@@ -1391,7 +1306,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1391
1306
|
argv[0] = rb_ary_pop(value_stack);
|
1392
1307
|
|
1393
1308
|
// conditions
|
1394
|
-
argv[1] =
|
1309
|
+
argv[1] = rb_ary_new_capa(cast->conditions.size);
|
1395
1310
|
for (size_t index = 0; index < cast->conditions.size; index++) {
|
1396
1311
|
rb_ary_push(argv[1], rb_ary_pop(value_stack));
|
1397
1312
|
}
|
@@ -1417,7 +1332,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1417
1332
|
VALUE argv[8];
|
1418
1333
|
|
1419
1334
|
// locals
|
1420
|
-
argv[0] =
|
1335
|
+
argv[0] = rb_ary_new_capa(cast->locals.size);
|
1421
1336
|
for (size_t index = 0; index < cast->locals.size; index++) {
|
1422
1337
|
rb_ary_push(argv[0], rb_id2sym(constants[cast->locals.ids[index] - 1]));
|
1423
1338
|
}
|
@@ -1434,7 +1349,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1434
1349
|
// superclass
|
1435
1350
|
argv[4] = rb_ary_pop(value_stack);
|
1436
1351
|
|
1437
|
-
//
|
1352
|
+
// body
|
1438
1353
|
argv[5] = rb_ary_pop(value_stack);
|
1439
1354
|
|
1440
1355
|
// end_keyword_loc
|
@@ -1446,69 +1361,6 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1446
1361
|
rb_ary_push(value_stack, rb_class_new_instance(8, argv, rb_cYARPClassNode));
|
1447
1362
|
break;
|
1448
1363
|
}
|
1449
|
-
#line 137 "api_node.c.erb"
|
1450
|
-
case YP_NODE_CLASS_VARIABLE_OPERATOR_AND_WRITE_NODE: {
|
1451
|
-
yp_class_variable_operator_and_write_node_t *cast = (yp_class_variable_operator_and_write_node_t *) node;
|
1452
|
-
VALUE argv[4];
|
1453
|
-
|
1454
|
-
// name_loc
|
1455
|
-
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
1456
|
-
|
1457
|
-
// operator_loc
|
1458
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1459
|
-
|
1460
|
-
// value
|
1461
|
-
argv[2] = rb_ary_pop(value_stack);
|
1462
|
-
|
1463
|
-
// location
|
1464
|
-
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1465
|
-
|
1466
|
-
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPClassVariableOperatorAndWriteNode));
|
1467
|
-
break;
|
1468
|
-
}
|
1469
|
-
#line 137 "api_node.c.erb"
|
1470
|
-
case YP_NODE_CLASS_VARIABLE_OPERATOR_OR_WRITE_NODE: {
|
1471
|
-
yp_class_variable_operator_or_write_node_t *cast = (yp_class_variable_operator_or_write_node_t *) node;
|
1472
|
-
VALUE argv[4];
|
1473
|
-
|
1474
|
-
// name_loc
|
1475
|
-
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
1476
|
-
|
1477
|
-
// operator_loc
|
1478
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1479
|
-
|
1480
|
-
// value
|
1481
|
-
argv[2] = rb_ary_pop(value_stack);
|
1482
|
-
|
1483
|
-
// location
|
1484
|
-
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1485
|
-
|
1486
|
-
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPClassVariableOperatorOrWriteNode));
|
1487
|
-
break;
|
1488
|
-
}
|
1489
|
-
#line 137 "api_node.c.erb"
|
1490
|
-
case YP_NODE_CLASS_VARIABLE_OPERATOR_WRITE_NODE: {
|
1491
|
-
yp_class_variable_operator_write_node_t *cast = (yp_class_variable_operator_write_node_t *) node;
|
1492
|
-
VALUE argv[5];
|
1493
|
-
|
1494
|
-
// name_loc
|
1495
|
-
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
1496
|
-
|
1497
|
-
// operator_loc
|
1498
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1499
|
-
|
1500
|
-
// value
|
1501
|
-
argv[2] = rb_ary_pop(value_stack);
|
1502
|
-
|
1503
|
-
// operator
|
1504
|
-
argv[3] = rb_id2sym(constants[cast->operator - 1]);
|
1505
|
-
|
1506
|
-
// location
|
1507
|
-
argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1508
|
-
|
1509
|
-
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPClassVariableOperatorWriteNode));
|
1510
|
-
break;
|
1511
|
-
}
|
1512
1364
|
#line 137 "api_node.c.erb"
|
1513
1365
|
case YP_NODE_CLASS_VARIABLE_READ_NODE: {
|
1514
1366
|
VALUE argv[1];
|
@@ -1539,69 +1391,6 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1539
1391
|
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPClassVariableWriteNode));
|
1540
1392
|
break;
|
1541
1393
|
}
|
1542
|
-
#line 137 "api_node.c.erb"
|
1543
|
-
case YP_NODE_CONSTANT_OPERATOR_AND_WRITE_NODE: {
|
1544
|
-
yp_constant_operator_and_write_node_t *cast = (yp_constant_operator_and_write_node_t *) node;
|
1545
|
-
VALUE argv[4];
|
1546
|
-
|
1547
|
-
// name_loc
|
1548
|
-
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
1549
|
-
|
1550
|
-
// operator_loc
|
1551
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1552
|
-
|
1553
|
-
// value
|
1554
|
-
argv[2] = rb_ary_pop(value_stack);
|
1555
|
-
|
1556
|
-
// location
|
1557
|
-
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1558
|
-
|
1559
|
-
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPConstantOperatorAndWriteNode));
|
1560
|
-
break;
|
1561
|
-
}
|
1562
|
-
#line 137 "api_node.c.erb"
|
1563
|
-
case YP_NODE_CONSTANT_OPERATOR_OR_WRITE_NODE: {
|
1564
|
-
yp_constant_operator_or_write_node_t *cast = (yp_constant_operator_or_write_node_t *) node;
|
1565
|
-
VALUE argv[4];
|
1566
|
-
|
1567
|
-
// name_loc
|
1568
|
-
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
1569
|
-
|
1570
|
-
// operator_loc
|
1571
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1572
|
-
|
1573
|
-
// value
|
1574
|
-
argv[2] = rb_ary_pop(value_stack);
|
1575
|
-
|
1576
|
-
// location
|
1577
|
-
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1578
|
-
|
1579
|
-
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPConstantOperatorOrWriteNode));
|
1580
|
-
break;
|
1581
|
-
}
|
1582
|
-
#line 137 "api_node.c.erb"
|
1583
|
-
case YP_NODE_CONSTANT_OPERATOR_WRITE_NODE: {
|
1584
|
-
yp_constant_operator_write_node_t *cast = (yp_constant_operator_write_node_t *) node;
|
1585
|
-
VALUE argv[5];
|
1586
|
-
|
1587
|
-
// name_loc
|
1588
|
-
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
1589
|
-
|
1590
|
-
// operator_loc
|
1591
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1592
|
-
|
1593
|
-
// value
|
1594
|
-
argv[2] = rb_ary_pop(value_stack);
|
1595
|
-
|
1596
|
-
// operator
|
1597
|
-
argv[3] = rb_id2sym(constants[cast->operator - 1]);
|
1598
|
-
|
1599
|
-
// location
|
1600
|
-
argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1601
|
-
|
1602
|
-
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPConstantOperatorWriteNode));
|
1603
|
-
break;
|
1604
|
-
}
|
1605
1394
|
#line 137 "api_node.c.erb"
|
1606
1395
|
case YP_NODE_CONSTANT_PATH_NODE: {
|
1607
1396
|
yp_constant_path_node_t *cast = (yp_constant_path_node_t *) node;
|
@@ -1622,69 +1411,6 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1622
1411
|
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPConstantPathNode));
|
1623
1412
|
break;
|
1624
1413
|
}
|
1625
|
-
#line 137 "api_node.c.erb"
|
1626
|
-
case YP_NODE_CONSTANT_PATH_OPERATOR_AND_WRITE_NODE: {
|
1627
|
-
yp_constant_path_operator_and_write_node_t *cast = (yp_constant_path_operator_and_write_node_t *) node;
|
1628
|
-
VALUE argv[4];
|
1629
|
-
|
1630
|
-
// target
|
1631
|
-
argv[0] = rb_ary_pop(value_stack);
|
1632
|
-
|
1633
|
-
// operator_loc
|
1634
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1635
|
-
|
1636
|
-
// value
|
1637
|
-
argv[2] = rb_ary_pop(value_stack);
|
1638
|
-
|
1639
|
-
// location
|
1640
|
-
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1641
|
-
|
1642
|
-
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPConstantPathOperatorAndWriteNode));
|
1643
|
-
break;
|
1644
|
-
}
|
1645
|
-
#line 137 "api_node.c.erb"
|
1646
|
-
case YP_NODE_CONSTANT_PATH_OPERATOR_OR_WRITE_NODE: {
|
1647
|
-
yp_constant_path_operator_or_write_node_t *cast = (yp_constant_path_operator_or_write_node_t *) node;
|
1648
|
-
VALUE argv[4];
|
1649
|
-
|
1650
|
-
// target
|
1651
|
-
argv[0] = rb_ary_pop(value_stack);
|
1652
|
-
|
1653
|
-
// operator_loc
|
1654
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1655
|
-
|
1656
|
-
// value
|
1657
|
-
argv[2] = rb_ary_pop(value_stack);
|
1658
|
-
|
1659
|
-
// location
|
1660
|
-
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1661
|
-
|
1662
|
-
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPConstantPathOperatorOrWriteNode));
|
1663
|
-
break;
|
1664
|
-
}
|
1665
|
-
#line 137 "api_node.c.erb"
|
1666
|
-
case YP_NODE_CONSTANT_PATH_OPERATOR_WRITE_NODE: {
|
1667
|
-
yp_constant_path_operator_write_node_t *cast = (yp_constant_path_operator_write_node_t *) node;
|
1668
|
-
VALUE argv[5];
|
1669
|
-
|
1670
|
-
// target
|
1671
|
-
argv[0] = rb_ary_pop(value_stack);
|
1672
|
-
|
1673
|
-
// operator_loc
|
1674
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1675
|
-
|
1676
|
-
// value
|
1677
|
-
argv[2] = rb_ary_pop(value_stack);
|
1678
|
-
|
1679
|
-
// operator
|
1680
|
-
argv[3] = rb_id2sym(constants[cast->operator - 1]);
|
1681
|
-
|
1682
|
-
// location
|
1683
|
-
argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1684
|
-
|
1685
|
-
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPConstantPathOperatorWriteNode));
|
1686
|
-
break;
|
1687
|
-
}
|
1688
1414
|
#line 137 "api_node.c.erb"
|
1689
1415
|
case YP_NODE_CONSTANT_PATH_WRITE_NODE: {
|
1690
1416
|
yp_constant_path_write_node_t *cast = (yp_constant_path_write_node_t *) node;
|
@@ -1749,11 +1475,11 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1749
1475
|
// parameters
|
1750
1476
|
argv[2] = rb_ary_pop(value_stack);
|
1751
1477
|
|
1752
|
-
//
|
1478
|
+
// body
|
1753
1479
|
argv[3] = rb_ary_pop(value_stack);
|
1754
1480
|
|
1755
1481
|
// locals
|
1756
|
-
argv[4] =
|
1482
|
+
argv[4] = rb_ary_new_capa(cast->locals.size);
|
1757
1483
|
for (size_t index = 0; index < cast->locals.size; index++) {
|
1758
1484
|
rb_ary_push(argv[4], rb_id2sym(constants[cast->locals.ids[index] - 1]));
|
1759
1485
|
}
|
@@ -1904,7 +1630,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1904
1630
|
argv[1] = rb_ary_pop(value_stack);
|
1905
1631
|
|
1906
1632
|
// requireds
|
1907
|
-
argv[2] =
|
1633
|
+
argv[2] = rb_ary_new_capa(cast->requireds.size);
|
1908
1634
|
for (size_t index = 0; index < cast->requireds.size; index++) {
|
1909
1635
|
rb_ary_push(argv[2], rb_ary_pop(value_stack));
|
1910
1636
|
}
|
@@ -2022,69 +1748,6 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2022
1748
|
rb_ary_push(value_stack, rb_class_new_instance(2, argv, rb_cYARPForwardingSuperNode));
|
2023
1749
|
break;
|
2024
1750
|
}
|
2025
|
-
#line 137 "api_node.c.erb"
|
2026
|
-
case YP_NODE_GLOBAL_VARIABLE_OPERATOR_AND_WRITE_NODE: {
|
2027
|
-
yp_global_variable_operator_and_write_node_t *cast = (yp_global_variable_operator_and_write_node_t *) node;
|
2028
|
-
VALUE argv[4];
|
2029
|
-
|
2030
|
-
// name_loc
|
2031
|
-
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2032
|
-
|
2033
|
-
// operator_loc
|
2034
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2035
|
-
|
2036
|
-
// value
|
2037
|
-
argv[2] = rb_ary_pop(value_stack);
|
2038
|
-
|
2039
|
-
// location
|
2040
|
-
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2041
|
-
|
2042
|
-
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPGlobalVariableOperatorAndWriteNode));
|
2043
|
-
break;
|
2044
|
-
}
|
2045
|
-
#line 137 "api_node.c.erb"
|
2046
|
-
case YP_NODE_GLOBAL_VARIABLE_OPERATOR_OR_WRITE_NODE: {
|
2047
|
-
yp_global_variable_operator_or_write_node_t *cast = (yp_global_variable_operator_or_write_node_t *) node;
|
2048
|
-
VALUE argv[4];
|
2049
|
-
|
2050
|
-
// name_loc
|
2051
|
-
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2052
|
-
|
2053
|
-
// operator_loc
|
2054
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2055
|
-
|
2056
|
-
// value
|
2057
|
-
argv[2] = rb_ary_pop(value_stack);
|
2058
|
-
|
2059
|
-
// location
|
2060
|
-
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2061
|
-
|
2062
|
-
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPGlobalVariableOperatorOrWriteNode));
|
2063
|
-
break;
|
2064
|
-
}
|
2065
|
-
#line 137 "api_node.c.erb"
|
2066
|
-
case YP_NODE_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: {
|
2067
|
-
yp_global_variable_operator_write_node_t *cast = (yp_global_variable_operator_write_node_t *) node;
|
2068
|
-
VALUE argv[5];
|
2069
|
-
|
2070
|
-
// name_loc
|
2071
|
-
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2072
|
-
|
2073
|
-
// operator_loc
|
2074
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2075
|
-
|
2076
|
-
// value
|
2077
|
-
argv[2] = rb_ary_pop(value_stack);
|
2078
|
-
|
2079
|
-
// operator
|
2080
|
-
argv[3] = rb_id2sym(constants[cast->operator - 1]);
|
2081
|
-
|
2082
|
-
// location
|
2083
|
-
argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2084
|
-
|
2085
|
-
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPGlobalVariableOperatorWriteNode));
|
2086
|
-
break;
|
2087
|
-
}
|
2088
1751
|
#line 137 "api_node.c.erb"
|
2089
1752
|
case YP_NODE_GLOBAL_VARIABLE_READ_NODE: {
|
2090
1753
|
VALUE argv[1];
|
@@ -2124,7 +1787,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2124
1787
|
argv[0] = yp_location_new(parser, cast->opening_loc.start, cast->opening_loc.end, source);
|
2125
1788
|
|
2126
1789
|
// elements
|
2127
|
-
argv[1] =
|
1790
|
+
argv[1] = rb_ary_new_capa(cast->elements.size);
|
2128
1791
|
for (size_t index = 0; index < cast->elements.size; index++) {
|
2129
1792
|
rb_ary_push(argv[1], rb_ary_pop(value_stack));
|
2130
1793
|
}
|
@@ -2147,7 +1810,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2147
1810
|
argv[0] = rb_ary_pop(value_stack);
|
2148
1811
|
|
2149
1812
|
// assocs
|
2150
|
-
argv[1] =
|
1813
|
+
argv[1] = rb_ary_new_capa(cast->assocs.size);
|
2151
1814
|
for (size_t index = 0; index < cast->assocs.size; index++) {
|
2152
1815
|
rb_ary_push(argv[1], rb_ary_pop(value_stack));
|
2153
1816
|
}
|
@@ -2229,69 +1892,6 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2229
1892
|
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPInNode));
|
2230
1893
|
break;
|
2231
1894
|
}
|
2232
|
-
#line 137 "api_node.c.erb"
|
2233
|
-
case YP_NODE_INSTANCE_VARIABLE_OPERATOR_AND_WRITE_NODE: {
|
2234
|
-
yp_instance_variable_operator_and_write_node_t *cast = (yp_instance_variable_operator_and_write_node_t *) node;
|
2235
|
-
VALUE argv[4];
|
2236
|
-
|
2237
|
-
// name_loc
|
2238
|
-
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2239
|
-
|
2240
|
-
// operator_loc
|
2241
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2242
|
-
|
2243
|
-
// value
|
2244
|
-
argv[2] = rb_ary_pop(value_stack);
|
2245
|
-
|
2246
|
-
// location
|
2247
|
-
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2248
|
-
|
2249
|
-
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPInstanceVariableOperatorAndWriteNode));
|
2250
|
-
break;
|
2251
|
-
}
|
2252
|
-
#line 137 "api_node.c.erb"
|
2253
|
-
case YP_NODE_INSTANCE_VARIABLE_OPERATOR_OR_WRITE_NODE: {
|
2254
|
-
yp_instance_variable_operator_or_write_node_t *cast = (yp_instance_variable_operator_or_write_node_t *) node;
|
2255
|
-
VALUE argv[4];
|
2256
|
-
|
2257
|
-
// name_loc
|
2258
|
-
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2259
|
-
|
2260
|
-
// operator_loc
|
2261
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2262
|
-
|
2263
|
-
// value
|
2264
|
-
argv[2] = rb_ary_pop(value_stack);
|
2265
|
-
|
2266
|
-
// location
|
2267
|
-
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2268
|
-
|
2269
|
-
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPInstanceVariableOperatorOrWriteNode));
|
2270
|
-
break;
|
2271
|
-
}
|
2272
|
-
#line 137 "api_node.c.erb"
|
2273
|
-
case YP_NODE_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: {
|
2274
|
-
yp_instance_variable_operator_write_node_t *cast = (yp_instance_variable_operator_write_node_t *) node;
|
2275
|
-
VALUE argv[5];
|
2276
|
-
|
2277
|
-
// name_loc
|
2278
|
-
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2279
|
-
|
2280
|
-
// operator_loc
|
2281
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2282
|
-
|
2283
|
-
// value
|
2284
|
-
argv[2] = rb_ary_pop(value_stack);
|
2285
|
-
|
2286
|
-
// operator
|
2287
|
-
argv[3] = rb_id2sym(constants[cast->operator - 1]);
|
2288
|
-
|
2289
|
-
// location
|
2290
|
-
argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2291
|
-
|
2292
|
-
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPInstanceVariableOperatorWriteNode));
|
2293
|
-
break;
|
2294
|
-
}
|
2295
1895
|
#line 137 "api_node.c.erb"
|
2296
1896
|
case YP_NODE_INSTANCE_VARIABLE_READ_NODE: {
|
2297
1897
|
VALUE argv[1];
|
@@ -2341,7 +1941,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2341
1941
|
argv[0] = yp_location_new(parser, cast->opening_loc.start, cast->opening_loc.end, source);
|
2342
1942
|
|
2343
1943
|
// parts
|
2344
|
-
argv[1] =
|
1944
|
+
argv[1] = rb_ary_new_capa(cast->parts.size);
|
2345
1945
|
for (size_t index = 0; index < cast->parts.size; index++) {
|
2346
1946
|
rb_ary_push(argv[1], rb_ary_pop(value_stack));
|
2347
1947
|
}
|
@@ -2367,7 +1967,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2367
1967
|
argv[0] = cast->opening_loc.start == NULL ? Qnil : yp_location_new(parser, cast->opening_loc.start, cast->opening_loc.end, source);
|
2368
1968
|
|
2369
1969
|
// parts
|
2370
|
-
argv[1] =
|
1970
|
+
argv[1] = rb_ary_new_capa(cast->parts.size);
|
2371
1971
|
for (size_t index = 0; index < cast->parts.size; index++) {
|
2372
1972
|
rb_ary_push(argv[1], rb_ary_pop(value_stack));
|
2373
1973
|
}
|
@@ -2390,7 +1990,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2390
1990
|
argv[0] = cast->opening_loc.start == NULL ? Qnil : yp_location_new(parser, cast->opening_loc.start, cast->opening_loc.end, source);
|
2391
1991
|
|
2392
1992
|
// parts
|
2393
|
-
argv[1] =
|
1993
|
+
argv[1] = rb_ary_new_capa(cast->parts.size);
|
2394
1994
|
for (size_t index = 0; index < cast->parts.size; index++) {
|
2395
1995
|
rb_ary_push(argv[1], rb_ary_pop(value_stack));
|
2396
1996
|
}
|
@@ -2413,7 +2013,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2413
2013
|
argv[0] = yp_location_new(parser, cast->opening_loc.start, cast->opening_loc.end, source);
|
2414
2014
|
|
2415
2015
|
// parts
|
2416
|
-
argv[1] =
|
2016
|
+
argv[1] = rb_ary_new_capa(cast->parts.size);
|
2417
2017
|
for (size_t index = 0; index < cast->parts.size; index++) {
|
2418
2018
|
rb_ary_push(argv[1], rb_ary_pop(value_stack));
|
2419
2019
|
}
|
@@ -2433,7 +2033,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2433
2033
|
VALUE argv[2];
|
2434
2034
|
|
2435
2035
|
// elements
|
2436
|
-
argv[0] =
|
2036
|
+
argv[0] = rb_ary_new_capa(cast->elements.size);
|
2437
2037
|
for (size_t index = 0; index < cast->elements.size; index++) {
|
2438
2038
|
rb_ary_push(argv[0], rb_ary_pop(value_stack));
|
2439
2039
|
}
|
@@ -2484,7 +2084,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2484
2084
|
VALUE argv[5];
|
2485
2085
|
|
2486
2086
|
// locals
|
2487
|
-
argv[0] =
|
2087
|
+
argv[0] = rb_ary_new_capa(cast->locals.size);
|
2488
2088
|
for (size_t index = 0; index < cast->locals.size; index++) {
|
2489
2089
|
rb_ary_push(argv[0], rb_id2sym(constants[cast->locals.ids[index] - 1]));
|
2490
2090
|
}
|
@@ -2495,7 +2095,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2495
2095
|
// parameters
|
2496
2096
|
argv[2] = rb_ary_pop(value_stack);
|
2497
2097
|
|
2498
|
-
//
|
2098
|
+
// body
|
2499
2099
|
argv[3] = rb_ary_pop(value_stack);
|
2500
2100
|
|
2501
2101
|
// location
|
@@ -2504,78 +2104,6 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2504
2104
|
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPLambdaNode));
|
2505
2105
|
break;
|
2506
2106
|
}
|
2507
|
-
#line 137 "api_node.c.erb"
|
2508
|
-
case YP_NODE_LOCAL_VARIABLE_OPERATOR_AND_WRITE_NODE: {
|
2509
|
-
yp_local_variable_operator_and_write_node_t *cast = (yp_local_variable_operator_and_write_node_t *) node;
|
2510
|
-
VALUE argv[5];
|
2511
|
-
|
2512
|
-
// name_loc
|
2513
|
-
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2514
|
-
|
2515
|
-
// operator_loc
|
2516
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2517
|
-
|
2518
|
-
// value
|
2519
|
-
argv[2] = rb_ary_pop(value_stack);
|
2520
|
-
|
2521
|
-
// constant_id
|
2522
|
-
argv[3] = rb_id2sym(constants[cast->constant_id - 1]);
|
2523
|
-
|
2524
|
-
// location
|
2525
|
-
argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2526
|
-
|
2527
|
-
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPLocalVariableOperatorAndWriteNode));
|
2528
|
-
break;
|
2529
|
-
}
|
2530
|
-
#line 137 "api_node.c.erb"
|
2531
|
-
case YP_NODE_LOCAL_VARIABLE_OPERATOR_OR_WRITE_NODE: {
|
2532
|
-
yp_local_variable_operator_or_write_node_t *cast = (yp_local_variable_operator_or_write_node_t *) node;
|
2533
|
-
VALUE argv[5];
|
2534
|
-
|
2535
|
-
// name_loc
|
2536
|
-
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2537
|
-
|
2538
|
-
// operator_loc
|
2539
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2540
|
-
|
2541
|
-
// value
|
2542
|
-
argv[2] = rb_ary_pop(value_stack);
|
2543
|
-
|
2544
|
-
// constant_id
|
2545
|
-
argv[3] = rb_id2sym(constants[cast->constant_id - 1]);
|
2546
|
-
|
2547
|
-
// location
|
2548
|
-
argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2549
|
-
|
2550
|
-
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPLocalVariableOperatorOrWriteNode));
|
2551
|
-
break;
|
2552
|
-
}
|
2553
|
-
#line 137 "api_node.c.erb"
|
2554
|
-
case YP_NODE_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: {
|
2555
|
-
yp_local_variable_operator_write_node_t *cast = (yp_local_variable_operator_write_node_t *) node;
|
2556
|
-
VALUE argv[6];
|
2557
|
-
|
2558
|
-
// name_loc
|
2559
|
-
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2560
|
-
|
2561
|
-
// operator_loc
|
2562
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2563
|
-
|
2564
|
-
// value
|
2565
|
-
argv[2] = rb_ary_pop(value_stack);
|
2566
|
-
|
2567
|
-
// constant_id
|
2568
|
-
argv[3] = rb_id2sym(constants[cast->constant_id - 1]);
|
2569
|
-
|
2570
|
-
// operator_id
|
2571
|
-
argv[4] = rb_id2sym(constants[cast->operator_id - 1]);
|
2572
|
-
|
2573
|
-
// location
|
2574
|
-
argv[5] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2575
|
-
|
2576
|
-
rb_ary_push(value_stack, rb_class_new_instance(6, argv, rb_cYARPLocalVariableOperatorWriteNode));
|
2577
|
-
break;
|
2578
|
-
}
|
2579
2107
|
#line 137 "api_node.c.erb"
|
2580
2108
|
case YP_NODE_LOCAL_VARIABLE_READ_NODE: {
|
2581
2109
|
yp_local_variable_read_node_t *cast = (yp_local_variable_read_node_t *) node;
|
@@ -2675,7 +2203,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2675
2203
|
VALUE argv[6];
|
2676
2204
|
|
2677
2205
|
// locals
|
2678
|
-
argv[0] =
|
2206
|
+
argv[0] = rb_ary_new_capa(cast->locals.size);
|
2679
2207
|
for (size_t index = 0; index < cast->locals.size; index++) {
|
2680
2208
|
rb_ary_push(argv[0], rb_id2sym(constants[cast->locals.ids[index] - 1]));
|
2681
2209
|
}
|
@@ -2686,7 +2214,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2686
2214
|
// constant_path
|
2687
2215
|
argv[2] = rb_ary_pop(value_stack);
|
2688
2216
|
|
2689
|
-
//
|
2217
|
+
// body
|
2690
2218
|
argv[3] = rb_ary_pop(value_stack);
|
2691
2219
|
|
2692
2220
|
// end_keyword_loc
|
@@ -2704,7 +2232,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2704
2232
|
VALUE argv[6];
|
2705
2233
|
|
2706
2234
|
// targets
|
2707
|
-
argv[0] =
|
2235
|
+
argv[0] = rb_ary_new_capa(cast->targets.size);
|
2708
2236
|
for (size_t index = 0; index < cast->targets.size; index++) {
|
2709
2237
|
rb_ary_push(argv[0], rb_ary_pop(value_stack));
|
2710
2238
|
}
|
@@ -2781,6 +2309,29 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2781
2309
|
rb_ary_push(value_stack, rb_class_new_instance(1, argv, rb_cYARPNumberedReferenceReadNode));
|
2782
2310
|
break;
|
2783
2311
|
}
|
2312
|
+
#line 137 "api_node.c.erb"
|
2313
|
+
case YP_NODE_OPERATOR_WRITE_NODE: {
|
2314
|
+
yp_operator_write_node_t *cast = (yp_operator_write_node_t *) node;
|
2315
|
+
VALUE argv[5];
|
2316
|
+
|
2317
|
+
// target
|
2318
|
+
argv[0] = rb_ary_pop(value_stack);
|
2319
|
+
|
2320
|
+
// operator_loc
|
2321
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2322
|
+
|
2323
|
+
// operator
|
2324
|
+
argv[2] = rb_id2sym(constants[cast->operator - 1]);
|
2325
|
+
|
2326
|
+
// value
|
2327
|
+
argv[3] = rb_ary_pop(value_stack);
|
2328
|
+
|
2329
|
+
// location
|
2330
|
+
argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2331
|
+
|
2332
|
+
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPOperatorWriteNode));
|
2333
|
+
break;
|
2334
|
+
}
|
2784
2335
|
#line 137 "api_node.c.erb"
|
2785
2336
|
case YP_NODE_OPTIONAL_PARAMETER_NODE: {
|
2786
2337
|
yp_optional_parameter_node_t *cast = (yp_optional_parameter_node_t *) node;
|
@@ -2824,25 +2375,45 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2824
2375
|
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPOrNode));
|
2825
2376
|
break;
|
2826
2377
|
}
|
2378
|
+
#line 137 "api_node.c.erb"
|
2379
|
+
case YP_NODE_OR_WRITE_NODE: {
|
2380
|
+
yp_or_write_node_t *cast = (yp_or_write_node_t *) node;
|
2381
|
+
VALUE argv[4];
|
2382
|
+
|
2383
|
+
// target
|
2384
|
+
argv[0] = rb_ary_pop(value_stack);
|
2385
|
+
|
2386
|
+
// value
|
2387
|
+
argv[1] = rb_ary_pop(value_stack);
|
2388
|
+
|
2389
|
+
// operator_loc
|
2390
|
+
argv[2] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2391
|
+
|
2392
|
+
// location
|
2393
|
+
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2394
|
+
|
2395
|
+
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPOrWriteNode));
|
2396
|
+
break;
|
2397
|
+
}
|
2827
2398
|
#line 137 "api_node.c.erb"
|
2828
2399
|
case YP_NODE_PARAMETERS_NODE: {
|
2829
2400
|
yp_parameters_node_t *cast = (yp_parameters_node_t *) node;
|
2830
2401
|
VALUE argv[8];
|
2831
2402
|
|
2832
2403
|
// requireds
|
2833
|
-
argv[0] =
|
2404
|
+
argv[0] = rb_ary_new_capa(cast->requireds.size);
|
2834
2405
|
for (size_t index = 0; index < cast->requireds.size; index++) {
|
2835
2406
|
rb_ary_push(argv[0], rb_ary_pop(value_stack));
|
2836
2407
|
}
|
2837
2408
|
|
2838
2409
|
// optionals
|
2839
|
-
argv[1] =
|
2410
|
+
argv[1] = rb_ary_new_capa(cast->optionals.size);
|
2840
2411
|
for (size_t index = 0; index < cast->optionals.size; index++) {
|
2841
2412
|
rb_ary_push(argv[1], rb_ary_pop(value_stack));
|
2842
2413
|
}
|
2843
2414
|
|
2844
2415
|
// posts
|
2845
|
-
argv[2] =
|
2416
|
+
argv[2] = rb_ary_new_capa(cast->posts.size);
|
2846
2417
|
for (size_t index = 0; index < cast->posts.size; index++) {
|
2847
2418
|
rb_ary_push(argv[2], rb_ary_pop(value_stack));
|
2848
2419
|
}
|
@@ -2851,7 +2422,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2851
2422
|
argv[3] = rb_ary_pop(value_stack);
|
2852
2423
|
|
2853
2424
|
// keywords
|
2854
|
-
argv[4] =
|
2425
|
+
argv[4] = rb_ary_new_capa(cast->keywords.size);
|
2855
2426
|
for (size_t index = 0; index < cast->keywords.size; index++) {
|
2856
2427
|
rb_ary_push(argv[4], rb_ary_pop(value_stack));
|
2857
2428
|
}
|
@@ -2873,7 +2444,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2873
2444
|
yp_parentheses_node_t *cast = (yp_parentheses_node_t *) node;
|
2874
2445
|
VALUE argv[4];
|
2875
2446
|
|
2876
|
-
//
|
2447
|
+
// body
|
2877
2448
|
argv[0] = rb_ary_pop(value_stack);
|
2878
2449
|
|
2879
2450
|
// opening_loc
|
@@ -2980,7 +2551,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2980
2551
|
VALUE argv[3];
|
2981
2552
|
|
2982
2553
|
// locals
|
2983
|
-
argv[0] =
|
2554
|
+
argv[0] = rb_ary_new_capa(cast->locals.size);
|
2984
2555
|
for (size_t index = 0; index < cast->locals.size; index++) {
|
2985
2556
|
rb_ary_push(argv[0], rb_id2sym(constants[cast->locals.ids[index] - 1]));
|
2986
2557
|
}
|
@@ -3072,7 +2643,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
3072
2643
|
VALUE argv[4];
|
3073
2644
|
|
3074
2645
|
// parameters
|
3075
|
-
argv[0] =
|
2646
|
+
argv[0] = rb_ary_new_capa(cast->parameters.size);
|
3076
2647
|
for (size_t index = 0; index < cast->parameters.size; index++) {
|
3077
2648
|
rb_ary_push(argv[0], rb_ary_pop(value_stack));
|
3078
2649
|
}
|
@@ -3132,7 +2703,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
3132
2703
|
argv[0] = yp_location_new(parser, cast->keyword_loc.start, cast->keyword_loc.end, source);
|
3133
2704
|
|
3134
2705
|
// exceptions
|
3135
|
-
argv[1] =
|
2706
|
+
argv[1] = rb_ary_new_capa(cast->exceptions.size);
|
3136
2707
|
for (size_t index = 0; index < cast->exceptions.size; index++) {
|
3137
2708
|
rb_ary_push(argv[1], rb_ary_pop(value_stack));
|
3138
2709
|
}
|
@@ -3215,7 +2786,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
3215
2786
|
VALUE argv[7];
|
3216
2787
|
|
3217
2788
|
// locals
|
3218
|
-
argv[0] =
|
2789
|
+
argv[0] = rb_ary_new_capa(cast->locals.size);
|
3219
2790
|
for (size_t index = 0; index < cast->locals.size; index++) {
|
3220
2791
|
rb_ary_push(argv[0], rb_id2sym(constants[cast->locals.ids[index] - 1]));
|
3221
2792
|
}
|
@@ -3229,7 +2800,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
3229
2800
|
// expression
|
3230
2801
|
argv[3] = rb_ary_pop(value_stack);
|
3231
2802
|
|
3232
|
-
//
|
2803
|
+
// body
|
3233
2804
|
argv[4] = rb_ary_pop(value_stack);
|
3234
2805
|
|
3235
2806
|
// end_keyword_loc
|
@@ -3298,7 +2869,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
3298
2869
|
VALUE argv[2];
|
3299
2870
|
|
3300
2871
|
// body
|
3301
|
-
argv[0] =
|
2872
|
+
argv[0] = rb_ary_new_capa(cast->body.size);
|
3302
2873
|
for (size_t index = 0; index < cast->body.size; index++) {
|
3303
2874
|
rb_ary_push(argv[0], rb_ary_pop(value_stack));
|
3304
2875
|
}
|
@@ -3413,7 +2984,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
3413
2984
|
VALUE argv[3];
|
3414
2985
|
|
3415
2986
|
// names
|
3416
|
-
argv[0] =
|
2987
|
+
argv[0] = rb_ary_new_capa(cast->names.size);
|
3417
2988
|
for (size_t index = 0; index < cast->names.size; index++) {
|
3418
2989
|
rb_ary_push(argv[0], rb_ary_pop(value_stack));
|
3419
2990
|
}
|
@@ -3485,7 +3056,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
3485
3056
|
argv[0] = yp_location_new(parser, cast->keyword_loc.start, cast->keyword_loc.end, source);
|
3486
3057
|
|
3487
3058
|
// conditions
|
3488
|
-
argv[1] =
|
3059
|
+
argv[1] = rb_ary_new_capa(cast->conditions.size);
|
3489
3060
|
for (size_t index = 0; index < cast->conditions.size; index++) {
|
3490
3061
|
rb_ary_push(argv[1], rb_ary_pop(value_stack));
|
3491
3062
|
}
|
@@ -3584,6 +3155,7 @@ Init_yarp_api_node(void) {
|
|
3584
3155
|
rb_cYARPAliasNode = rb_define_class_under(rb_cYARP, "AliasNode", rb_cYARPNode);
|
3585
3156
|
rb_cYARPAlternationPatternNode = rb_define_class_under(rb_cYARP, "AlternationPatternNode", rb_cYARPNode);
|
3586
3157
|
rb_cYARPAndNode = rb_define_class_under(rb_cYARP, "AndNode", rb_cYARPNode);
|
3158
|
+
rb_cYARPAndWriteNode = rb_define_class_under(rb_cYARP, "AndWriteNode", rb_cYARPNode);
|
3587
3159
|
rb_cYARPArgumentsNode = rb_define_class_under(rb_cYARP, "ArgumentsNode", rb_cYARPNode);
|
3588
3160
|
rb_cYARPArrayNode = rb_define_class_under(rb_cYARP, "ArrayNode", rb_cYARPNode);
|
3589
3161
|
rb_cYARPArrayPatternNode = rb_define_class_under(rb_cYARP, "ArrayPatternNode", rb_cYARPNode);
|
@@ -3603,18 +3175,9 @@ Init_yarp_api_node(void) {
|
|
3603
3175
|
rb_cYARPCapturePatternNode = rb_define_class_under(rb_cYARP, "CapturePatternNode", rb_cYARPNode);
|
3604
3176
|
rb_cYARPCaseNode = rb_define_class_under(rb_cYARP, "CaseNode", rb_cYARPNode);
|
3605
3177
|
rb_cYARPClassNode = rb_define_class_under(rb_cYARP, "ClassNode", rb_cYARPNode);
|
3606
|
-
rb_cYARPClassVariableOperatorAndWriteNode = rb_define_class_under(rb_cYARP, "ClassVariableOperatorAndWriteNode", rb_cYARPNode);
|
3607
|
-
rb_cYARPClassVariableOperatorOrWriteNode = rb_define_class_under(rb_cYARP, "ClassVariableOperatorOrWriteNode", rb_cYARPNode);
|
3608
|
-
rb_cYARPClassVariableOperatorWriteNode = rb_define_class_under(rb_cYARP, "ClassVariableOperatorWriteNode", rb_cYARPNode);
|
3609
3178
|
rb_cYARPClassVariableReadNode = rb_define_class_under(rb_cYARP, "ClassVariableReadNode", rb_cYARPNode);
|
3610
3179
|
rb_cYARPClassVariableWriteNode = rb_define_class_under(rb_cYARP, "ClassVariableWriteNode", rb_cYARPNode);
|
3611
|
-
rb_cYARPConstantOperatorAndWriteNode = rb_define_class_under(rb_cYARP, "ConstantOperatorAndWriteNode", rb_cYARPNode);
|
3612
|
-
rb_cYARPConstantOperatorOrWriteNode = rb_define_class_under(rb_cYARP, "ConstantOperatorOrWriteNode", rb_cYARPNode);
|
3613
|
-
rb_cYARPConstantOperatorWriteNode = rb_define_class_under(rb_cYARP, "ConstantOperatorWriteNode", rb_cYARPNode);
|
3614
3180
|
rb_cYARPConstantPathNode = rb_define_class_under(rb_cYARP, "ConstantPathNode", rb_cYARPNode);
|
3615
|
-
rb_cYARPConstantPathOperatorAndWriteNode = rb_define_class_under(rb_cYARP, "ConstantPathOperatorAndWriteNode", rb_cYARPNode);
|
3616
|
-
rb_cYARPConstantPathOperatorOrWriteNode = rb_define_class_under(rb_cYARP, "ConstantPathOperatorOrWriteNode", rb_cYARPNode);
|
3617
|
-
rb_cYARPConstantPathOperatorWriteNode = rb_define_class_under(rb_cYARP, "ConstantPathOperatorWriteNode", rb_cYARPNode);
|
3618
3181
|
rb_cYARPConstantPathWriteNode = rb_define_class_under(rb_cYARP, "ConstantPathWriteNode", rb_cYARPNode);
|
3619
3182
|
rb_cYARPConstantReadNode = rb_define_class_under(rb_cYARP, "ConstantReadNode", rb_cYARPNode);
|
3620
3183
|
rb_cYARPConstantWriteNode = rb_define_class_under(rb_cYARP, "ConstantWriteNode", rb_cYARPNode);
|
@@ -3632,9 +3195,6 @@ Init_yarp_api_node(void) {
|
|
3632
3195
|
rb_cYARPForwardingArgumentsNode = rb_define_class_under(rb_cYARP, "ForwardingArgumentsNode", rb_cYARPNode);
|
3633
3196
|
rb_cYARPForwardingParameterNode = rb_define_class_under(rb_cYARP, "ForwardingParameterNode", rb_cYARPNode);
|
3634
3197
|
rb_cYARPForwardingSuperNode = rb_define_class_under(rb_cYARP, "ForwardingSuperNode", rb_cYARPNode);
|
3635
|
-
rb_cYARPGlobalVariableOperatorAndWriteNode = rb_define_class_under(rb_cYARP, "GlobalVariableOperatorAndWriteNode", rb_cYARPNode);
|
3636
|
-
rb_cYARPGlobalVariableOperatorOrWriteNode = rb_define_class_under(rb_cYARP, "GlobalVariableOperatorOrWriteNode", rb_cYARPNode);
|
3637
|
-
rb_cYARPGlobalVariableOperatorWriteNode = rb_define_class_under(rb_cYARP, "GlobalVariableOperatorWriteNode", rb_cYARPNode);
|
3638
3198
|
rb_cYARPGlobalVariableReadNode = rb_define_class_under(rb_cYARP, "GlobalVariableReadNode", rb_cYARPNode);
|
3639
3199
|
rb_cYARPGlobalVariableWriteNode = rb_define_class_under(rb_cYARP, "GlobalVariableWriteNode", rb_cYARPNode);
|
3640
3200
|
rb_cYARPHashNode = rb_define_class_under(rb_cYARP, "HashNode", rb_cYARPNode);
|
@@ -3642,9 +3202,6 @@ Init_yarp_api_node(void) {
|
|
3642
3202
|
rb_cYARPIfNode = rb_define_class_under(rb_cYARP, "IfNode", rb_cYARPNode);
|
3643
3203
|
rb_cYARPImaginaryNode = rb_define_class_under(rb_cYARP, "ImaginaryNode", rb_cYARPNode);
|
3644
3204
|
rb_cYARPInNode = rb_define_class_under(rb_cYARP, "InNode", rb_cYARPNode);
|
3645
|
-
rb_cYARPInstanceVariableOperatorAndWriteNode = rb_define_class_under(rb_cYARP, "InstanceVariableOperatorAndWriteNode", rb_cYARPNode);
|
3646
|
-
rb_cYARPInstanceVariableOperatorOrWriteNode = rb_define_class_under(rb_cYARP, "InstanceVariableOperatorOrWriteNode", rb_cYARPNode);
|
3647
|
-
rb_cYARPInstanceVariableOperatorWriteNode = rb_define_class_under(rb_cYARP, "InstanceVariableOperatorWriteNode", rb_cYARPNode);
|
3648
3205
|
rb_cYARPInstanceVariableReadNode = rb_define_class_under(rb_cYARP, "InstanceVariableReadNode", rb_cYARPNode);
|
3649
3206
|
rb_cYARPInstanceVariableWriteNode = rb_define_class_under(rb_cYARP, "InstanceVariableWriteNode", rb_cYARPNode);
|
3650
3207
|
rb_cYARPIntegerNode = rb_define_class_under(rb_cYARP, "IntegerNode", rb_cYARPNode);
|
@@ -3656,9 +3213,6 @@ Init_yarp_api_node(void) {
|
|
3656
3213
|
rb_cYARPKeywordParameterNode = rb_define_class_under(rb_cYARP, "KeywordParameterNode", rb_cYARPNode);
|
3657
3214
|
rb_cYARPKeywordRestParameterNode = rb_define_class_under(rb_cYARP, "KeywordRestParameterNode", rb_cYARPNode);
|
3658
3215
|
rb_cYARPLambdaNode = rb_define_class_under(rb_cYARP, "LambdaNode", rb_cYARPNode);
|
3659
|
-
rb_cYARPLocalVariableOperatorAndWriteNode = rb_define_class_under(rb_cYARP, "LocalVariableOperatorAndWriteNode", rb_cYARPNode);
|
3660
|
-
rb_cYARPLocalVariableOperatorOrWriteNode = rb_define_class_under(rb_cYARP, "LocalVariableOperatorOrWriteNode", rb_cYARPNode);
|
3661
|
-
rb_cYARPLocalVariableOperatorWriteNode = rb_define_class_under(rb_cYARP, "LocalVariableOperatorWriteNode", rb_cYARPNode);
|
3662
3216
|
rb_cYARPLocalVariableReadNode = rb_define_class_under(rb_cYARP, "LocalVariableReadNode", rb_cYARPNode);
|
3663
3217
|
rb_cYARPLocalVariableWriteNode = rb_define_class_under(rb_cYARP, "LocalVariableWriteNode", rb_cYARPNode);
|
3664
3218
|
rb_cYARPMatchPredicateNode = rb_define_class_under(rb_cYARP, "MatchPredicateNode", rb_cYARPNode);
|
@@ -3670,8 +3224,10 @@ Init_yarp_api_node(void) {
|
|
3670
3224
|
rb_cYARPNilNode = rb_define_class_under(rb_cYARP, "NilNode", rb_cYARPNode);
|
3671
3225
|
rb_cYARPNoKeywordsParameterNode = rb_define_class_under(rb_cYARP, "NoKeywordsParameterNode", rb_cYARPNode);
|
3672
3226
|
rb_cYARPNumberedReferenceReadNode = rb_define_class_under(rb_cYARP, "NumberedReferenceReadNode", rb_cYARPNode);
|
3227
|
+
rb_cYARPOperatorWriteNode = rb_define_class_under(rb_cYARP, "OperatorWriteNode", rb_cYARPNode);
|
3673
3228
|
rb_cYARPOptionalParameterNode = rb_define_class_under(rb_cYARP, "OptionalParameterNode", rb_cYARPNode);
|
3674
3229
|
rb_cYARPOrNode = rb_define_class_under(rb_cYARP, "OrNode", rb_cYARPNode);
|
3230
|
+
rb_cYARPOrWriteNode = rb_define_class_under(rb_cYARP, "OrWriteNode", rb_cYARPNode);
|
3675
3231
|
rb_cYARPParametersNode = rb_define_class_under(rb_cYARP, "ParametersNode", rb_cYARPNode);
|
3676
3232
|
rb_cYARPParenthesesNode = rb_define_class_under(rb_cYARP, "ParenthesesNode", rb_cYARPNode);
|
3677
3233
|
rb_cYARPPinnedExpressionNode = rb_define_class_under(rb_cYARP, "PinnedExpressionNode", rb_cYARPNode);
|