ext/yarp/api_node.c in yarp-0.7.0 vs ext/yarp/api_node.c in yarp-0.8.0
- old
+ new
@@ -15,10 +15,11 @@
extern VALUE rb_cYARPLocation;
static VALUE rb_cYARPAliasNode;
static VALUE rb_cYARPAlternationPatternNode;
static VALUE rb_cYARPAndNode;
+static VALUE rb_cYARPAndWriteNode;
static VALUE rb_cYARPArgumentsNode;
static VALUE rb_cYARPArrayNode;
static VALUE rb_cYARPArrayPatternNode;
static VALUE rb_cYARPAssocNode;
static VALUE rb_cYARPAssocSplatNode;
@@ -34,22 +35,13 @@
static VALUE rb_cYARPCallOperatorOrWriteNode;
static VALUE rb_cYARPCallOperatorWriteNode;
static VALUE rb_cYARPCapturePatternNode;
static VALUE rb_cYARPCaseNode;
static VALUE rb_cYARPClassNode;
-static VALUE rb_cYARPClassVariableOperatorAndWriteNode;
-static VALUE rb_cYARPClassVariableOperatorOrWriteNode;
-static VALUE rb_cYARPClassVariableOperatorWriteNode;
static VALUE rb_cYARPClassVariableReadNode;
static VALUE rb_cYARPClassVariableWriteNode;
-static VALUE rb_cYARPConstantOperatorAndWriteNode;
-static VALUE rb_cYARPConstantOperatorOrWriteNode;
-static VALUE rb_cYARPConstantOperatorWriteNode;
static VALUE rb_cYARPConstantPathNode;
-static VALUE rb_cYARPConstantPathOperatorAndWriteNode;
-static VALUE rb_cYARPConstantPathOperatorOrWriteNode;
-static VALUE rb_cYARPConstantPathOperatorWriteNode;
static VALUE rb_cYARPConstantPathWriteNode;
static VALUE rb_cYARPConstantReadNode;
static VALUE rb_cYARPConstantWriteNode;
static VALUE rb_cYARPDefNode;
static VALUE rb_cYARPDefinedNode;
@@ -63,23 +55,17 @@
static VALUE rb_cYARPFloatNode;
static VALUE rb_cYARPForNode;
static VALUE rb_cYARPForwardingArgumentsNode;
static VALUE rb_cYARPForwardingParameterNode;
static VALUE rb_cYARPForwardingSuperNode;
-static VALUE rb_cYARPGlobalVariableOperatorAndWriteNode;
-static VALUE rb_cYARPGlobalVariableOperatorOrWriteNode;
-static VALUE rb_cYARPGlobalVariableOperatorWriteNode;
static VALUE rb_cYARPGlobalVariableReadNode;
static VALUE rb_cYARPGlobalVariableWriteNode;
static VALUE rb_cYARPHashNode;
static VALUE rb_cYARPHashPatternNode;
static VALUE rb_cYARPIfNode;
static VALUE rb_cYARPImaginaryNode;
static VALUE rb_cYARPInNode;
-static VALUE rb_cYARPInstanceVariableOperatorAndWriteNode;
-static VALUE rb_cYARPInstanceVariableOperatorOrWriteNode;
-static VALUE rb_cYARPInstanceVariableOperatorWriteNode;
static VALUE rb_cYARPInstanceVariableReadNode;
static VALUE rb_cYARPInstanceVariableWriteNode;
static VALUE rb_cYARPIntegerNode;
static VALUE rb_cYARPInterpolatedRegularExpressionNode;
static VALUE rb_cYARPInterpolatedStringNode;
@@ -87,13 +73,10 @@
static VALUE rb_cYARPInterpolatedXStringNode;
static VALUE rb_cYARPKeywordHashNode;
static VALUE rb_cYARPKeywordParameterNode;
static VALUE rb_cYARPKeywordRestParameterNode;
static VALUE rb_cYARPLambdaNode;
-static VALUE rb_cYARPLocalVariableOperatorAndWriteNode;
-static VALUE rb_cYARPLocalVariableOperatorOrWriteNode;
-static VALUE rb_cYARPLocalVariableOperatorWriteNode;
static VALUE rb_cYARPLocalVariableReadNode;
static VALUE rb_cYARPLocalVariableWriteNode;
static VALUE rb_cYARPMatchPredicateNode;
static VALUE rb_cYARPMatchRequiredNode;
static VALUE rb_cYARPMissingNode;
@@ -101,12 +84,14 @@
static VALUE rb_cYARPMultiWriteNode;
static VALUE rb_cYARPNextNode;
static VALUE rb_cYARPNilNode;
static VALUE rb_cYARPNoKeywordsParameterNode;
static VALUE rb_cYARPNumberedReferenceReadNode;
+static VALUE rb_cYARPOperatorWriteNode;
static VALUE rb_cYARPOptionalParameterNode;
static VALUE rb_cYARPOrNode;
+static VALUE rb_cYARPOrWriteNode;
static VALUE rb_cYARPParametersNode;
static VALUE rb_cYARPParenthesesNode;
static VALUE rb_cYARPPinnedExpressionNode;
static VALUE rb_cYARPPinnedVariableNode;
static VALUE rb_cYARPPostExecutionNode;
@@ -257,10 +242,17 @@
yp_node_stack_push(&node_stack, (yp_node_t *) cast->left);
yp_node_stack_push(&node_stack, (yp_node_t *) cast->right);
break;
}
#line 111 "api_node.c.erb"
+ case YP_NODE_AND_WRITE_NODE: {
+ yp_and_write_node_t *cast = (yp_and_write_node_t *) node;
+ yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
+ yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
+ break;
+ }
+#line 111 "api_node.c.erb"
case YP_NODE_ARGUMENTS_NODE: {
yp_arguments_node_t *cast = (yp_arguments_node_t *) node;
for (size_t index = 0; index < cast->arguments.size; index++) {
yp_node_stack_push(&node_stack, (yp_node_t *) cast->arguments.nodes[index]);
}
@@ -317,11 +309,11 @@
}
#line 111 "api_node.c.erb"
case YP_NODE_BLOCK_NODE: {
yp_block_node_t *cast = (yp_block_node_t *) node;
yp_node_stack_push(&node_stack, (yp_node_t *) cast->parameters);
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->statements);
+ yp_node_stack_push(&node_stack, (yp_node_t *) cast->body);
break;
}
#line 111 "api_node.c.erb"
case YP_NODE_BLOCK_PARAMETERS_NODE: {
yp_block_parameters_node_t *cast = (yp_block_parameters_node_t *) node;
@@ -383,84 +375,27 @@
#line 111 "api_node.c.erb"
case YP_NODE_CLASS_NODE: {
yp_class_node_t *cast = (yp_class_node_t *) node;
yp_node_stack_push(&node_stack, (yp_node_t *) cast->constant_path);
yp_node_stack_push(&node_stack, (yp_node_t *) cast->superclass);
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->statements);
+ yp_node_stack_push(&node_stack, (yp_node_t *) cast->body);
break;
}
#line 111 "api_node.c.erb"
- case YP_NODE_CLASS_VARIABLE_OPERATOR_AND_WRITE_NODE: {
- yp_class_variable_operator_and_write_node_t *cast = (yp_class_variable_operator_and_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
- case YP_NODE_CLASS_VARIABLE_OPERATOR_OR_WRITE_NODE: {
- yp_class_variable_operator_or_write_node_t *cast = (yp_class_variable_operator_or_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
- case YP_NODE_CLASS_VARIABLE_OPERATOR_WRITE_NODE: {
- yp_class_variable_operator_write_node_t *cast = (yp_class_variable_operator_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
case YP_NODE_CLASS_VARIABLE_WRITE_NODE: {
yp_class_variable_write_node_t *cast = (yp_class_variable_write_node_t *) node;
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
break;
}
#line 111 "api_node.c.erb"
- case YP_NODE_CONSTANT_OPERATOR_AND_WRITE_NODE: {
- yp_constant_operator_and_write_node_t *cast = (yp_constant_operator_and_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
- case YP_NODE_CONSTANT_OPERATOR_OR_WRITE_NODE: {
- yp_constant_operator_or_write_node_t *cast = (yp_constant_operator_or_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
- case YP_NODE_CONSTANT_OPERATOR_WRITE_NODE: {
- yp_constant_operator_write_node_t *cast = (yp_constant_operator_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
case YP_NODE_CONSTANT_PATH_NODE: {
yp_constant_path_node_t *cast = (yp_constant_path_node_t *) node;
yp_node_stack_push(&node_stack, (yp_node_t *) cast->parent);
yp_node_stack_push(&node_stack, (yp_node_t *) cast->child);
break;
}
#line 111 "api_node.c.erb"
- case YP_NODE_CONSTANT_PATH_OPERATOR_AND_WRITE_NODE: {
- yp_constant_path_operator_and_write_node_t *cast = (yp_constant_path_operator_and_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
- case YP_NODE_CONSTANT_PATH_OPERATOR_OR_WRITE_NODE: {
- yp_constant_path_operator_or_write_node_t *cast = (yp_constant_path_operator_or_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
- case YP_NODE_CONSTANT_PATH_OPERATOR_WRITE_NODE: {
- yp_constant_path_operator_write_node_t *cast = (yp_constant_path_operator_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
case YP_NODE_CONSTANT_PATH_WRITE_NODE: {
yp_constant_path_write_node_t *cast = (yp_constant_path_write_node_t *) node;
yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
break;
@@ -474,11 +409,11 @@
#line 111 "api_node.c.erb"
case YP_NODE_DEF_NODE: {
yp_def_node_t *cast = (yp_def_node_t *) node;
yp_node_stack_push(&node_stack, (yp_node_t *) cast->receiver);
yp_node_stack_push(&node_stack, (yp_node_t *) cast->parameters);
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->statements);
+ yp_node_stack_push(&node_stack, (yp_node_t *) cast->body);
break;
}
#line 111 "api_node.c.erb"
case YP_NODE_DEFINED_NODE: {
yp_defined_node_t *cast = (yp_defined_node_t *) node;
@@ -540,28 +475,10 @@
yp_forwarding_super_node_t *cast = (yp_forwarding_super_node_t *) node;
yp_node_stack_push(&node_stack, (yp_node_t *) cast->block);
break;
}
#line 111 "api_node.c.erb"
- case YP_NODE_GLOBAL_VARIABLE_OPERATOR_AND_WRITE_NODE: {
- yp_global_variable_operator_and_write_node_t *cast = (yp_global_variable_operator_and_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
- case YP_NODE_GLOBAL_VARIABLE_OPERATOR_OR_WRITE_NODE: {
- yp_global_variable_operator_or_write_node_t *cast = (yp_global_variable_operator_or_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
- case YP_NODE_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: {
- yp_global_variable_operator_write_node_t *cast = (yp_global_variable_operator_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
case YP_NODE_GLOBAL_VARIABLE_WRITE_NODE: {
yp_global_variable_write_node_t *cast = (yp_global_variable_write_node_t *) node;
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
break;
}
@@ -603,28 +520,10 @@
yp_node_stack_push(&node_stack, (yp_node_t *) cast->pattern);
yp_node_stack_push(&node_stack, (yp_node_t *) cast->statements);
break;
}
#line 111 "api_node.c.erb"
- case YP_NODE_INSTANCE_VARIABLE_OPERATOR_AND_WRITE_NODE: {
- yp_instance_variable_operator_and_write_node_t *cast = (yp_instance_variable_operator_and_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
- case YP_NODE_INSTANCE_VARIABLE_OPERATOR_OR_WRITE_NODE: {
- yp_instance_variable_operator_or_write_node_t *cast = (yp_instance_variable_operator_or_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
- case YP_NODE_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: {
- yp_instance_variable_operator_write_node_t *cast = (yp_instance_variable_operator_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
case YP_NODE_INSTANCE_VARIABLE_WRITE_NODE: {
yp_instance_variable_write_node_t *cast = (yp_instance_variable_write_node_t *) node;
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
break;
}
@@ -676,32 +575,14 @@
}
#line 111 "api_node.c.erb"
case YP_NODE_LAMBDA_NODE: {
yp_lambda_node_t *cast = (yp_lambda_node_t *) node;
yp_node_stack_push(&node_stack, (yp_node_t *) cast->parameters);
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->statements);
+ yp_node_stack_push(&node_stack, (yp_node_t *) cast->body);
break;
}
#line 111 "api_node.c.erb"
- case YP_NODE_LOCAL_VARIABLE_OPERATOR_AND_WRITE_NODE: {
- yp_local_variable_operator_and_write_node_t *cast = (yp_local_variable_operator_and_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
- case YP_NODE_LOCAL_VARIABLE_OPERATOR_OR_WRITE_NODE: {
- yp_local_variable_operator_or_write_node_t *cast = (yp_local_variable_operator_or_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
- case YP_NODE_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: {
- yp_local_variable_operator_write_node_t *cast = (yp_local_variable_operator_write_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
- break;
- }
-#line 111 "api_node.c.erb"
case YP_NODE_LOCAL_VARIABLE_WRITE_NODE: {
yp_local_variable_write_node_t *cast = (yp_local_variable_write_node_t *) node;
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
break;
}
@@ -721,11 +602,11 @@
}
#line 111 "api_node.c.erb"
case YP_NODE_MODULE_NODE: {
yp_module_node_t *cast = (yp_module_node_t *) node;
yp_node_stack_push(&node_stack, (yp_node_t *) cast->constant_path);
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->statements);
+ yp_node_stack_push(&node_stack, (yp_node_t *) cast->body);
break;
}
#line 111 "api_node.c.erb"
case YP_NODE_MULTI_WRITE_NODE: {
yp_multi_write_node_t *cast = (yp_multi_write_node_t *) node;
@@ -740,10 +621,17 @@
yp_next_node_t *cast = (yp_next_node_t *) node;
yp_node_stack_push(&node_stack, (yp_node_t *) cast->arguments);
break;
}
#line 111 "api_node.c.erb"
+ case YP_NODE_OPERATOR_WRITE_NODE: {
+ yp_operator_write_node_t *cast = (yp_operator_write_node_t *) node;
+ yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
+ yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
+ break;
+ }
+#line 111 "api_node.c.erb"
case YP_NODE_OPTIONAL_PARAMETER_NODE: {
yp_optional_parameter_node_t *cast = (yp_optional_parameter_node_t *) node;
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
break;
}
@@ -753,10 +641,17 @@
yp_node_stack_push(&node_stack, (yp_node_t *) cast->left);
yp_node_stack_push(&node_stack, (yp_node_t *) cast->right);
break;
}
#line 111 "api_node.c.erb"
+ case YP_NODE_OR_WRITE_NODE: {
+ yp_or_write_node_t *cast = (yp_or_write_node_t *) node;
+ yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
+ yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
+ break;
+ }
+#line 111 "api_node.c.erb"
case YP_NODE_PARAMETERS_NODE: {
yp_parameters_node_t *cast = (yp_parameters_node_t *) node;
for (size_t index = 0; index < cast->requireds.size; index++) {
yp_node_stack_push(&node_stack, (yp_node_t *) cast->requireds.nodes[index]);
}
@@ -775,11 +670,11 @@
break;
}
#line 111 "api_node.c.erb"
case YP_NODE_PARENTHESES_NODE: {
yp_parentheses_node_t *cast = (yp_parentheses_node_t *) node;
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->statements);
+ yp_node_stack_push(&node_stack, (yp_node_t *) cast->body);
break;
}
#line 111 "api_node.c.erb"
case YP_NODE_PINNED_EXPRESSION_NODE: {
yp_pinned_expression_node_t *cast = (yp_pinned_expression_node_t *) node;
@@ -857,11 +752,11 @@
}
#line 111 "api_node.c.erb"
case YP_NODE_SINGLETON_CLASS_NODE: {
yp_singleton_class_node_t *cast = (yp_singleton_class_node_t *) node;
yp_node_stack_push(&node_stack, (yp_node_t *) cast->expression);
- yp_node_stack_push(&node_stack, (yp_node_t *) cast->statements);
+ yp_node_stack_push(&node_stack, (yp_node_t *) cast->body);
break;
}
#line 111 "api_node.c.erb"
case YP_NODE_SPLAT_NODE: {
yp_splat_node_t *cast = (yp_splat_node_t *) node;
@@ -1002,16 +897,36 @@
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPAndNode));
break;
}
#line 137 "api_node.c.erb"
+ case YP_NODE_AND_WRITE_NODE: {
+ yp_and_write_node_t *cast = (yp_and_write_node_t *) node;
+ VALUE argv[4];
+
+ // target
+ argv[0] = rb_ary_pop(value_stack);
+
+ // value
+ argv[1] = rb_ary_pop(value_stack);
+
+ // operator_loc
+ argv[2] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
+
+ // location
+ argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
+
+ rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPAndWriteNode));
+ break;
+ }
+#line 137 "api_node.c.erb"
case YP_NODE_ARGUMENTS_NODE: {
yp_arguments_node_t *cast = (yp_arguments_node_t *) node;
VALUE argv[2];
// arguments
- argv[0] = rb_ary_new();
+ argv[0] = rb_ary_new_capa(cast->arguments.size);
for (size_t index = 0; index < cast->arguments.size; index++) {
rb_ary_push(argv[0], rb_ary_pop(value_stack));
}
// location
@@ -1024,11 +939,11 @@
case YP_NODE_ARRAY_NODE: {
yp_array_node_t *cast = (yp_array_node_t *) node;
VALUE argv[4];
// elements
- argv[0] = rb_ary_new();
+ argv[0] = rb_ary_new_capa(cast->elements.size);
for (size_t index = 0; index < cast->elements.size; index++) {
rb_ary_push(argv[0], rb_ary_pop(value_stack));
}
// opening_loc
@@ -1050,20 +965,20 @@
// constant
argv[0] = rb_ary_pop(value_stack);
// requireds
- argv[1] = rb_ary_new();
+ argv[1] = rb_ary_new_capa(cast->requireds.size);
for (size_t index = 0; index < cast->requireds.size; index++) {
rb_ary_push(argv[1], rb_ary_pop(value_stack));
}
// rest
argv[2] = rb_ary_pop(value_stack);
// posts
- argv[3] = rb_ary_new();
+ argv[3] = rb_ary_new_capa(cast->posts.size);
for (size_t index = 0; index < cast->posts.size; index++) {
rb_ary_push(argv[3], rb_ary_pop(value_stack));
}
// opening_loc
@@ -1175,19 +1090,19 @@
case YP_NODE_BLOCK_NODE: {
yp_block_node_t *cast = (yp_block_node_t *) node;
VALUE argv[6];
// locals
- argv[0] = rb_ary_new();
+ argv[0] = rb_ary_new_capa(cast->locals.size);
for (size_t index = 0; index < cast->locals.size; index++) {
rb_ary_push(argv[0], rb_id2sym(constants[cast->locals.ids[index] - 1]));
}
// parameters
argv[1] = rb_ary_pop(value_stack);
- // statements
+ // body
argv[2] = rb_ary_pop(value_stack);
// opening_loc
argv[3] = yp_location_new(parser, cast->opening_loc.start, cast->opening_loc.end, source);
@@ -1224,11 +1139,11 @@
// parameters
argv[0] = rb_ary_pop(value_stack);
// locals
- argv[1] = rb_ary_new();
+ argv[1] = rb_ary_new_capa(cast->locals.size);
for (size_t index = 0; index < cast->locals.size; index++) {
yp_location_t location = cast->locals.locations[index];
rb_ary_push(argv[1], yp_location_new(parser, location.start, location.end, source));
}
@@ -1389,11 +1304,11 @@
// predicate
argv[0] = rb_ary_pop(value_stack);
// conditions
- argv[1] = rb_ary_new();
+ argv[1] = rb_ary_new_capa(cast->conditions.size);
for (size_t index = 0; index < cast->conditions.size; index++) {
rb_ary_push(argv[1], rb_ary_pop(value_stack));
}
// consequent
@@ -1415,11 +1330,11 @@
case YP_NODE_CLASS_NODE: {
yp_class_node_t *cast = (yp_class_node_t *) node;
VALUE argv[8];
// locals
- argv[0] = rb_ary_new();
+ argv[0] = rb_ary_new_capa(cast->locals.size);
for (size_t index = 0; index < cast->locals.size; index++) {
rb_ary_push(argv[0], rb_id2sym(constants[cast->locals.ids[index] - 1]));
}
// class_keyword_loc
@@ -1432,11 +1347,11 @@
argv[3] = cast->inheritance_operator_loc.start == NULL ? Qnil : yp_location_new(parser, cast->inheritance_operator_loc.start, cast->inheritance_operator_loc.end, source);
// superclass
argv[4] = rb_ary_pop(value_stack);
- // statements
+ // body
argv[5] = rb_ary_pop(value_stack);
// end_keyword_loc
argv[6] = yp_location_new(parser, cast->end_keyword_loc.start, cast->end_keyword_loc.end, source);
@@ -1445,73 +1360,10 @@
rb_ary_push(value_stack, rb_class_new_instance(8, argv, rb_cYARPClassNode));
break;
}
#line 137 "api_node.c.erb"
- case YP_NODE_CLASS_VARIABLE_OPERATOR_AND_WRITE_NODE: {
- yp_class_variable_operator_and_write_node_t *cast = (yp_class_variable_operator_and_write_node_t *) node;
- VALUE argv[4];
-
- // name_loc
- argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // location
- argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPClassVariableOperatorAndWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
- case YP_NODE_CLASS_VARIABLE_OPERATOR_OR_WRITE_NODE: {
- yp_class_variable_operator_or_write_node_t *cast = (yp_class_variable_operator_or_write_node_t *) node;
- VALUE argv[4];
-
- // name_loc
- argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // location
- argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPClassVariableOperatorOrWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
- case YP_NODE_CLASS_VARIABLE_OPERATOR_WRITE_NODE: {
- yp_class_variable_operator_write_node_t *cast = (yp_class_variable_operator_write_node_t *) node;
- VALUE argv[5];
-
- // name_loc
- argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // operator
- argv[3] = rb_id2sym(constants[cast->operator - 1]);
-
- // location
- argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPClassVariableOperatorWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
case YP_NODE_CLASS_VARIABLE_READ_NODE: {
VALUE argv[1];
// location
argv[0] = yp_location_new(parser, node->location.start, node->location.end, source);
@@ -1538,73 +1390,10 @@
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPClassVariableWriteNode));
break;
}
#line 137 "api_node.c.erb"
- case YP_NODE_CONSTANT_OPERATOR_AND_WRITE_NODE: {
- yp_constant_operator_and_write_node_t *cast = (yp_constant_operator_and_write_node_t *) node;
- VALUE argv[4];
-
- // name_loc
- argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // location
- argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPConstantOperatorAndWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
- case YP_NODE_CONSTANT_OPERATOR_OR_WRITE_NODE: {
- yp_constant_operator_or_write_node_t *cast = (yp_constant_operator_or_write_node_t *) node;
- VALUE argv[4];
-
- // name_loc
- argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // location
- argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPConstantOperatorOrWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
- case YP_NODE_CONSTANT_OPERATOR_WRITE_NODE: {
- yp_constant_operator_write_node_t *cast = (yp_constant_operator_write_node_t *) node;
- VALUE argv[5];
-
- // name_loc
- argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // operator
- argv[3] = rb_id2sym(constants[cast->operator - 1]);
-
- // location
- argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPConstantOperatorWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
case YP_NODE_CONSTANT_PATH_NODE: {
yp_constant_path_node_t *cast = (yp_constant_path_node_t *) node;
VALUE argv[4];
// parent
@@ -1621,73 +1410,10 @@
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPConstantPathNode));
break;
}
#line 137 "api_node.c.erb"
- case YP_NODE_CONSTANT_PATH_OPERATOR_AND_WRITE_NODE: {
- yp_constant_path_operator_and_write_node_t *cast = (yp_constant_path_operator_and_write_node_t *) node;
- VALUE argv[4];
-
- // target
- argv[0] = rb_ary_pop(value_stack);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // location
- argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPConstantPathOperatorAndWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
- case YP_NODE_CONSTANT_PATH_OPERATOR_OR_WRITE_NODE: {
- yp_constant_path_operator_or_write_node_t *cast = (yp_constant_path_operator_or_write_node_t *) node;
- VALUE argv[4];
-
- // target
- argv[0] = rb_ary_pop(value_stack);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // location
- argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPConstantPathOperatorOrWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
- case YP_NODE_CONSTANT_PATH_OPERATOR_WRITE_NODE: {
- yp_constant_path_operator_write_node_t *cast = (yp_constant_path_operator_write_node_t *) node;
- VALUE argv[5];
-
- // target
- argv[0] = rb_ary_pop(value_stack);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // operator
- argv[3] = rb_id2sym(constants[cast->operator - 1]);
-
- // location
- argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPConstantPathOperatorWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
case YP_NODE_CONSTANT_PATH_WRITE_NODE: {
yp_constant_path_write_node_t *cast = (yp_constant_path_write_node_t *) node;
VALUE argv[4];
// target
@@ -1747,15 +1473,15 @@
argv[1] = rb_ary_pop(value_stack);
// parameters
argv[2] = rb_ary_pop(value_stack);
- // statements
+ // body
argv[3] = rb_ary_pop(value_stack);
// locals
- argv[4] = rb_ary_new();
+ argv[4] = rb_ary_new_capa(cast->locals.size);
for (size_t index = 0; index < cast->locals.size; index++) {
rb_ary_push(argv[4], rb_id2sym(constants[cast->locals.ids[index] - 1]));
}
// def_keyword_loc
@@ -1902,11 +1628,11 @@
// left
argv[1] = rb_ary_pop(value_stack);
// requireds
- argv[2] = rb_ary_new();
+ argv[2] = rb_ary_new_capa(cast->requireds.size);
for (size_t index = 0; index < cast->requireds.size; index++) {
rb_ary_push(argv[2], rb_ary_pop(value_stack));
}
// right
@@ -2021,73 +1747,10 @@
rb_ary_push(value_stack, rb_class_new_instance(2, argv, rb_cYARPForwardingSuperNode));
break;
}
#line 137 "api_node.c.erb"
- case YP_NODE_GLOBAL_VARIABLE_OPERATOR_AND_WRITE_NODE: {
- yp_global_variable_operator_and_write_node_t *cast = (yp_global_variable_operator_and_write_node_t *) node;
- VALUE argv[4];
-
- // name_loc
- argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // location
- argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPGlobalVariableOperatorAndWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
- case YP_NODE_GLOBAL_VARIABLE_OPERATOR_OR_WRITE_NODE: {
- yp_global_variable_operator_or_write_node_t *cast = (yp_global_variable_operator_or_write_node_t *) node;
- VALUE argv[4];
-
- // name_loc
- argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // location
- argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPGlobalVariableOperatorOrWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
- case YP_NODE_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: {
- yp_global_variable_operator_write_node_t *cast = (yp_global_variable_operator_write_node_t *) node;
- VALUE argv[5];
-
- // name_loc
- argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // operator
- argv[3] = rb_id2sym(constants[cast->operator - 1]);
-
- // location
- argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPGlobalVariableOperatorWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
case YP_NODE_GLOBAL_VARIABLE_READ_NODE: {
VALUE argv[1];
// location
argv[0] = yp_location_new(parser, node->location.start, node->location.end, source);
@@ -2122,11 +1785,11 @@
// opening_loc
argv[0] = yp_location_new(parser, cast->opening_loc.start, cast->opening_loc.end, source);
// elements
- argv[1] = rb_ary_new();
+ argv[1] = rb_ary_new_capa(cast->elements.size);
for (size_t index = 0; index < cast->elements.size; index++) {
rb_ary_push(argv[1], rb_ary_pop(value_stack));
}
// closing_loc
@@ -2145,11 +1808,11 @@
// constant
argv[0] = rb_ary_pop(value_stack);
// assocs
- argv[1] = rb_ary_new();
+ argv[1] = rb_ary_new_capa(cast->assocs.size);
for (size_t index = 0; index < cast->assocs.size; index++) {
rb_ary_push(argv[1], rb_ary_pop(value_stack));
}
// kwrest
@@ -2228,73 +1891,10 @@
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPInNode));
break;
}
#line 137 "api_node.c.erb"
- case YP_NODE_INSTANCE_VARIABLE_OPERATOR_AND_WRITE_NODE: {
- yp_instance_variable_operator_and_write_node_t *cast = (yp_instance_variable_operator_and_write_node_t *) node;
- VALUE argv[4];
-
- // name_loc
- argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // location
- argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPInstanceVariableOperatorAndWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
- case YP_NODE_INSTANCE_VARIABLE_OPERATOR_OR_WRITE_NODE: {
- yp_instance_variable_operator_or_write_node_t *cast = (yp_instance_variable_operator_or_write_node_t *) node;
- VALUE argv[4];
-
- // name_loc
- argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // location
- argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPInstanceVariableOperatorOrWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
- case YP_NODE_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: {
- yp_instance_variable_operator_write_node_t *cast = (yp_instance_variable_operator_write_node_t *) node;
- VALUE argv[5];
-
- // name_loc
- argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // operator
- argv[3] = rb_id2sym(constants[cast->operator - 1]);
-
- // location
- argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPInstanceVariableOperatorWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
case YP_NODE_INSTANCE_VARIABLE_READ_NODE: {
VALUE argv[1];
// location
argv[0] = yp_location_new(parser, node->location.start, node->location.end, source);
@@ -2339,11 +1939,11 @@
// opening_loc
argv[0] = yp_location_new(parser, cast->opening_loc.start, cast->opening_loc.end, source);
// parts
- argv[1] = rb_ary_new();
+ argv[1] = rb_ary_new_capa(cast->parts.size);
for (size_t index = 0; index < cast->parts.size; index++) {
rb_ary_push(argv[1], rb_ary_pop(value_stack));
}
// closing_loc
@@ -2365,11 +1965,11 @@
// opening_loc
argv[0] = cast->opening_loc.start == NULL ? Qnil : yp_location_new(parser, cast->opening_loc.start, cast->opening_loc.end, source);
// parts
- argv[1] = rb_ary_new();
+ argv[1] = rb_ary_new_capa(cast->parts.size);
for (size_t index = 0; index < cast->parts.size; index++) {
rb_ary_push(argv[1], rb_ary_pop(value_stack));
}
// closing_loc
@@ -2388,11 +1988,11 @@
// opening_loc
argv[0] = cast->opening_loc.start == NULL ? Qnil : yp_location_new(parser, cast->opening_loc.start, cast->opening_loc.end, source);
// parts
- argv[1] = rb_ary_new();
+ argv[1] = rb_ary_new_capa(cast->parts.size);
for (size_t index = 0; index < cast->parts.size; index++) {
rb_ary_push(argv[1], rb_ary_pop(value_stack));
}
// closing_loc
@@ -2411,11 +2011,11 @@
// opening_loc
argv[0] = yp_location_new(parser, cast->opening_loc.start, cast->opening_loc.end, source);
// parts
- argv[1] = rb_ary_new();
+ argv[1] = rb_ary_new_capa(cast->parts.size);
for (size_t index = 0; index < cast->parts.size; index++) {
rb_ary_push(argv[1], rb_ary_pop(value_stack));
}
// closing_loc
@@ -2431,11 +2031,11 @@
case YP_NODE_KEYWORD_HASH_NODE: {
yp_keyword_hash_node_t *cast = (yp_keyword_hash_node_t *) node;
VALUE argv[2];
// elements
- argv[0] = rb_ary_new();
+ argv[0] = rb_ary_new_capa(cast->elements.size);
for (size_t index = 0; index < cast->elements.size; index++) {
rb_ary_push(argv[0], rb_ary_pop(value_stack));
}
// location
@@ -2482,103 +2082,31 @@
case YP_NODE_LAMBDA_NODE: {
yp_lambda_node_t *cast = (yp_lambda_node_t *) node;
VALUE argv[5];
// locals
- argv[0] = rb_ary_new();
+ argv[0] = rb_ary_new_capa(cast->locals.size);
for (size_t index = 0; index < cast->locals.size; index++) {
rb_ary_push(argv[0], rb_id2sym(constants[cast->locals.ids[index] - 1]));
}
// opening_loc
argv[1] = yp_location_new(parser, cast->opening_loc.start, cast->opening_loc.end, source);
// parameters
argv[2] = rb_ary_pop(value_stack);
- // statements
+ // body
argv[3] = rb_ary_pop(value_stack);
// location
argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPLambdaNode));
break;
}
#line 137 "api_node.c.erb"
- case YP_NODE_LOCAL_VARIABLE_OPERATOR_AND_WRITE_NODE: {
- yp_local_variable_operator_and_write_node_t *cast = (yp_local_variable_operator_and_write_node_t *) node;
- VALUE argv[5];
-
- // name_loc
- argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // constant_id
- argv[3] = rb_id2sym(constants[cast->constant_id - 1]);
-
- // location
- argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPLocalVariableOperatorAndWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
- case YP_NODE_LOCAL_VARIABLE_OPERATOR_OR_WRITE_NODE: {
- yp_local_variable_operator_or_write_node_t *cast = (yp_local_variable_operator_or_write_node_t *) node;
- VALUE argv[5];
-
- // name_loc
- argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // constant_id
- argv[3] = rb_id2sym(constants[cast->constant_id - 1]);
-
- // location
- argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPLocalVariableOperatorOrWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
- case YP_NODE_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: {
- yp_local_variable_operator_write_node_t *cast = (yp_local_variable_operator_write_node_t *) node;
- VALUE argv[6];
-
- // name_loc
- argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
-
- // operator_loc
- argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
-
- // value
- argv[2] = rb_ary_pop(value_stack);
-
- // constant_id
- argv[3] = rb_id2sym(constants[cast->constant_id - 1]);
-
- // operator_id
- argv[4] = rb_id2sym(constants[cast->operator_id - 1]);
-
- // location
- argv[5] = yp_location_new(parser, node->location.start, node->location.end, source);
-
- rb_ary_push(value_stack, rb_class_new_instance(6, argv, rb_cYARPLocalVariableOperatorWriteNode));
- break;
- }
-#line 137 "api_node.c.erb"
case YP_NODE_LOCAL_VARIABLE_READ_NODE: {
yp_local_variable_read_node_t *cast = (yp_local_variable_read_node_t *) node;
VALUE argv[3];
// constant_id
@@ -2673,22 +2201,22 @@
case YP_NODE_MODULE_NODE: {
yp_module_node_t *cast = (yp_module_node_t *) node;
VALUE argv[6];
// locals
- argv[0] = rb_ary_new();
+ argv[0] = rb_ary_new_capa(cast->locals.size);
for (size_t index = 0; index < cast->locals.size; index++) {
rb_ary_push(argv[0], rb_id2sym(constants[cast->locals.ids[index] - 1]));
}
// module_keyword_loc
argv[1] = yp_location_new(parser, cast->module_keyword_loc.start, cast->module_keyword_loc.end, source);
// constant_path
argv[2] = rb_ary_pop(value_stack);
- // statements
+ // body
argv[3] = rb_ary_pop(value_stack);
// end_keyword_loc
argv[4] = yp_location_new(parser, cast->end_keyword_loc.start, cast->end_keyword_loc.end, source);
@@ -2702,11 +2230,11 @@
case YP_NODE_MULTI_WRITE_NODE: {
yp_multi_write_node_t *cast = (yp_multi_write_node_t *) node;
VALUE argv[6];
// targets
- argv[0] = rb_ary_new();
+ argv[0] = rb_ary_new_capa(cast->targets.size);
for (size_t index = 0; index < cast->targets.size; index++) {
rb_ary_push(argv[0], rb_ary_pop(value_stack));
}
// operator_loc
@@ -2780,10 +2308,33 @@
rb_ary_push(value_stack, rb_class_new_instance(1, argv, rb_cYARPNumberedReferenceReadNode));
break;
}
#line 137 "api_node.c.erb"
+ case YP_NODE_OPERATOR_WRITE_NODE: {
+ yp_operator_write_node_t *cast = (yp_operator_write_node_t *) node;
+ VALUE argv[5];
+
+ // target
+ argv[0] = rb_ary_pop(value_stack);
+
+ // operator_loc
+ argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
+
+ // operator
+ argv[2] = rb_id2sym(constants[cast->operator - 1]);
+
+ // value
+ argv[3] = rb_ary_pop(value_stack);
+
+ // location
+ argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
+
+ rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPOperatorWriteNode));
+ break;
+ }
+#line 137 "api_node.c.erb"
case YP_NODE_OPTIONAL_PARAMETER_NODE: {
yp_optional_parameter_node_t *cast = (yp_optional_parameter_node_t *) node;
VALUE argv[5];
// constant_id
@@ -2823,37 +2374,57 @@
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPOrNode));
break;
}
#line 137 "api_node.c.erb"
+ case YP_NODE_OR_WRITE_NODE: {
+ yp_or_write_node_t *cast = (yp_or_write_node_t *) node;
+ VALUE argv[4];
+
+ // target
+ argv[0] = rb_ary_pop(value_stack);
+
+ // value
+ argv[1] = rb_ary_pop(value_stack);
+
+ // operator_loc
+ argv[2] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
+
+ // location
+ argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
+
+ rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPOrWriteNode));
+ break;
+ }
+#line 137 "api_node.c.erb"
case YP_NODE_PARAMETERS_NODE: {
yp_parameters_node_t *cast = (yp_parameters_node_t *) node;
VALUE argv[8];
// requireds
- argv[0] = rb_ary_new();
+ argv[0] = rb_ary_new_capa(cast->requireds.size);
for (size_t index = 0; index < cast->requireds.size; index++) {
rb_ary_push(argv[0], rb_ary_pop(value_stack));
}
// optionals
- argv[1] = rb_ary_new();
+ argv[1] = rb_ary_new_capa(cast->optionals.size);
for (size_t index = 0; index < cast->optionals.size; index++) {
rb_ary_push(argv[1], rb_ary_pop(value_stack));
}
// posts
- argv[2] = rb_ary_new();
+ argv[2] = rb_ary_new_capa(cast->posts.size);
for (size_t index = 0; index < cast->posts.size; index++) {
rb_ary_push(argv[2], rb_ary_pop(value_stack));
}
// rest
argv[3] = rb_ary_pop(value_stack);
// keywords
- argv[4] = rb_ary_new();
+ argv[4] = rb_ary_new_capa(cast->keywords.size);
for (size_t index = 0; index < cast->keywords.size; index++) {
rb_ary_push(argv[4], rb_ary_pop(value_stack));
}
// keyword_rest
@@ -2871,11 +2442,11 @@
#line 137 "api_node.c.erb"
case YP_NODE_PARENTHESES_NODE: {
yp_parentheses_node_t *cast = (yp_parentheses_node_t *) node;
VALUE argv[4];
- // statements
+ // body
argv[0] = rb_ary_pop(value_stack);
// opening_loc
argv[1] = yp_location_new(parser, cast->opening_loc.start, cast->opening_loc.end, source);
@@ -2978,11 +2549,11 @@
case YP_NODE_PROGRAM_NODE: {
yp_program_node_t *cast = (yp_program_node_t *) node;
VALUE argv[3];
// locals
- argv[0] = rb_ary_new();
+ argv[0] = rb_ary_new_capa(cast->locals.size);
for (size_t index = 0; index < cast->locals.size; index++) {
rb_ary_push(argv[0], rb_id2sym(constants[cast->locals.ids[index] - 1]));
}
// statements
@@ -3070,11 +2641,11 @@
case YP_NODE_REQUIRED_DESTRUCTURED_PARAMETER_NODE: {
yp_required_destructured_parameter_node_t *cast = (yp_required_destructured_parameter_node_t *) node;
VALUE argv[4];
// parameters
- argv[0] = rb_ary_new();
+ argv[0] = rb_ary_new_capa(cast->parameters.size);
for (size_t index = 0; index < cast->parameters.size; index++) {
rb_ary_push(argv[0], rb_ary_pop(value_stack));
}
// opening_loc
@@ -3130,11 +2701,11 @@
// keyword_loc
argv[0] = yp_location_new(parser, cast->keyword_loc.start, cast->keyword_loc.end, source);
// exceptions
- argv[1] = rb_ary_new();
+ argv[1] = rb_ary_new_capa(cast->exceptions.size);
for (size_t index = 0; index < cast->exceptions.size; index++) {
rb_ary_push(argv[1], rb_ary_pop(value_stack));
}
// operator_loc
@@ -3213,11 +2784,11 @@
case YP_NODE_SINGLETON_CLASS_NODE: {
yp_singleton_class_node_t *cast = (yp_singleton_class_node_t *) node;
VALUE argv[7];
// locals
- argv[0] = rb_ary_new();
+ argv[0] = rb_ary_new_capa(cast->locals.size);
for (size_t index = 0; index < cast->locals.size; index++) {
rb_ary_push(argv[0], rb_id2sym(constants[cast->locals.ids[index] - 1]));
}
// class_keyword_loc
@@ -3227,11 +2798,11 @@
argv[2] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
// expression
argv[3] = rb_ary_pop(value_stack);
- // statements
+ // body
argv[4] = rb_ary_pop(value_stack);
// end_keyword_loc
argv[5] = yp_location_new(parser, cast->end_keyword_loc.start, cast->end_keyword_loc.end, source);
@@ -3296,11 +2867,11 @@
case YP_NODE_STATEMENTS_NODE: {
yp_statements_node_t *cast = (yp_statements_node_t *) node;
VALUE argv[2];
// body
- argv[0] = rb_ary_new();
+ argv[0] = rb_ary_new_capa(cast->body.size);
for (size_t index = 0; index < cast->body.size; index++) {
rb_ary_push(argv[0], rb_ary_pop(value_stack));
}
// location
@@ -3411,11 +2982,11 @@
case YP_NODE_UNDEF_NODE: {
yp_undef_node_t *cast = (yp_undef_node_t *) node;
VALUE argv[3];
// names
- argv[0] = rb_ary_new();
+ argv[0] = rb_ary_new_capa(cast->names.size);
for (size_t index = 0; index < cast->names.size; index++) {
rb_ary_push(argv[0], rb_ary_pop(value_stack));
}
// keyword_loc
@@ -3483,11 +3054,11 @@
// keyword_loc
argv[0] = yp_location_new(parser, cast->keyword_loc.start, cast->keyword_loc.end, source);
// conditions
- argv[1] = rb_ary_new();
+ argv[1] = rb_ary_new_capa(cast->conditions.size);
for (size_t index = 0; index < cast->conditions.size; index++) {
rb_ary_push(argv[1], rb_ary_pop(value_stack));
}
// statements
@@ -3582,10 +3153,11 @@
void
Init_yarp_api_node(void) {
rb_cYARPAliasNode = rb_define_class_under(rb_cYARP, "AliasNode", rb_cYARPNode);
rb_cYARPAlternationPatternNode = rb_define_class_under(rb_cYARP, "AlternationPatternNode", rb_cYARPNode);
rb_cYARPAndNode = rb_define_class_under(rb_cYARP, "AndNode", rb_cYARPNode);
+ rb_cYARPAndWriteNode = rb_define_class_under(rb_cYARP, "AndWriteNode", rb_cYARPNode);
rb_cYARPArgumentsNode = rb_define_class_under(rb_cYARP, "ArgumentsNode", rb_cYARPNode);
rb_cYARPArrayNode = rb_define_class_under(rb_cYARP, "ArrayNode", rb_cYARPNode);
rb_cYARPArrayPatternNode = rb_define_class_under(rb_cYARP, "ArrayPatternNode", rb_cYARPNode);
rb_cYARPAssocNode = rb_define_class_under(rb_cYARP, "AssocNode", rb_cYARPNode);
rb_cYARPAssocSplatNode = rb_define_class_under(rb_cYARP, "AssocSplatNode", rb_cYARPNode);
@@ -3601,22 +3173,13 @@
rb_cYARPCallOperatorOrWriteNode = rb_define_class_under(rb_cYARP, "CallOperatorOrWriteNode", rb_cYARPNode);
rb_cYARPCallOperatorWriteNode = rb_define_class_under(rb_cYARP, "CallOperatorWriteNode", rb_cYARPNode);
rb_cYARPCapturePatternNode = rb_define_class_under(rb_cYARP, "CapturePatternNode", rb_cYARPNode);
rb_cYARPCaseNode = rb_define_class_under(rb_cYARP, "CaseNode", rb_cYARPNode);
rb_cYARPClassNode = rb_define_class_under(rb_cYARP, "ClassNode", rb_cYARPNode);
- rb_cYARPClassVariableOperatorAndWriteNode = rb_define_class_under(rb_cYARP, "ClassVariableOperatorAndWriteNode", rb_cYARPNode);
- rb_cYARPClassVariableOperatorOrWriteNode = rb_define_class_under(rb_cYARP, "ClassVariableOperatorOrWriteNode", rb_cYARPNode);
- rb_cYARPClassVariableOperatorWriteNode = rb_define_class_under(rb_cYARP, "ClassVariableOperatorWriteNode", rb_cYARPNode);
rb_cYARPClassVariableReadNode = rb_define_class_under(rb_cYARP, "ClassVariableReadNode", rb_cYARPNode);
rb_cYARPClassVariableWriteNode = rb_define_class_under(rb_cYARP, "ClassVariableWriteNode", rb_cYARPNode);
- rb_cYARPConstantOperatorAndWriteNode = rb_define_class_under(rb_cYARP, "ConstantOperatorAndWriteNode", rb_cYARPNode);
- rb_cYARPConstantOperatorOrWriteNode = rb_define_class_under(rb_cYARP, "ConstantOperatorOrWriteNode", rb_cYARPNode);
- rb_cYARPConstantOperatorWriteNode = rb_define_class_under(rb_cYARP, "ConstantOperatorWriteNode", rb_cYARPNode);
rb_cYARPConstantPathNode = rb_define_class_under(rb_cYARP, "ConstantPathNode", rb_cYARPNode);
- rb_cYARPConstantPathOperatorAndWriteNode = rb_define_class_under(rb_cYARP, "ConstantPathOperatorAndWriteNode", rb_cYARPNode);
- rb_cYARPConstantPathOperatorOrWriteNode = rb_define_class_under(rb_cYARP, "ConstantPathOperatorOrWriteNode", rb_cYARPNode);
- rb_cYARPConstantPathOperatorWriteNode = rb_define_class_under(rb_cYARP, "ConstantPathOperatorWriteNode", rb_cYARPNode);
rb_cYARPConstantPathWriteNode = rb_define_class_under(rb_cYARP, "ConstantPathWriteNode", rb_cYARPNode);
rb_cYARPConstantReadNode = rb_define_class_under(rb_cYARP, "ConstantReadNode", rb_cYARPNode);
rb_cYARPConstantWriteNode = rb_define_class_under(rb_cYARP, "ConstantWriteNode", rb_cYARPNode);
rb_cYARPDefNode = rb_define_class_under(rb_cYARP, "DefNode", rb_cYARPNode);
rb_cYARPDefinedNode = rb_define_class_under(rb_cYARP, "DefinedNode", rb_cYARPNode);
@@ -3630,23 +3193,17 @@
rb_cYARPFloatNode = rb_define_class_under(rb_cYARP, "FloatNode", rb_cYARPNode);
rb_cYARPForNode = rb_define_class_under(rb_cYARP, "ForNode", rb_cYARPNode);
rb_cYARPForwardingArgumentsNode = rb_define_class_under(rb_cYARP, "ForwardingArgumentsNode", rb_cYARPNode);
rb_cYARPForwardingParameterNode = rb_define_class_under(rb_cYARP, "ForwardingParameterNode", rb_cYARPNode);
rb_cYARPForwardingSuperNode = rb_define_class_under(rb_cYARP, "ForwardingSuperNode", rb_cYARPNode);
- rb_cYARPGlobalVariableOperatorAndWriteNode = rb_define_class_under(rb_cYARP, "GlobalVariableOperatorAndWriteNode", rb_cYARPNode);
- rb_cYARPGlobalVariableOperatorOrWriteNode = rb_define_class_under(rb_cYARP, "GlobalVariableOperatorOrWriteNode", rb_cYARPNode);
- rb_cYARPGlobalVariableOperatorWriteNode = rb_define_class_under(rb_cYARP, "GlobalVariableOperatorWriteNode", rb_cYARPNode);
rb_cYARPGlobalVariableReadNode = rb_define_class_under(rb_cYARP, "GlobalVariableReadNode", rb_cYARPNode);
rb_cYARPGlobalVariableWriteNode = rb_define_class_under(rb_cYARP, "GlobalVariableWriteNode", rb_cYARPNode);
rb_cYARPHashNode = rb_define_class_under(rb_cYARP, "HashNode", rb_cYARPNode);
rb_cYARPHashPatternNode = rb_define_class_under(rb_cYARP, "HashPatternNode", rb_cYARPNode);
rb_cYARPIfNode = rb_define_class_under(rb_cYARP, "IfNode", rb_cYARPNode);
rb_cYARPImaginaryNode = rb_define_class_under(rb_cYARP, "ImaginaryNode", rb_cYARPNode);
rb_cYARPInNode = rb_define_class_under(rb_cYARP, "InNode", rb_cYARPNode);
- rb_cYARPInstanceVariableOperatorAndWriteNode = rb_define_class_under(rb_cYARP, "InstanceVariableOperatorAndWriteNode", rb_cYARPNode);
- rb_cYARPInstanceVariableOperatorOrWriteNode = rb_define_class_under(rb_cYARP, "InstanceVariableOperatorOrWriteNode", rb_cYARPNode);
- rb_cYARPInstanceVariableOperatorWriteNode = rb_define_class_under(rb_cYARP, "InstanceVariableOperatorWriteNode", rb_cYARPNode);
rb_cYARPInstanceVariableReadNode = rb_define_class_under(rb_cYARP, "InstanceVariableReadNode", rb_cYARPNode);
rb_cYARPInstanceVariableWriteNode = rb_define_class_under(rb_cYARP, "InstanceVariableWriteNode", rb_cYARPNode);
rb_cYARPIntegerNode = rb_define_class_under(rb_cYARP, "IntegerNode", rb_cYARPNode);
rb_cYARPInterpolatedRegularExpressionNode = rb_define_class_under(rb_cYARP, "InterpolatedRegularExpressionNode", rb_cYARPNode);
rb_cYARPInterpolatedStringNode = rb_define_class_under(rb_cYARP, "InterpolatedStringNode", rb_cYARPNode);
@@ -3654,13 +3211,10 @@
rb_cYARPInterpolatedXStringNode = rb_define_class_under(rb_cYARP, "InterpolatedXStringNode", rb_cYARPNode);
rb_cYARPKeywordHashNode = rb_define_class_under(rb_cYARP, "KeywordHashNode", rb_cYARPNode);
rb_cYARPKeywordParameterNode = rb_define_class_under(rb_cYARP, "KeywordParameterNode", rb_cYARPNode);
rb_cYARPKeywordRestParameterNode = rb_define_class_under(rb_cYARP, "KeywordRestParameterNode", rb_cYARPNode);
rb_cYARPLambdaNode = rb_define_class_under(rb_cYARP, "LambdaNode", rb_cYARPNode);
- rb_cYARPLocalVariableOperatorAndWriteNode = rb_define_class_under(rb_cYARP, "LocalVariableOperatorAndWriteNode", rb_cYARPNode);
- rb_cYARPLocalVariableOperatorOrWriteNode = rb_define_class_under(rb_cYARP, "LocalVariableOperatorOrWriteNode", rb_cYARPNode);
- rb_cYARPLocalVariableOperatorWriteNode = rb_define_class_under(rb_cYARP, "LocalVariableOperatorWriteNode", rb_cYARPNode);
rb_cYARPLocalVariableReadNode = rb_define_class_under(rb_cYARP, "LocalVariableReadNode", rb_cYARPNode);
rb_cYARPLocalVariableWriteNode = rb_define_class_under(rb_cYARP, "LocalVariableWriteNode", rb_cYARPNode);
rb_cYARPMatchPredicateNode = rb_define_class_under(rb_cYARP, "MatchPredicateNode", rb_cYARPNode);
rb_cYARPMatchRequiredNode = rb_define_class_under(rb_cYARP, "MatchRequiredNode", rb_cYARPNode);
rb_cYARPMissingNode = rb_define_class_under(rb_cYARP, "MissingNode", rb_cYARPNode);
@@ -3668,11 +3222,13 @@
rb_cYARPMultiWriteNode = rb_define_class_under(rb_cYARP, "MultiWriteNode", rb_cYARPNode);
rb_cYARPNextNode = rb_define_class_under(rb_cYARP, "NextNode", rb_cYARPNode);
rb_cYARPNilNode = rb_define_class_under(rb_cYARP, "NilNode", rb_cYARPNode);
rb_cYARPNoKeywordsParameterNode = rb_define_class_under(rb_cYARP, "NoKeywordsParameterNode", rb_cYARPNode);
rb_cYARPNumberedReferenceReadNode = rb_define_class_under(rb_cYARP, "NumberedReferenceReadNode", rb_cYARPNode);
+ rb_cYARPOperatorWriteNode = rb_define_class_under(rb_cYARP, "OperatorWriteNode", rb_cYARPNode);
rb_cYARPOptionalParameterNode = rb_define_class_under(rb_cYARP, "OptionalParameterNode", rb_cYARPNode);
rb_cYARPOrNode = rb_define_class_under(rb_cYARP, "OrNode", rb_cYARPNode);
+ rb_cYARPOrWriteNode = rb_define_class_under(rb_cYARP, "OrWriteNode", rb_cYARPNode);
rb_cYARPParametersNode = rb_define_class_under(rb_cYARP, "ParametersNode", rb_cYARPNode);
rb_cYARPParenthesesNode = rb_define_class_under(rb_cYARP, "ParenthesesNode", rb_cYARPNode);
rb_cYARPPinnedExpressionNode = rb_define_class_under(rb_cYARP, "PinnedExpressionNode", rb_cYARPNode);
rb_cYARPPinnedVariableNode = rb_define_class_under(rb_cYARP, "PinnedVariableNode", rb_cYARPNode);
rb_cYARPPostExecutionNode = rb_define_class_under(rb_cYARP, "PostExecutionNode", rb_cYARPNode);