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