rbs 3.9.2 → 4.0.0.dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/.github/workflows/windows.yml +1 -1
- data/CHANGELOG.md +0 -13
- data/Rakefile +28 -21
- data/Steepfile +1 -0
- data/config.yml +232 -62
- data/ext/rbs_extension/ast_translation.c +1149 -0
- data/ext/rbs_extension/ast_translation.h +30 -0
- data/{src/constants.c → ext/rbs_extension/class_constants.c} +15 -1
- data/{include/rbs/constants.h → ext/rbs_extension/class_constants.h} +10 -1
- data/ext/rbs_extension/extconf.rb +3 -1
- data/ext/rbs_extension/{location.c → legacy_location.c} +25 -34
- data/ext/rbs_extension/legacy_location.h +40 -0
- data/ext/rbs_extension/main.c +402 -8
- data/ext/rbs_extension/rbs_extension.h +3 -21
- data/ext/rbs_extension/rbs_string_bridging.c +9 -0
- data/ext/rbs_extension/rbs_string_bridging.h +20 -0
- data/include/rbs/ast.h +748 -0
- data/include/rbs/defines.h +60 -0
- data/{ext/rbs_extension → include/rbs}/lexer.h +40 -32
- data/include/rbs/location.h +59 -0
- data/include/rbs/parser.h +151 -0
- data/include/rbs/string.h +49 -0
- data/include/rbs/util/rbs_allocator.h +38 -0
- data/include/rbs/util/rbs_assert.h +9 -0
- data/include/rbs/util/rbs_buffer.h +83 -0
- data/include/rbs/util/rbs_constant_pool.h +3 -64
- data/include/rbs/util/rbs_encoding.h +280 -0
- data/include/rbs/util/rbs_unescape.h +23 -0
- data/include/rbs.h +1 -2
- data/lib/rbs/annotate/formatter.rb +3 -13
- data/lib/rbs/annotate/rdoc_annotator.rb +3 -1
- data/lib/rbs/annotate/rdoc_source.rb +1 -1
- data/lib/rbs/ast/ruby/annotations.rb +119 -0
- data/lib/rbs/ast/ruby/comment_block.rb +221 -0
- data/lib/rbs/ast/ruby/declarations.rb +86 -0
- data/lib/rbs/ast/ruby/helpers/constant_helper.rb +24 -0
- data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
- data/lib/rbs/ast/ruby/members.rb +213 -0
- data/lib/rbs/buffer.rb +104 -24
- data/lib/rbs/cli/validate.rb +39 -34
- data/lib/rbs/cli.rb +4 -5
- data/lib/rbs/definition.rb +6 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +63 -60
- data/lib/rbs/definition_builder/method_builder.rb +45 -30
- data/lib/rbs/definition_builder.rb +44 -9
- data/lib/rbs/environment/class_entry.rb +69 -0
- data/lib/rbs/environment/module_entry.rb +66 -0
- data/lib/rbs/environment.rb +185 -154
- data/lib/rbs/environment_loader.rb +2 -2
- data/lib/rbs/errors.rb +4 -3
- data/lib/rbs/inline_parser/comment_association.rb +117 -0
- data/lib/rbs/inline_parser.rb +206 -0
- data/lib/rbs/location_aux.rb +35 -3
- data/lib/rbs/parser_aux.rb +11 -1
- data/lib/rbs/prototype/runtime.rb +2 -2
- data/lib/rbs/source.rb +99 -0
- data/lib/rbs/subtractor.rb +4 -3
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +12 -0
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +2 -2
- data/rbs.gemspec +1 -0
- data/sig/ancestor_builder.rbs +1 -1
- data/sig/annotate/formatter.rbs +2 -2
- data/sig/annotate/rdoc_annotater.rbs +1 -1
- data/sig/ast/ruby/annotations.rbs +110 -0
- data/sig/ast/ruby/comment_block.rbs +119 -0
- data/sig/ast/ruby/declarations.rbs +60 -0
- data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
- data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
- data/sig/ast/ruby/members.rbs +72 -0
- data/sig/buffer.rbs +63 -5
- data/sig/definition.rbs +1 -0
- data/sig/definition_builder.rbs +1 -1
- data/sig/environment/class_entry.rbs +50 -0
- data/sig/environment/module_entry.rbs +50 -0
- data/sig/environment.rbs +22 -76
- data/sig/errors.rbs +13 -6
- data/sig/inline_parser/comment_association.rbs +71 -0
- data/sig/inline_parser.rbs +87 -0
- data/sig/location.rbs +32 -7
- data/sig/method_builder.rbs +7 -4
- data/sig/parser.rbs +16 -0
- data/sig/source.rbs +48 -0
- data/src/ast.c +1345 -0
- data/src/lexer.c +2867 -0
- data/src/lexer.re +151 -0
- data/{ext/rbs_extension → src}/lexstate.c +58 -42
- data/src/location.c +71 -0
- data/src/parser.c +3739 -0
- data/src/string.c +89 -0
- data/src/util/rbs_allocator.c +149 -0
- data/src/util/rbs_assert.c +19 -0
- data/src/util/rbs_buffer.c +54 -0
- data/src/util/rbs_constant_pool.c +13 -81
- data/src/util/rbs_encoding.c +5273 -0
- data/src/util/rbs_unescape.c +130 -0
- data/stdlib/rdoc/0/code_object.rbs +2 -2
- data/stdlib/rdoc/0/comment.rbs +2 -0
- data/stdlib/rdoc/0/options.rbs +76 -0
- data/stdlib/rdoc/0/rdoc.rbs +6 -4
- data/stdlib/rdoc/0/store.rbs +1 -1
- metadata +70 -17
- data/ext/rbs_extension/lexer.c +0 -2728
- data/ext/rbs_extension/lexer.re +0 -147
- data/ext/rbs_extension/location.h +0 -85
- data/ext/rbs_extension/parser.c +0 -2982
- data/ext/rbs_extension/parser.h +0 -18
- data/ext/rbs_extension/parserstate.c +0 -411
- data/ext/rbs_extension/parserstate.h +0 -163
- data/ext/rbs_extension/unescape.c +0 -32
- data/include/rbs/ruby_objs.h +0 -72
- data/src/ruby_objs.c +0 -799
data/src/ast.c
ADDED
@@ -0,0 +1,1345 @@
|
|
1
|
+
/*----------------------------------------------------------------------------*/
|
2
|
+
/* This file is generated by the templates/template.rb script and should not */
|
3
|
+
/* be modified manually. */
|
4
|
+
/* To change the template see */
|
5
|
+
/* templates/src/ast.c.erb */
|
6
|
+
/*----------------------------------------------------------------------------*/
|
7
|
+
|
8
|
+
#line 2 "prism/templates/src/ast.c.erb"
|
9
|
+
#include "rbs/ast.h"
|
10
|
+
|
11
|
+
#include <stdio.h>
|
12
|
+
#include <stdlib.h>
|
13
|
+
|
14
|
+
const char* rbs_node_type_name(rbs_node_t *node) {
|
15
|
+
switch (node->type) {
|
16
|
+
case RBS_AST_ANNOTATION: return "RBS::AST::Annotation";
|
17
|
+
case RBS_AST_BOOL: return "RBS::AST::Bool";
|
18
|
+
case RBS_AST_COMMENT: return "RBS::AST::Comment";
|
19
|
+
case RBS_AST_DECLARATIONS_CLASS: return "RBS::AST::Declarations::Class";
|
20
|
+
case RBS_AST_DECLARATIONS_CLASS_SUPER: return "RBS::AST::Declarations::Class::Super";
|
21
|
+
case RBS_AST_DECLARATIONS_CLASS_ALIAS: return "RBS::AST::Declarations::ClassAlias";
|
22
|
+
case RBS_AST_DECLARATIONS_CONSTANT: return "RBS::AST::Declarations::Constant";
|
23
|
+
case RBS_AST_DECLARATIONS_GLOBAL: return "RBS::AST::Declarations::Global";
|
24
|
+
case RBS_AST_DECLARATIONS_INTERFACE: return "RBS::AST::Declarations::Interface";
|
25
|
+
case RBS_AST_DECLARATIONS_MODULE: return "RBS::AST::Declarations::Module";
|
26
|
+
case RBS_AST_DECLARATIONS_MODULE_SELF: return "RBS::AST::Declarations::Module::Self";
|
27
|
+
case RBS_AST_DECLARATIONS_MODULE_ALIAS: return "RBS::AST::Declarations::ModuleAlias";
|
28
|
+
case RBS_AST_DECLARATIONS_TYPE_ALIAS: return "RBS::AST::Declarations::TypeAlias";
|
29
|
+
case RBS_AST_DIRECTIVES_USE: return "RBS::AST::Directives::Use";
|
30
|
+
case RBS_AST_DIRECTIVES_USE_SINGLE_CLAUSE: return "RBS::AST::Directives::Use::SingleClause";
|
31
|
+
case RBS_AST_DIRECTIVES_USE_WILDCARD_CLAUSE: return "RBS::AST::Directives::Use::WildcardClause";
|
32
|
+
case RBS_AST_INTEGER: return "RBS::AST::Integer";
|
33
|
+
case RBS_AST_MEMBERS_ALIAS: return "RBS::AST::Members::Alias";
|
34
|
+
case RBS_AST_MEMBERS_ATTR_ACCESSOR: return "RBS::AST::Members::AttrAccessor";
|
35
|
+
case RBS_AST_MEMBERS_ATTR_READER: return "RBS::AST::Members::AttrReader";
|
36
|
+
case RBS_AST_MEMBERS_ATTR_WRITER: return "RBS::AST::Members::AttrWriter";
|
37
|
+
case RBS_AST_MEMBERS_CLASS_INSTANCE_VARIABLE: return "RBS::AST::Members::ClassInstanceVariable";
|
38
|
+
case RBS_AST_MEMBERS_CLASS_VARIABLE: return "RBS::AST::Members::ClassVariable";
|
39
|
+
case RBS_AST_MEMBERS_EXTEND: return "RBS::AST::Members::Extend";
|
40
|
+
case RBS_AST_MEMBERS_INCLUDE: return "RBS::AST::Members::Include";
|
41
|
+
case RBS_AST_MEMBERS_INSTANCE_VARIABLE: return "RBS::AST::Members::InstanceVariable";
|
42
|
+
case RBS_AST_MEMBERS_METHOD_DEFINITION: return "RBS::AST::Members::MethodDefinition";
|
43
|
+
case RBS_AST_MEMBERS_METHOD_DEFINITION_OVERLOAD: return "RBS::AST::Members::MethodDefinition::Overload";
|
44
|
+
case RBS_AST_MEMBERS_PREPEND: return "RBS::AST::Members::Prepend";
|
45
|
+
case RBS_AST_MEMBERS_PRIVATE: return "RBS::AST::Members::Private";
|
46
|
+
case RBS_AST_MEMBERS_PUBLIC: return "RBS::AST::Members::Public";
|
47
|
+
case RBS_AST_RUBY_ANNOTATIONS_COLON_METHOD_TYPE_ANNOTATION: return "RBS::AST::Ruby::Annotations::ColonMethodTypeAnnotation";
|
48
|
+
case RBS_AST_RUBY_ANNOTATIONS_METHOD_TYPES_ANNOTATION: return "RBS::AST::Ruby::Annotations::MethodTypesAnnotation";
|
49
|
+
case RBS_AST_RUBY_ANNOTATIONS_NODE_TYPE_ASSERTION: return "RBS::AST::Ruby::Annotations::NodeTypeAssertion";
|
50
|
+
case RBS_AST_RUBY_ANNOTATIONS_RETURN_TYPE_ANNOTATION: return "RBS::AST::Ruby::Annotations::ReturnTypeAnnotation";
|
51
|
+
case RBS_AST_RUBY_ANNOTATIONS_SKIP_ANNOTATION: return "RBS::AST::Ruby::Annotations::SkipAnnotation";
|
52
|
+
case RBS_AST_STRING: return "RBS::AST::String";
|
53
|
+
case RBS_AST_TYPE_PARAM: return "RBS::AST::TypeParam";
|
54
|
+
case RBS_METHOD_TYPE: return "RBS::MethodType";
|
55
|
+
case RBS_NAMESPACE: return "RBS::Namespace";
|
56
|
+
case RBS_SIGNATURE: return "RBS::Signature";
|
57
|
+
case RBS_TYPE_NAME: return "RBS::TypeName";
|
58
|
+
case RBS_TYPES_ALIAS: return "RBS::Types::Alias";
|
59
|
+
case RBS_TYPES_BASES_ANY: return "RBS::Types::Bases::Any";
|
60
|
+
case RBS_TYPES_BASES_BOOL: return "RBS::Types::Bases::Bool";
|
61
|
+
case RBS_TYPES_BASES_BOTTOM: return "RBS::Types::Bases::Bottom";
|
62
|
+
case RBS_TYPES_BASES_CLASS: return "RBS::Types::Bases::Class";
|
63
|
+
case RBS_TYPES_BASES_INSTANCE: return "RBS::Types::Bases::Instance";
|
64
|
+
case RBS_TYPES_BASES_NIL: return "RBS::Types::Bases::Nil";
|
65
|
+
case RBS_TYPES_BASES_SELF: return "RBS::Types::Bases::Self";
|
66
|
+
case RBS_TYPES_BASES_TOP: return "RBS::Types::Bases::Top";
|
67
|
+
case RBS_TYPES_BASES_VOID: return "RBS::Types::Bases::Void";
|
68
|
+
case RBS_TYPES_BLOCK: return "RBS::Types::Block";
|
69
|
+
case RBS_TYPES_CLASS_INSTANCE: return "RBS::Types::ClassInstance";
|
70
|
+
case RBS_TYPES_CLASS_SINGLETON: return "RBS::Types::ClassSingleton";
|
71
|
+
case RBS_TYPES_FUNCTION: return "RBS::Types::Function";
|
72
|
+
case RBS_TYPES_FUNCTION_PARAM: return "RBS::Types::Function::Param";
|
73
|
+
case RBS_TYPES_INTERFACE: return "RBS::Types::Interface";
|
74
|
+
case RBS_TYPES_INTERSECTION: return "RBS::Types::Intersection";
|
75
|
+
case RBS_TYPES_LITERAL: return "RBS::Types::Literal";
|
76
|
+
case RBS_TYPES_OPTIONAL: return "RBS::Types::Optional";
|
77
|
+
case RBS_TYPES_PROC: return "RBS::Types::Proc";
|
78
|
+
case RBS_TYPES_RECORD: return "RBS::Types::Record";
|
79
|
+
case RBS_TYPES_RECORD_FIELD_TYPE: return "RBS::Types::Record::FieldType";
|
80
|
+
case RBS_TYPES_TUPLE: return "RBS::Types::Tuple";
|
81
|
+
case RBS_TYPES_UNION: return "RBS::Types::Union";
|
82
|
+
case RBS_TYPES_UNTYPED_FUNCTION: return "RBS::Types::UntypedFunction";
|
83
|
+
case RBS_TYPES_VARIABLE: return "RBS::Types::Variable";
|
84
|
+
case RBS_AST_SYMBOL: return "Symbol";
|
85
|
+
default: return "Unknown";
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
/* rbs_node_list */
|
90
|
+
|
91
|
+
rbs_node_list_t* rbs_node_list_new(rbs_allocator_t *allocator) {
|
92
|
+
rbs_node_list_t *list = rbs_allocator_alloc(allocator, rbs_node_list_t);
|
93
|
+
*list = (rbs_node_list_t) {
|
94
|
+
.allocator = allocator,
|
95
|
+
.head = NULL,
|
96
|
+
.tail = NULL,
|
97
|
+
.length = 0,
|
98
|
+
};
|
99
|
+
|
100
|
+
return list;
|
101
|
+
}
|
102
|
+
|
103
|
+
void rbs_node_list_append(rbs_node_list_t *list, rbs_node_t *node) {
|
104
|
+
rbs_node_list_node_t *new_node = rbs_allocator_alloc(list->allocator, rbs_node_list_node_t);
|
105
|
+
*new_node = (rbs_node_list_node_t) {
|
106
|
+
.node = node,
|
107
|
+
.next = NULL,
|
108
|
+
};
|
109
|
+
|
110
|
+
if (list->tail == NULL) {
|
111
|
+
list->head = new_node;
|
112
|
+
list->tail = new_node;
|
113
|
+
} else {
|
114
|
+
list->tail->next = new_node;
|
115
|
+
list->tail = new_node;
|
116
|
+
}
|
117
|
+
|
118
|
+
list->length++;
|
119
|
+
}
|
120
|
+
|
121
|
+
/* rbs_hash */
|
122
|
+
|
123
|
+
rbs_hash_t* rbs_hash_new(rbs_allocator_t *allocator) {
|
124
|
+
rbs_hash_t *hash = rbs_allocator_alloc(allocator, rbs_hash_t);
|
125
|
+
*hash = (rbs_hash_t) {
|
126
|
+
.allocator = allocator,
|
127
|
+
.head = NULL,
|
128
|
+
.tail = NULL,
|
129
|
+
.length = 0,
|
130
|
+
};
|
131
|
+
|
132
|
+
return hash;
|
133
|
+
}
|
134
|
+
|
135
|
+
bool rbs_node_equal(rbs_node_t *lhs, rbs_node_t *rhs) {
|
136
|
+
if (lhs == rhs) return true;
|
137
|
+
if (lhs->type != rhs->type) return false;
|
138
|
+
|
139
|
+
switch (lhs->type) {
|
140
|
+
case RBS_AST_SYMBOL:
|
141
|
+
return ((rbs_ast_symbol_t *)lhs)->constant_id == ((rbs_ast_symbol_t *) rhs)->constant_id;
|
142
|
+
case RBS_KEYWORD:
|
143
|
+
return ((rbs_keyword_t *)lhs)->constant_id == ((rbs_keyword_t *) rhs)->constant_id;
|
144
|
+
case RBS_AST_BOOL:
|
145
|
+
return ((rbs_ast_bool_t *)lhs)->value == ((rbs_ast_bool_t *) rhs)->value;
|
146
|
+
case RBS_AST_INTEGER:
|
147
|
+
return rbs_string_equal(((rbs_ast_integer_t *) lhs)->string_representation, ((rbs_ast_integer_t *) rhs)->string_representation);
|
148
|
+
case RBS_AST_STRING:
|
149
|
+
return rbs_string_equal(((rbs_ast_string_t *) lhs)->string, ((rbs_ast_string_t *) rhs)->string);
|
150
|
+
default:
|
151
|
+
printf("Unhandled node type: %d\n", lhs->type);
|
152
|
+
return false;
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
rbs_hash_node_t* rbs_hash_find(rbs_hash_t *hash, rbs_node_t *key) {
|
157
|
+
rbs_hash_node_t *current = hash->head;
|
158
|
+
|
159
|
+
while (current != NULL) {
|
160
|
+
if (rbs_node_equal(key, current->key)) {
|
161
|
+
return current;
|
162
|
+
}
|
163
|
+
current = current->next;
|
164
|
+
}
|
165
|
+
|
166
|
+
return NULL;
|
167
|
+
}
|
168
|
+
|
169
|
+
void rbs_hash_set(rbs_hash_t *hash, rbs_node_t *key, rbs_node_t *value) {
|
170
|
+
rbs_hash_node_t *existing_node = rbs_hash_find(hash, key);
|
171
|
+
if (existing_node != NULL) {
|
172
|
+
existing_node->value = value;
|
173
|
+
return;
|
174
|
+
}
|
175
|
+
|
176
|
+
rbs_hash_node_t *new_node = rbs_allocator_alloc(hash->allocator, rbs_hash_node_t);
|
177
|
+
new_node->key = key;
|
178
|
+
new_node->value = value;
|
179
|
+
new_node->next = NULL;
|
180
|
+
|
181
|
+
if (hash->tail == NULL) {
|
182
|
+
hash->head = new_node;
|
183
|
+
hash->tail = new_node;
|
184
|
+
} else {
|
185
|
+
hash->tail->next = new_node;
|
186
|
+
hash->tail = new_node;
|
187
|
+
}
|
188
|
+
}
|
189
|
+
|
190
|
+
rbs_node_t* rbs_hash_get(rbs_hash_t *hash, rbs_node_t *key) {
|
191
|
+
rbs_hash_node_t *node = rbs_hash_find(hash, key);
|
192
|
+
return node ? node->value : NULL;
|
193
|
+
}
|
194
|
+
|
195
|
+
rbs_keyword_t *rbs_keyword_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_constant_id_t constant_id) {
|
196
|
+
rbs_keyword_t *instance = rbs_allocator_alloc(allocator, rbs_keyword_t);
|
197
|
+
|
198
|
+
*instance = (rbs_keyword_t) {
|
199
|
+
.base = (rbs_node_t) {
|
200
|
+
.type = RBS_KEYWORD,
|
201
|
+
.location = location,
|
202
|
+
},
|
203
|
+
.constant_id = constant_id,
|
204
|
+
};
|
205
|
+
|
206
|
+
return instance;
|
207
|
+
}
|
208
|
+
|
209
|
+
rbs_ast_symbol_t *rbs_ast_symbol_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_constant_pool_t *constant_pool, rbs_constant_id_t constant_id) {
|
210
|
+
rbs_ast_symbol_t *instance = rbs_allocator_alloc(allocator, rbs_ast_symbol_t);
|
211
|
+
|
212
|
+
*instance = (rbs_ast_symbol_t) {
|
213
|
+
.base = (rbs_node_t) {
|
214
|
+
.type = RBS_AST_SYMBOL,
|
215
|
+
.location = location,
|
216
|
+
},
|
217
|
+
.constant_id = constant_id,
|
218
|
+
};
|
219
|
+
|
220
|
+
return instance;
|
221
|
+
}
|
222
|
+
|
223
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
224
|
+
rbs_ast_annotation_t *rbs_ast_annotation_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_string_t string) {
|
225
|
+
rbs_ast_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_annotation_t);
|
226
|
+
|
227
|
+
|
228
|
+
*instance = (rbs_ast_annotation_t) {
|
229
|
+
.base = (rbs_node_t) {
|
230
|
+
.type = RBS_AST_ANNOTATION,
|
231
|
+
.location = location,
|
232
|
+
},
|
233
|
+
.string = string,
|
234
|
+
};
|
235
|
+
|
236
|
+
return instance;
|
237
|
+
}
|
238
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
239
|
+
rbs_ast_bool_t *rbs_ast_bool_new(rbs_allocator_t *allocator, rbs_location_t *location, bool value) {
|
240
|
+
rbs_ast_bool_t *instance = rbs_allocator_alloc(allocator, rbs_ast_bool_t);
|
241
|
+
|
242
|
+
|
243
|
+
*instance = (rbs_ast_bool_t) {
|
244
|
+
.base = (rbs_node_t) {
|
245
|
+
.type = RBS_AST_BOOL,
|
246
|
+
.location = location,
|
247
|
+
},
|
248
|
+
.value = value,
|
249
|
+
};
|
250
|
+
|
251
|
+
return instance;
|
252
|
+
}
|
253
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
254
|
+
rbs_ast_comment_t *rbs_ast_comment_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_string_t string) {
|
255
|
+
rbs_ast_comment_t *instance = rbs_allocator_alloc(allocator, rbs_ast_comment_t);
|
256
|
+
|
257
|
+
|
258
|
+
*instance = (rbs_ast_comment_t) {
|
259
|
+
.base = (rbs_node_t) {
|
260
|
+
.type = RBS_AST_COMMENT,
|
261
|
+
.location = location,
|
262
|
+
},
|
263
|
+
.string = string,
|
264
|
+
};
|
265
|
+
|
266
|
+
return instance;
|
267
|
+
}
|
268
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
269
|
+
rbs_ast_declarations_class_t *rbs_ast_declarations_class_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_type_name_t *name, rbs_node_list_t *type_params, rbs_ast_declarations_class_super_t *super_class, rbs_node_list_t *members, rbs_node_list_t *annotations, rbs_ast_comment_t *comment) {
|
270
|
+
rbs_ast_declarations_class_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_class_t);
|
271
|
+
|
272
|
+
|
273
|
+
*instance = (rbs_ast_declarations_class_t) {
|
274
|
+
.base = (rbs_node_t) {
|
275
|
+
.type = RBS_AST_DECLARATIONS_CLASS,
|
276
|
+
.location = location,
|
277
|
+
},
|
278
|
+
.name = name,
|
279
|
+
.type_params = type_params,
|
280
|
+
.super_class = super_class,
|
281
|
+
.members = members,
|
282
|
+
.annotations = annotations,
|
283
|
+
.comment = comment,
|
284
|
+
};
|
285
|
+
|
286
|
+
return instance;
|
287
|
+
}
|
288
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
289
|
+
rbs_ast_declarations_class_super_t *rbs_ast_declarations_class_super_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_type_name_t *name, rbs_node_list_t *args) {
|
290
|
+
rbs_ast_declarations_class_super_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_class_super_t);
|
291
|
+
|
292
|
+
|
293
|
+
*instance = (rbs_ast_declarations_class_super_t) {
|
294
|
+
.base = (rbs_node_t) {
|
295
|
+
.type = RBS_AST_DECLARATIONS_CLASS_SUPER,
|
296
|
+
.location = location,
|
297
|
+
},
|
298
|
+
.name = name,
|
299
|
+
.args = args,
|
300
|
+
};
|
301
|
+
|
302
|
+
return instance;
|
303
|
+
}
|
304
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
305
|
+
rbs_ast_declarations_class_alias_t *rbs_ast_declarations_class_alias_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_type_name_t *new_name, rbs_type_name_t *old_name, rbs_ast_comment_t *comment, rbs_node_list_t *annotations) {
|
306
|
+
rbs_ast_declarations_class_alias_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_class_alias_t);
|
307
|
+
|
308
|
+
|
309
|
+
*instance = (rbs_ast_declarations_class_alias_t) {
|
310
|
+
.base = (rbs_node_t) {
|
311
|
+
.type = RBS_AST_DECLARATIONS_CLASS_ALIAS,
|
312
|
+
.location = location,
|
313
|
+
},
|
314
|
+
.new_name = new_name,
|
315
|
+
.old_name = old_name,
|
316
|
+
.comment = comment,
|
317
|
+
.annotations = annotations,
|
318
|
+
};
|
319
|
+
|
320
|
+
return instance;
|
321
|
+
}
|
322
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
323
|
+
rbs_ast_declarations_constant_t *rbs_ast_declarations_constant_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_type_name_t *name, rbs_node_t *type, rbs_ast_comment_t *comment, rbs_node_list_t *annotations) {
|
324
|
+
rbs_ast_declarations_constant_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_constant_t);
|
325
|
+
|
326
|
+
|
327
|
+
*instance = (rbs_ast_declarations_constant_t) {
|
328
|
+
.base = (rbs_node_t) {
|
329
|
+
.type = RBS_AST_DECLARATIONS_CONSTANT,
|
330
|
+
.location = location,
|
331
|
+
},
|
332
|
+
.name = name,
|
333
|
+
.type = type,
|
334
|
+
.comment = comment,
|
335
|
+
.annotations = annotations,
|
336
|
+
};
|
337
|
+
|
338
|
+
return instance;
|
339
|
+
}
|
340
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
341
|
+
rbs_ast_declarations_global_t *rbs_ast_declarations_global_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_ast_symbol_t *name, rbs_node_t *type, rbs_ast_comment_t *comment, rbs_node_list_t *annotations) {
|
342
|
+
rbs_ast_declarations_global_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_global_t);
|
343
|
+
|
344
|
+
|
345
|
+
*instance = (rbs_ast_declarations_global_t) {
|
346
|
+
.base = (rbs_node_t) {
|
347
|
+
.type = RBS_AST_DECLARATIONS_GLOBAL,
|
348
|
+
.location = location,
|
349
|
+
},
|
350
|
+
.name = name,
|
351
|
+
.type = type,
|
352
|
+
.comment = comment,
|
353
|
+
.annotations = annotations,
|
354
|
+
};
|
355
|
+
|
356
|
+
return instance;
|
357
|
+
}
|
358
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
359
|
+
rbs_ast_declarations_interface_t *rbs_ast_declarations_interface_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_type_name_t *name, rbs_node_list_t *type_params, rbs_node_list_t *members, rbs_node_list_t *annotations, rbs_ast_comment_t *comment) {
|
360
|
+
rbs_ast_declarations_interface_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_interface_t);
|
361
|
+
|
362
|
+
|
363
|
+
*instance = (rbs_ast_declarations_interface_t) {
|
364
|
+
.base = (rbs_node_t) {
|
365
|
+
.type = RBS_AST_DECLARATIONS_INTERFACE,
|
366
|
+
.location = location,
|
367
|
+
},
|
368
|
+
.name = name,
|
369
|
+
.type_params = type_params,
|
370
|
+
.members = members,
|
371
|
+
.annotations = annotations,
|
372
|
+
.comment = comment,
|
373
|
+
};
|
374
|
+
|
375
|
+
return instance;
|
376
|
+
}
|
377
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
378
|
+
rbs_ast_declarations_module_t *rbs_ast_declarations_module_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_type_name_t *name, rbs_node_list_t *type_params, rbs_node_list_t *self_types, rbs_node_list_t *members, rbs_node_list_t *annotations, rbs_ast_comment_t *comment) {
|
379
|
+
rbs_ast_declarations_module_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_module_t);
|
380
|
+
|
381
|
+
|
382
|
+
*instance = (rbs_ast_declarations_module_t) {
|
383
|
+
.base = (rbs_node_t) {
|
384
|
+
.type = RBS_AST_DECLARATIONS_MODULE,
|
385
|
+
.location = location,
|
386
|
+
},
|
387
|
+
.name = name,
|
388
|
+
.type_params = type_params,
|
389
|
+
.self_types = self_types,
|
390
|
+
.members = members,
|
391
|
+
.annotations = annotations,
|
392
|
+
.comment = comment,
|
393
|
+
};
|
394
|
+
|
395
|
+
return instance;
|
396
|
+
}
|
397
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
398
|
+
rbs_ast_declarations_module_self_t *rbs_ast_declarations_module_self_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_type_name_t *name, rbs_node_list_t *args) {
|
399
|
+
rbs_ast_declarations_module_self_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_module_self_t);
|
400
|
+
|
401
|
+
|
402
|
+
*instance = (rbs_ast_declarations_module_self_t) {
|
403
|
+
.base = (rbs_node_t) {
|
404
|
+
.type = RBS_AST_DECLARATIONS_MODULE_SELF,
|
405
|
+
.location = location,
|
406
|
+
},
|
407
|
+
.name = name,
|
408
|
+
.args = args,
|
409
|
+
};
|
410
|
+
|
411
|
+
return instance;
|
412
|
+
}
|
413
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
414
|
+
rbs_ast_declarations_module_alias_t *rbs_ast_declarations_module_alias_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_type_name_t *new_name, rbs_type_name_t *old_name, rbs_ast_comment_t *comment, rbs_node_list_t *annotations) {
|
415
|
+
rbs_ast_declarations_module_alias_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_module_alias_t);
|
416
|
+
|
417
|
+
|
418
|
+
*instance = (rbs_ast_declarations_module_alias_t) {
|
419
|
+
.base = (rbs_node_t) {
|
420
|
+
.type = RBS_AST_DECLARATIONS_MODULE_ALIAS,
|
421
|
+
.location = location,
|
422
|
+
},
|
423
|
+
.new_name = new_name,
|
424
|
+
.old_name = old_name,
|
425
|
+
.comment = comment,
|
426
|
+
.annotations = annotations,
|
427
|
+
};
|
428
|
+
|
429
|
+
return instance;
|
430
|
+
}
|
431
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
432
|
+
rbs_ast_declarations_type_alias_t *rbs_ast_declarations_type_alias_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_type_name_t *name, rbs_node_list_t *type_params, rbs_node_t *type, rbs_node_list_t *annotations, rbs_ast_comment_t *comment) {
|
433
|
+
rbs_ast_declarations_type_alias_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_type_alias_t);
|
434
|
+
|
435
|
+
|
436
|
+
*instance = (rbs_ast_declarations_type_alias_t) {
|
437
|
+
.base = (rbs_node_t) {
|
438
|
+
.type = RBS_AST_DECLARATIONS_TYPE_ALIAS,
|
439
|
+
.location = location,
|
440
|
+
},
|
441
|
+
.name = name,
|
442
|
+
.type_params = type_params,
|
443
|
+
.type = type,
|
444
|
+
.annotations = annotations,
|
445
|
+
.comment = comment,
|
446
|
+
};
|
447
|
+
|
448
|
+
return instance;
|
449
|
+
}
|
450
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
451
|
+
rbs_ast_directives_use_t *rbs_ast_directives_use_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_node_list_t *clauses) {
|
452
|
+
rbs_ast_directives_use_t *instance = rbs_allocator_alloc(allocator, rbs_ast_directives_use_t);
|
453
|
+
|
454
|
+
|
455
|
+
*instance = (rbs_ast_directives_use_t) {
|
456
|
+
.base = (rbs_node_t) {
|
457
|
+
.type = RBS_AST_DIRECTIVES_USE,
|
458
|
+
.location = location,
|
459
|
+
},
|
460
|
+
.clauses = clauses,
|
461
|
+
};
|
462
|
+
|
463
|
+
return instance;
|
464
|
+
}
|
465
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
466
|
+
rbs_ast_directives_use_single_clause_t *rbs_ast_directives_use_single_clause_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_type_name_t *type_name, rbs_ast_symbol_t *new_name) {
|
467
|
+
rbs_ast_directives_use_single_clause_t *instance = rbs_allocator_alloc(allocator, rbs_ast_directives_use_single_clause_t);
|
468
|
+
|
469
|
+
|
470
|
+
*instance = (rbs_ast_directives_use_single_clause_t) {
|
471
|
+
.base = (rbs_node_t) {
|
472
|
+
.type = RBS_AST_DIRECTIVES_USE_SINGLE_CLAUSE,
|
473
|
+
.location = location,
|
474
|
+
},
|
475
|
+
.type_name = type_name,
|
476
|
+
.new_name = new_name,
|
477
|
+
};
|
478
|
+
|
479
|
+
return instance;
|
480
|
+
}
|
481
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
482
|
+
rbs_ast_directives_use_wildcard_clause_t *rbs_ast_directives_use_wildcard_clause_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_namespace_t *rbs_namespace) {
|
483
|
+
rbs_ast_directives_use_wildcard_clause_t *instance = rbs_allocator_alloc(allocator, rbs_ast_directives_use_wildcard_clause_t);
|
484
|
+
|
485
|
+
|
486
|
+
*instance = (rbs_ast_directives_use_wildcard_clause_t) {
|
487
|
+
.base = (rbs_node_t) {
|
488
|
+
.type = RBS_AST_DIRECTIVES_USE_WILDCARD_CLAUSE,
|
489
|
+
.location = location,
|
490
|
+
},
|
491
|
+
.rbs_namespace = rbs_namespace,
|
492
|
+
};
|
493
|
+
|
494
|
+
return instance;
|
495
|
+
}
|
496
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
497
|
+
rbs_ast_integer_t *rbs_ast_integer_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_string_t string_representation) {
|
498
|
+
rbs_ast_integer_t *instance = rbs_allocator_alloc(allocator, rbs_ast_integer_t);
|
499
|
+
|
500
|
+
|
501
|
+
*instance = (rbs_ast_integer_t) {
|
502
|
+
.base = (rbs_node_t) {
|
503
|
+
.type = RBS_AST_INTEGER,
|
504
|
+
.location = location,
|
505
|
+
},
|
506
|
+
.string_representation = string_representation,
|
507
|
+
};
|
508
|
+
|
509
|
+
return instance;
|
510
|
+
}
|
511
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
512
|
+
rbs_ast_members_alias_t *rbs_ast_members_alias_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_ast_symbol_t *new_name, rbs_ast_symbol_t *old_name, rbs_keyword_t *kind, rbs_node_list_t *annotations, rbs_ast_comment_t *comment) {
|
513
|
+
rbs_ast_members_alias_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_alias_t);
|
514
|
+
|
515
|
+
|
516
|
+
*instance = (rbs_ast_members_alias_t) {
|
517
|
+
.base = (rbs_node_t) {
|
518
|
+
.type = RBS_AST_MEMBERS_ALIAS,
|
519
|
+
.location = location,
|
520
|
+
},
|
521
|
+
.new_name = new_name,
|
522
|
+
.old_name = old_name,
|
523
|
+
.kind = kind,
|
524
|
+
.annotations = annotations,
|
525
|
+
.comment = comment,
|
526
|
+
};
|
527
|
+
|
528
|
+
return instance;
|
529
|
+
}
|
530
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
531
|
+
rbs_ast_members_attr_accessor_t *rbs_ast_members_attr_accessor_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_ast_symbol_t *name, rbs_node_t *type, rbs_node_t *ivar_name, rbs_keyword_t *kind, rbs_node_list_t *annotations, rbs_ast_comment_t *comment, rbs_keyword_t *visibility) {
|
532
|
+
rbs_ast_members_attr_accessor_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_attr_accessor_t);
|
533
|
+
|
534
|
+
|
535
|
+
*instance = (rbs_ast_members_attr_accessor_t) {
|
536
|
+
.base = (rbs_node_t) {
|
537
|
+
.type = RBS_AST_MEMBERS_ATTR_ACCESSOR,
|
538
|
+
.location = location,
|
539
|
+
},
|
540
|
+
.name = name,
|
541
|
+
.type = type,
|
542
|
+
.ivar_name = ivar_name,
|
543
|
+
.kind = kind,
|
544
|
+
.annotations = annotations,
|
545
|
+
.comment = comment,
|
546
|
+
.visibility = visibility,
|
547
|
+
};
|
548
|
+
|
549
|
+
return instance;
|
550
|
+
}
|
551
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
552
|
+
rbs_ast_members_attr_reader_t *rbs_ast_members_attr_reader_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_ast_symbol_t *name, rbs_node_t *type, rbs_node_t *ivar_name, rbs_keyword_t *kind, rbs_node_list_t *annotations, rbs_ast_comment_t *comment, rbs_keyword_t *visibility) {
|
553
|
+
rbs_ast_members_attr_reader_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_attr_reader_t);
|
554
|
+
|
555
|
+
|
556
|
+
*instance = (rbs_ast_members_attr_reader_t) {
|
557
|
+
.base = (rbs_node_t) {
|
558
|
+
.type = RBS_AST_MEMBERS_ATTR_READER,
|
559
|
+
.location = location,
|
560
|
+
},
|
561
|
+
.name = name,
|
562
|
+
.type = type,
|
563
|
+
.ivar_name = ivar_name,
|
564
|
+
.kind = kind,
|
565
|
+
.annotations = annotations,
|
566
|
+
.comment = comment,
|
567
|
+
.visibility = visibility,
|
568
|
+
};
|
569
|
+
|
570
|
+
return instance;
|
571
|
+
}
|
572
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
573
|
+
rbs_ast_members_attr_writer_t *rbs_ast_members_attr_writer_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_ast_symbol_t *name, rbs_node_t *type, rbs_node_t *ivar_name, rbs_keyword_t *kind, rbs_node_list_t *annotations, rbs_ast_comment_t *comment, rbs_keyword_t *visibility) {
|
574
|
+
rbs_ast_members_attr_writer_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_attr_writer_t);
|
575
|
+
|
576
|
+
|
577
|
+
*instance = (rbs_ast_members_attr_writer_t) {
|
578
|
+
.base = (rbs_node_t) {
|
579
|
+
.type = RBS_AST_MEMBERS_ATTR_WRITER,
|
580
|
+
.location = location,
|
581
|
+
},
|
582
|
+
.name = name,
|
583
|
+
.type = type,
|
584
|
+
.ivar_name = ivar_name,
|
585
|
+
.kind = kind,
|
586
|
+
.annotations = annotations,
|
587
|
+
.comment = comment,
|
588
|
+
.visibility = visibility,
|
589
|
+
};
|
590
|
+
|
591
|
+
return instance;
|
592
|
+
}
|
593
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
594
|
+
rbs_ast_members_class_instance_variable_t *rbs_ast_members_class_instance_variable_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_ast_symbol_t *name, rbs_node_t *type, rbs_ast_comment_t *comment) {
|
595
|
+
rbs_ast_members_class_instance_variable_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_class_instance_variable_t);
|
596
|
+
|
597
|
+
|
598
|
+
*instance = (rbs_ast_members_class_instance_variable_t) {
|
599
|
+
.base = (rbs_node_t) {
|
600
|
+
.type = RBS_AST_MEMBERS_CLASS_INSTANCE_VARIABLE,
|
601
|
+
.location = location,
|
602
|
+
},
|
603
|
+
.name = name,
|
604
|
+
.type = type,
|
605
|
+
.comment = comment,
|
606
|
+
};
|
607
|
+
|
608
|
+
return instance;
|
609
|
+
}
|
610
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
611
|
+
rbs_ast_members_class_variable_t *rbs_ast_members_class_variable_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_ast_symbol_t *name, rbs_node_t *type, rbs_ast_comment_t *comment) {
|
612
|
+
rbs_ast_members_class_variable_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_class_variable_t);
|
613
|
+
|
614
|
+
|
615
|
+
*instance = (rbs_ast_members_class_variable_t) {
|
616
|
+
.base = (rbs_node_t) {
|
617
|
+
.type = RBS_AST_MEMBERS_CLASS_VARIABLE,
|
618
|
+
.location = location,
|
619
|
+
},
|
620
|
+
.name = name,
|
621
|
+
.type = type,
|
622
|
+
.comment = comment,
|
623
|
+
};
|
624
|
+
|
625
|
+
return instance;
|
626
|
+
}
|
627
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
628
|
+
rbs_ast_members_extend_t *rbs_ast_members_extend_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_type_name_t *name, rbs_node_list_t *args, rbs_node_list_t *annotations, rbs_ast_comment_t *comment) {
|
629
|
+
rbs_ast_members_extend_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_extend_t);
|
630
|
+
|
631
|
+
|
632
|
+
*instance = (rbs_ast_members_extend_t) {
|
633
|
+
.base = (rbs_node_t) {
|
634
|
+
.type = RBS_AST_MEMBERS_EXTEND,
|
635
|
+
.location = location,
|
636
|
+
},
|
637
|
+
.name = name,
|
638
|
+
.args = args,
|
639
|
+
.annotations = annotations,
|
640
|
+
.comment = comment,
|
641
|
+
};
|
642
|
+
|
643
|
+
return instance;
|
644
|
+
}
|
645
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
646
|
+
rbs_ast_members_include_t *rbs_ast_members_include_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_type_name_t *name, rbs_node_list_t *args, rbs_node_list_t *annotations, rbs_ast_comment_t *comment) {
|
647
|
+
rbs_ast_members_include_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_include_t);
|
648
|
+
|
649
|
+
|
650
|
+
*instance = (rbs_ast_members_include_t) {
|
651
|
+
.base = (rbs_node_t) {
|
652
|
+
.type = RBS_AST_MEMBERS_INCLUDE,
|
653
|
+
.location = location,
|
654
|
+
},
|
655
|
+
.name = name,
|
656
|
+
.args = args,
|
657
|
+
.annotations = annotations,
|
658
|
+
.comment = comment,
|
659
|
+
};
|
660
|
+
|
661
|
+
return instance;
|
662
|
+
}
|
663
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
664
|
+
rbs_ast_members_instance_variable_t *rbs_ast_members_instance_variable_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_ast_symbol_t *name, rbs_node_t *type, rbs_ast_comment_t *comment) {
|
665
|
+
rbs_ast_members_instance_variable_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_instance_variable_t);
|
666
|
+
|
667
|
+
|
668
|
+
*instance = (rbs_ast_members_instance_variable_t) {
|
669
|
+
.base = (rbs_node_t) {
|
670
|
+
.type = RBS_AST_MEMBERS_INSTANCE_VARIABLE,
|
671
|
+
.location = location,
|
672
|
+
},
|
673
|
+
.name = name,
|
674
|
+
.type = type,
|
675
|
+
.comment = comment,
|
676
|
+
};
|
677
|
+
|
678
|
+
return instance;
|
679
|
+
}
|
680
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
681
|
+
rbs_ast_members_method_definition_t *rbs_ast_members_method_definition_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_ast_symbol_t *name, rbs_keyword_t *kind, rbs_node_list_t *overloads, rbs_node_list_t *annotations, rbs_ast_comment_t *comment, bool overloading, rbs_keyword_t *visibility) {
|
682
|
+
rbs_ast_members_method_definition_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_method_definition_t);
|
683
|
+
|
684
|
+
|
685
|
+
*instance = (rbs_ast_members_method_definition_t) {
|
686
|
+
.base = (rbs_node_t) {
|
687
|
+
.type = RBS_AST_MEMBERS_METHOD_DEFINITION,
|
688
|
+
.location = location,
|
689
|
+
},
|
690
|
+
.name = name,
|
691
|
+
.kind = kind,
|
692
|
+
.overloads = overloads,
|
693
|
+
.annotations = annotations,
|
694
|
+
.comment = comment,
|
695
|
+
.overloading = overloading,
|
696
|
+
.visibility = visibility,
|
697
|
+
};
|
698
|
+
|
699
|
+
return instance;
|
700
|
+
}
|
701
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
702
|
+
rbs_ast_members_method_definition_overload_t *rbs_ast_members_method_definition_overload_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_node_list_t *annotations, rbs_node_t *method_type) {
|
703
|
+
rbs_ast_members_method_definition_overload_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_method_definition_overload_t);
|
704
|
+
|
705
|
+
|
706
|
+
*instance = (rbs_ast_members_method_definition_overload_t) {
|
707
|
+
.base = (rbs_node_t) {
|
708
|
+
.type = RBS_AST_MEMBERS_METHOD_DEFINITION_OVERLOAD,
|
709
|
+
.location = location,
|
710
|
+
},
|
711
|
+
.annotations = annotations,
|
712
|
+
.method_type = method_type,
|
713
|
+
};
|
714
|
+
|
715
|
+
return instance;
|
716
|
+
}
|
717
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
718
|
+
rbs_ast_members_prepend_t *rbs_ast_members_prepend_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_type_name_t *name, rbs_node_list_t *args, rbs_node_list_t *annotations, rbs_ast_comment_t *comment) {
|
719
|
+
rbs_ast_members_prepend_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_prepend_t);
|
720
|
+
|
721
|
+
|
722
|
+
*instance = (rbs_ast_members_prepend_t) {
|
723
|
+
.base = (rbs_node_t) {
|
724
|
+
.type = RBS_AST_MEMBERS_PREPEND,
|
725
|
+
.location = location,
|
726
|
+
},
|
727
|
+
.name = name,
|
728
|
+
.args = args,
|
729
|
+
.annotations = annotations,
|
730
|
+
.comment = comment,
|
731
|
+
};
|
732
|
+
|
733
|
+
return instance;
|
734
|
+
}
|
735
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
736
|
+
rbs_ast_members_private_t *rbs_ast_members_private_new(rbs_allocator_t *allocator, rbs_location_t *location) {
|
737
|
+
rbs_ast_members_private_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_private_t);
|
738
|
+
|
739
|
+
|
740
|
+
*instance = (rbs_ast_members_private_t) {
|
741
|
+
.base = (rbs_node_t) {
|
742
|
+
.type = RBS_AST_MEMBERS_PRIVATE,
|
743
|
+
.location = location,
|
744
|
+
},
|
745
|
+
};
|
746
|
+
|
747
|
+
return instance;
|
748
|
+
}
|
749
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
750
|
+
rbs_ast_members_public_t *rbs_ast_members_public_new(rbs_allocator_t *allocator, rbs_location_t *location) {
|
751
|
+
rbs_ast_members_public_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_public_t);
|
752
|
+
|
753
|
+
|
754
|
+
*instance = (rbs_ast_members_public_t) {
|
755
|
+
.base = (rbs_node_t) {
|
756
|
+
.type = RBS_AST_MEMBERS_PUBLIC,
|
757
|
+
.location = location,
|
758
|
+
},
|
759
|
+
};
|
760
|
+
|
761
|
+
return instance;
|
762
|
+
}
|
763
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
764
|
+
rbs_ast_ruby_annotations_colon_method_type_annotation_t *rbs_ast_ruby_annotations_colon_method_type_annotation_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_location_t *prefix_location, rbs_node_list_t *annotations, rbs_node_t *method_type) {
|
765
|
+
rbs_ast_ruby_annotations_colon_method_type_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_colon_method_type_annotation_t);
|
766
|
+
|
767
|
+
|
768
|
+
*instance = (rbs_ast_ruby_annotations_colon_method_type_annotation_t) {
|
769
|
+
.base = (rbs_node_t) {
|
770
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_COLON_METHOD_TYPE_ANNOTATION,
|
771
|
+
.location = location,
|
772
|
+
},
|
773
|
+
.prefix_location = prefix_location,
|
774
|
+
.annotations = annotations,
|
775
|
+
.method_type = method_type,
|
776
|
+
};
|
777
|
+
|
778
|
+
return instance;
|
779
|
+
}
|
780
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
781
|
+
rbs_ast_ruby_annotations_method_types_annotation_t *rbs_ast_ruby_annotations_method_types_annotation_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_location_t *prefix_location, rbs_node_list_t *overloads, rbs_location_list_t *vertical_bar_locations) {
|
782
|
+
rbs_ast_ruby_annotations_method_types_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_method_types_annotation_t);
|
783
|
+
|
784
|
+
|
785
|
+
*instance = (rbs_ast_ruby_annotations_method_types_annotation_t) {
|
786
|
+
.base = (rbs_node_t) {
|
787
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_METHOD_TYPES_ANNOTATION,
|
788
|
+
.location = location,
|
789
|
+
},
|
790
|
+
.prefix_location = prefix_location,
|
791
|
+
.overloads = overloads,
|
792
|
+
.vertical_bar_locations = vertical_bar_locations,
|
793
|
+
};
|
794
|
+
|
795
|
+
return instance;
|
796
|
+
}
|
797
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
798
|
+
rbs_ast_ruby_annotations_node_type_assertion_t *rbs_ast_ruby_annotations_node_type_assertion_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_location_t *prefix_location, rbs_node_t *type) {
|
799
|
+
rbs_ast_ruby_annotations_node_type_assertion_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_node_type_assertion_t);
|
800
|
+
|
801
|
+
|
802
|
+
*instance = (rbs_ast_ruby_annotations_node_type_assertion_t) {
|
803
|
+
.base = (rbs_node_t) {
|
804
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_NODE_TYPE_ASSERTION,
|
805
|
+
.location = location,
|
806
|
+
},
|
807
|
+
.prefix_location = prefix_location,
|
808
|
+
.type = type,
|
809
|
+
};
|
810
|
+
|
811
|
+
return instance;
|
812
|
+
}
|
813
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
814
|
+
rbs_ast_ruby_annotations_return_type_annotation_t *rbs_ast_ruby_annotations_return_type_annotation_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_location_t *prefix_location, rbs_location_t *return_location, rbs_location_t *colon_location, rbs_node_t *return_type, rbs_location_t *comment_location) {
|
815
|
+
rbs_ast_ruby_annotations_return_type_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_return_type_annotation_t);
|
816
|
+
|
817
|
+
|
818
|
+
*instance = (rbs_ast_ruby_annotations_return_type_annotation_t) {
|
819
|
+
.base = (rbs_node_t) {
|
820
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_RETURN_TYPE_ANNOTATION,
|
821
|
+
.location = location,
|
822
|
+
},
|
823
|
+
.prefix_location = prefix_location,
|
824
|
+
.return_location = return_location,
|
825
|
+
.colon_location = colon_location,
|
826
|
+
.return_type = return_type,
|
827
|
+
.comment_location = comment_location,
|
828
|
+
};
|
829
|
+
|
830
|
+
return instance;
|
831
|
+
}
|
832
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
833
|
+
rbs_ast_ruby_annotations_skip_annotation_t *rbs_ast_ruby_annotations_skip_annotation_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_location_t *prefix_location, rbs_location_t *skip_location, rbs_location_t *comment_location) {
|
834
|
+
rbs_ast_ruby_annotations_skip_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_skip_annotation_t);
|
835
|
+
|
836
|
+
|
837
|
+
*instance = (rbs_ast_ruby_annotations_skip_annotation_t) {
|
838
|
+
.base = (rbs_node_t) {
|
839
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_SKIP_ANNOTATION,
|
840
|
+
.location = location,
|
841
|
+
},
|
842
|
+
.prefix_location = prefix_location,
|
843
|
+
.skip_location = skip_location,
|
844
|
+
.comment_location = comment_location,
|
845
|
+
};
|
846
|
+
|
847
|
+
return instance;
|
848
|
+
}
|
849
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
850
|
+
rbs_ast_string_t *rbs_ast_string_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_string_t string) {
|
851
|
+
rbs_ast_string_t *instance = rbs_allocator_alloc(allocator, rbs_ast_string_t);
|
852
|
+
|
853
|
+
|
854
|
+
*instance = (rbs_ast_string_t) {
|
855
|
+
.base = (rbs_node_t) {
|
856
|
+
.type = RBS_AST_STRING,
|
857
|
+
.location = location,
|
858
|
+
},
|
859
|
+
.string = string,
|
860
|
+
};
|
861
|
+
|
862
|
+
return instance;
|
863
|
+
}
|
864
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
865
|
+
rbs_ast_type_param_t *rbs_ast_type_param_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_ast_symbol_t *name, rbs_keyword_t *variance, rbs_node_t *upper_bound, rbs_node_t *default_type, bool unchecked) {
|
866
|
+
rbs_ast_type_param_t *instance = rbs_allocator_alloc(allocator, rbs_ast_type_param_t);
|
867
|
+
|
868
|
+
|
869
|
+
*instance = (rbs_ast_type_param_t) {
|
870
|
+
.base = (rbs_node_t) {
|
871
|
+
.type = RBS_AST_TYPE_PARAM,
|
872
|
+
.location = location,
|
873
|
+
},
|
874
|
+
.name = name,
|
875
|
+
.variance = variance,
|
876
|
+
.upper_bound = upper_bound,
|
877
|
+
.default_type = default_type,
|
878
|
+
.unchecked = unchecked,
|
879
|
+
};
|
880
|
+
|
881
|
+
return instance;
|
882
|
+
}
|
883
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
884
|
+
rbs_method_type_t *rbs_method_type_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_node_list_t *type_params, rbs_node_t *type, rbs_types_block_t *block) {
|
885
|
+
rbs_method_type_t *instance = rbs_allocator_alloc(allocator, rbs_method_type_t);
|
886
|
+
|
887
|
+
|
888
|
+
*instance = (rbs_method_type_t) {
|
889
|
+
.base = (rbs_node_t) {
|
890
|
+
.type = RBS_METHOD_TYPE,
|
891
|
+
.location = location,
|
892
|
+
},
|
893
|
+
.type_params = type_params,
|
894
|
+
.type = type,
|
895
|
+
.block = block,
|
896
|
+
};
|
897
|
+
|
898
|
+
return instance;
|
899
|
+
}
|
900
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
901
|
+
rbs_namespace_t *rbs_namespace_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_node_list_t *path, bool absolute) {
|
902
|
+
rbs_namespace_t *instance = rbs_allocator_alloc(allocator, rbs_namespace_t);
|
903
|
+
|
904
|
+
|
905
|
+
*instance = (rbs_namespace_t) {
|
906
|
+
.base = (rbs_node_t) {
|
907
|
+
.type = RBS_NAMESPACE,
|
908
|
+
.location = location,
|
909
|
+
},
|
910
|
+
.path = path,
|
911
|
+
.absolute = absolute,
|
912
|
+
};
|
913
|
+
|
914
|
+
return instance;
|
915
|
+
}
|
916
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
917
|
+
rbs_signature_t *rbs_signature_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_node_list_t *directives, rbs_node_list_t *declarations) {
|
918
|
+
rbs_signature_t *instance = rbs_allocator_alloc(allocator, rbs_signature_t);
|
919
|
+
|
920
|
+
|
921
|
+
*instance = (rbs_signature_t) {
|
922
|
+
.base = (rbs_node_t) {
|
923
|
+
.type = RBS_SIGNATURE,
|
924
|
+
.location = location,
|
925
|
+
},
|
926
|
+
.directives = directives,
|
927
|
+
.declarations = declarations,
|
928
|
+
};
|
929
|
+
|
930
|
+
return instance;
|
931
|
+
}
|
932
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
933
|
+
rbs_type_name_t *rbs_type_name_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_namespace_t *rbs_namespace, rbs_ast_symbol_t *name) {
|
934
|
+
rbs_type_name_t *instance = rbs_allocator_alloc(allocator, rbs_type_name_t);
|
935
|
+
|
936
|
+
|
937
|
+
*instance = (rbs_type_name_t) {
|
938
|
+
.base = (rbs_node_t) {
|
939
|
+
.type = RBS_TYPE_NAME,
|
940
|
+
.location = location,
|
941
|
+
},
|
942
|
+
.rbs_namespace = rbs_namespace,
|
943
|
+
.name = name,
|
944
|
+
};
|
945
|
+
|
946
|
+
return instance;
|
947
|
+
}
|
948
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
949
|
+
rbs_types_alias_t *rbs_types_alias_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_type_name_t *name, rbs_node_list_t *args) {
|
950
|
+
rbs_types_alias_t *instance = rbs_allocator_alloc(allocator, rbs_types_alias_t);
|
951
|
+
|
952
|
+
|
953
|
+
*instance = (rbs_types_alias_t) {
|
954
|
+
.base = (rbs_node_t) {
|
955
|
+
.type = RBS_TYPES_ALIAS,
|
956
|
+
.location = location,
|
957
|
+
},
|
958
|
+
.name = name,
|
959
|
+
.args = args,
|
960
|
+
};
|
961
|
+
|
962
|
+
return instance;
|
963
|
+
}
|
964
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
965
|
+
rbs_types_bases_any_t *rbs_types_bases_any_new(rbs_allocator_t *allocator, rbs_location_t *location, bool todo) {
|
966
|
+
rbs_types_bases_any_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_any_t);
|
967
|
+
|
968
|
+
|
969
|
+
*instance = (rbs_types_bases_any_t) {
|
970
|
+
.base = (rbs_node_t) {
|
971
|
+
.type = RBS_TYPES_BASES_ANY,
|
972
|
+
.location = location,
|
973
|
+
},
|
974
|
+
.todo = todo,
|
975
|
+
};
|
976
|
+
|
977
|
+
return instance;
|
978
|
+
}
|
979
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
980
|
+
rbs_types_bases_bool_t *rbs_types_bases_bool_new(rbs_allocator_t *allocator, rbs_location_t *location) {
|
981
|
+
rbs_types_bases_bool_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_bool_t);
|
982
|
+
|
983
|
+
|
984
|
+
*instance = (rbs_types_bases_bool_t) {
|
985
|
+
.base = (rbs_node_t) {
|
986
|
+
.type = RBS_TYPES_BASES_BOOL,
|
987
|
+
.location = location,
|
988
|
+
},
|
989
|
+
};
|
990
|
+
|
991
|
+
return instance;
|
992
|
+
}
|
993
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
994
|
+
rbs_types_bases_bottom_t *rbs_types_bases_bottom_new(rbs_allocator_t *allocator, rbs_location_t *location) {
|
995
|
+
rbs_types_bases_bottom_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_bottom_t);
|
996
|
+
|
997
|
+
|
998
|
+
*instance = (rbs_types_bases_bottom_t) {
|
999
|
+
.base = (rbs_node_t) {
|
1000
|
+
.type = RBS_TYPES_BASES_BOTTOM,
|
1001
|
+
.location = location,
|
1002
|
+
},
|
1003
|
+
};
|
1004
|
+
|
1005
|
+
return instance;
|
1006
|
+
}
|
1007
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1008
|
+
rbs_types_bases_class_t *rbs_types_bases_class_new(rbs_allocator_t *allocator, rbs_location_t *location) {
|
1009
|
+
rbs_types_bases_class_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_class_t);
|
1010
|
+
|
1011
|
+
|
1012
|
+
*instance = (rbs_types_bases_class_t) {
|
1013
|
+
.base = (rbs_node_t) {
|
1014
|
+
.type = RBS_TYPES_BASES_CLASS,
|
1015
|
+
.location = location,
|
1016
|
+
},
|
1017
|
+
};
|
1018
|
+
|
1019
|
+
return instance;
|
1020
|
+
}
|
1021
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1022
|
+
rbs_types_bases_instance_t *rbs_types_bases_instance_new(rbs_allocator_t *allocator, rbs_location_t *location) {
|
1023
|
+
rbs_types_bases_instance_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_instance_t);
|
1024
|
+
|
1025
|
+
|
1026
|
+
*instance = (rbs_types_bases_instance_t) {
|
1027
|
+
.base = (rbs_node_t) {
|
1028
|
+
.type = RBS_TYPES_BASES_INSTANCE,
|
1029
|
+
.location = location,
|
1030
|
+
},
|
1031
|
+
};
|
1032
|
+
|
1033
|
+
return instance;
|
1034
|
+
}
|
1035
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1036
|
+
rbs_types_bases_nil_t *rbs_types_bases_nil_new(rbs_allocator_t *allocator, rbs_location_t *location) {
|
1037
|
+
rbs_types_bases_nil_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_nil_t);
|
1038
|
+
|
1039
|
+
|
1040
|
+
*instance = (rbs_types_bases_nil_t) {
|
1041
|
+
.base = (rbs_node_t) {
|
1042
|
+
.type = RBS_TYPES_BASES_NIL,
|
1043
|
+
.location = location,
|
1044
|
+
},
|
1045
|
+
};
|
1046
|
+
|
1047
|
+
return instance;
|
1048
|
+
}
|
1049
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1050
|
+
rbs_types_bases_self_t *rbs_types_bases_self_new(rbs_allocator_t *allocator, rbs_location_t *location) {
|
1051
|
+
rbs_types_bases_self_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_self_t);
|
1052
|
+
|
1053
|
+
|
1054
|
+
*instance = (rbs_types_bases_self_t) {
|
1055
|
+
.base = (rbs_node_t) {
|
1056
|
+
.type = RBS_TYPES_BASES_SELF,
|
1057
|
+
.location = location,
|
1058
|
+
},
|
1059
|
+
};
|
1060
|
+
|
1061
|
+
return instance;
|
1062
|
+
}
|
1063
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1064
|
+
rbs_types_bases_top_t *rbs_types_bases_top_new(rbs_allocator_t *allocator, rbs_location_t *location) {
|
1065
|
+
rbs_types_bases_top_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_top_t);
|
1066
|
+
|
1067
|
+
|
1068
|
+
*instance = (rbs_types_bases_top_t) {
|
1069
|
+
.base = (rbs_node_t) {
|
1070
|
+
.type = RBS_TYPES_BASES_TOP,
|
1071
|
+
.location = location,
|
1072
|
+
},
|
1073
|
+
};
|
1074
|
+
|
1075
|
+
return instance;
|
1076
|
+
}
|
1077
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1078
|
+
rbs_types_bases_void_t *rbs_types_bases_void_new(rbs_allocator_t *allocator, rbs_location_t *location) {
|
1079
|
+
rbs_types_bases_void_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_void_t);
|
1080
|
+
|
1081
|
+
|
1082
|
+
*instance = (rbs_types_bases_void_t) {
|
1083
|
+
.base = (rbs_node_t) {
|
1084
|
+
.type = RBS_TYPES_BASES_VOID,
|
1085
|
+
.location = location,
|
1086
|
+
},
|
1087
|
+
};
|
1088
|
+
|
1089
|
+
return instance;
|
1090
|
+
}
|
1091
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1092
|
+
rbs_types_block_t *rbs_types_block_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_node_t *type, bool required, rbs_node_t *self_type) {
|
1093
|
+
rbs_types_block_t *instance = rbs_allocator_alloc(allocator, rbs_types_block_t);
|
1094
|
+
|
1095
|
+
|
1096
|
+
*instance = (rbs_types_block_t) {
|
1097
|
+
.base = (rbs_node_t) {
|
1098
|
+
.type = RBS_TYPES_BLOCK,
|
1099
|
+
.location = location,
|
1100
|
+
},
|
1101
|
+
.type = type,
|
1102
|
+
.required = required,
|
1103
|
+
.self_type = self_type,
|
1104
|
+
};
|
1105
|
+
|
1106
|
+
return instance;
|
1107
|
+
}
|
1108
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1109
|
+
rbs_types_class_instance_t *rbs_types_class_instance_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_type_name_t *name, rbs_node_list_t *args) {
|
1110
|
+
rbs_types_class_instance_t *instance = rbs_allocator_alloc(allocator, rbs_types_class_instance_t);
|
1111
|
+
|
1112
|
+
|
1113
|
+
*instance = (rbs_types_class_instance_t) {
|
1114
|
+
.base = (rbs_node_t) {
|
1115
|
+
.type = RBS_TYPES_CLASS_INSTANCE,
|
1116
|
+
.location = location,
|
1117
|
+
},
|
1118
|
+
.name = name,
|
1119
|
+
.args = args,
|
1120
|
+
};
|
1121
|
+
|
1122
|
+
return instance;
|
1123
|
+
}
|
1124
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1125
|
+
rbs_types_class_singleton_t *rbs_types_class_singleton_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_type_name_t *name) {
|
1126
|
+
rbs_types_class_singleton_t *instance = rbs_allocator_alloc(allocator, rbs_types_class_singleton_t);
|
1127
|
+
|
1128
|
+
|
1129
|
+
*instance = (rbs_types_class_singleton_t) {
|
1130
|
+
.base = (rbs_node_t) {
|
1131
|
+
.type = RBS_TYPES_CLASS_SINGLETON,
|
1132
|
+
.location = location,
|
1133
|
+
},
|
1134
|
+
.name = name,
|
1135
|
+
};
|
1136
|
+
|
1137
|
+
return instance;
|
1138
|
+
}
|
1139
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1140
|
+
rbs_types_function_t *rbs_types_function_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_node_list_t *required_positionals, rbs_node_list_t *optional_positionals, rbs_node_t *rest_positionals, rbs_node_list_t *trailing_positionals, rbs_hash_t *required_keywords, rbs_hash_t *optional_keywords, rbs_node_t *rest_keywords, rbs_node_t *return_type) {
|
1141
|
+
rbs_types_function_t *instance = rbs_allocator_alloc(allocator, rbs_types_function_t);
|
1142
|
+
|
1143
|
+
|
1144
|
+
*instance = (rbs_types_function_t) {
|
1145
|
+
.base = (rbs_node_t) {
|
1146
|
+
.type = RBS_TYPES_FUNCTION,
|
1147
|
+
.location = location,
|
1148
|
+
},
|
1149
|
+
.required_positionals = required_positionals,
|
1150
|
+
.optional_positionals = optional_positionals,
|
1151
|
+
.rest_positionals = rest_positionals,
|
1152
|
+
.trailing_positionals = trailing_positionals,
|
1153
|
+
.required_keywords = required_keywords,
|
1154
|
+
.optional_keywords = optional_keywords,
|
1155
|
+
.rest_keywords = rest_keywords,
|
1156
|
+
.return_type = return_type,
|
1157
|
+
};
|
1158
|
+
|
1159
|
+
return instance;
|
1160
|
+
}
|
1161
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1162
|
+
rbs_types_function_param_t *rbs_types_function_param_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_node_t *type, rbs_ast_symbol_t *name) {
|
1163
|
+
rbs_types_function_param_t *instance = rbs_allocator_alloc(allocator, rbs_types_function_param_t);
|
1164
|
+
|
1165
|
+
|
1166
|
+
*instance = (rbs_types_function_param_t) {
|
1167
|
+
.base = (rbs_node_t) {
|
1168
|
+
.type = RBS_TYPES_FUNCTION_PARAM,
|
1169
|
+
.location = location,
|
1170
|
+
},
|
1171
|
+
.type = type,
|
1172
|
+
.name = name,
|
1173
|
+
};
|
1174
|
+
|
1175
|
+
return instance;
|
1176
|
+
}
|
1177
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1178
|
+
rbs_types_interface_t *rbs_types_interface_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_type_name_t *name, rbs_node_list_t *args) {
|
1179
|
+
rbs_types_interface_t *instance = rbs_allocator_alloc(allocator, rbs_types_interface_t);
|
1180
|
+
|
1181
|
+
|
1182
|
+
*instance = (rbs_types_interface_t) {
|
1183
|
+
.base = (rbs_node_t) {
|
1184
|
+
.type = RBS_TYPES_INTERFACE,
|
1185
|
+
.location = location,
|
1186
|
+
},
|
1187
|
+
.name = name,
|
1188
|
+
.args = args,
|
1189
|
+
};
|
1190
|
+
|
1191
|
+
return instance;
|
1192
|
+
}
|
1193
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1194
|
+
rbs_types_intersection_t *rbs_types_intersection_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_node_list_t *types) {
|
1195
|
+
rbs_types_intersection_t *instance = rbs_allocator_alloc(allocator, rbs_types_intersection_t);
|
1196
|
+
|
1197
|
+
|
1198
|
+
*instance = (rbs_types_intersection_t) {
|
1199
|
+
.base = (rbs_node_t) {
|
1200
|
+
.type = RBS_TYPES_INTERSECTION,
|
1201
|
+
.location = location,
|
1202
|
+
},
|
1203
|
+
.types = types,
|
1204
|
+
};
|
1205
|
+
|
1206
|
+
return instance;
|
1207
|
+
}
|
1208
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1209
|
+
rbs_types_literal_t *rbs_types_literal_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_node_t *literal) {
|
1210
|
+
rbs_types_literal_t *instance = rbs_allocator_alloc(allocator, rbs_types_literal_t);
|
1211
|
+
|
1212
|
+
|
1213
|
+
*instance = (rbs_types_literal_t) {
|
1214
|
+
.base = (rbs_node_t) {
|
1215
|
+
.type = RBS_TYPES_LITERAL,
|
1216
|
+
.location = location,
|
1217
|
+
},
|
1218
|
+
.literal = literal,
|
1219
|
+
};
|
1220
|
+
|
1221
|
+
return instance;
|
1222
|
+
}
|
1223
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1224
|
+
rbs_types_optional_t *rbs_types_optional_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_node_t *type) {
|
1225
|
+
rbs_types_optional_t *instance = rbs_allocator_alloc(allocator, rbs_types_optional_t);
|
1226
|
+
|
1227
|
+
|
1228
|
+
*instance = (rbs_types_optional_t) {
|
1229
|
+
.base = (rbs_node_t) {
|
1230
|
+
.type = RBS_TYPES_OPTIONAL,
|
1231
|
+
.location = location,
|
1232
|
+
},
|
1233
|
+
.type = type,
|
1234
|
+
};
|
1235
|
+
|
1236
|
+
return instance;
|
1237
|
+
}
|
1238
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1239
|
+
rbs_types_proc_t *rbs_types_proc_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_node_t *type, rbs_types_block_t *block, rbs_node_t *self_type) {
|
1240
|
+
rbs_types_proc_t *instance = rbs_allocator_alloc(allocator, rbs_types_proc_t);
|
1241
|
+
|
1242
|
+
|
1243
|
+
*instance = (rbs_types_proc_t) {
|
1244
|
+
.base = (rbs_node_t) {
|
1245
|
+
.type = RBS_TYPES_PROC,
|
1246
|
+
.location = location,
|
1247
|
+
},
|
1248
|
+
.type = type,
|
1249
|
+
.block = block,
|
1250
|
+
.self_type = self_type,
|
1251
|
+
};
|
1252
|
+
|
1253
|
+
return instance;
|
1254
|
+
}
|
1255
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1256
|
+
rbs_types_record_t *rbs_types_record_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_hash_t *all_fields) {
|
1257
|
+
rbs_types_record_t *instance = rbs_allocator_alloc(allocator, rbs_types_record_t);
|
1258
|
+
|
1259
|
+
|
1260
|
+
*instance = (rbs_types_record_t) {
|
1261
|
+
.base = (rbs_node_t) {
|
1262
|
+
.type = RBS_TYPES_RECORD,
|
1263
|
+
.location = location,
|
1264
|
+
},
|
1265
|
+
.all_fields = all_fields,
|
1266
|
+
};
|
1267
|
+
|
1268
|
+
return instance;
|
1269
|
+
}
|
1270
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1271
|
+
rbs_types_record_field_type_t *rbs_types_record_field_type_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_node_t *type, bool required) {
|
1272
|
+
rbs_types_record_field_type_t *instance = rbs_allocator_alloc(allocator, rbs_types_record_field_type_t);
|
1273
|
+
|
1274
|
+
|
1275
|
+
*instance = (rbs_types_record_field_type_t) {
|
1276
|
+
.base = (rbs_node_t) {
|
1277
|
+
.type = RBS_TYPES_RECORD_FIELD_TYPE,
|
1278
|
+
.location = location,
|
1279
|
+
},
|
1280
|
+
.type = type,
|
1281
|
+
.required = required,
|
1282
|
+
};
|
1283
|
+
|
1284
|
+
return instance;
|
1285
|
+
}
|
1286
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1287
|
+
rbs_types_tuple_t *rbs_types_tuple_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_node_list_t *types) {
|
1288
|
+
rbs_types_tuple_t *instance = rbs_allocator_alloc(allocator, rbs_types_tuple_t);
|
1289
|
+
|
1290
|
+
|
1291
|
+
*instance = (rbs_types_tuple_t) {
|
1292
|
+
.base = (rbs_node_t) {
|
1293
|
+
.type = RBS_TYPES_TUPLE,
|
1294
|
+
.location = location,
|
1295
|
+
},
|
1296
|
+
.types = types,
|
1297
|
+
};
|
1298
|
+
|
1299
|
+
return instance;
|
1300
|
+
}
|
1301
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1302
|
+
rbs_types_union_t *rbs_types_union_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_node_list_t *types) {
|
1303
|
+
rbs_types_union_t *instance = rbs_allocator_alloc(allocator, rbs_types_union_t);
|
1304
|
+
|
1305
|
+
|
1306
|
+
*instance = (rbs_types_union_t) {
|
1307
|
+
.base = (rbs_node_t) {
|
1308
|
+
.type = RBS_TYPES_UNION,
|
1309
|
+
.location = location,
|
1310
|
+
},
|
1311
|
+
.types = types,
|
1312
|
+
};
|
1313
|
+
|
1314
|
+
return instance;
|
1315
|
+
}
|
1316
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1317
|
+
rbs_types_untyped_function_t *rbs_types_untyped_function_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_node_t *return_type) {
|
1318
|
+
rbs_types_untyped_function_t *instance = rbs_allocator_alloc(allocator, rbs_types_untyped_function_t);
|
1319
|
+
|
1320
|
+
|
1321
|
+
*instance = (rbs_types_untyped_function_t) {
|
1322
|
+
.base = (rbs_node_t) {
|
1323
|
+
.type = RBS_TYPES_UNTYPED_FUNCTION,
|
1324
|
+
.location = location,
|
1325
|
+
},
|
1326
|
+
.return_type = return_type,
|
1327
|
+
};
|
1328
|
+
|
1329
|
+
return instance;
|
1330
|
+
}
|
1331
|
+
#line 153 "prism/templates/src/ast.c.erb"
|
1332
|
+
rbs_types_variable_t *rbs_types_variable_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_ast_symbol_t *name) {
|
1333
|
+
rbs_types_variable_t *instance = rbs_allocator_alloc(allocator, rbs_types_variable_t);
|
1334
|
+
|
1335
|
+
|
1336
|
+
*instance = (rbs_types_variable_t) {
|
1337
|
+
.base = (rbs_node_t) {
|
1338
|
+
.type = RBS_TYPES_VARIABLE,
|
1339
|
+
.location = location,
|
1340
|
+
},
|
1341
|
+
.name = name,
|
1342
|
+
};
|
1343
|
+
|
1344
|
+
return instance;
|
1345
|
+
}
|