rbs 3.7.0.dev.1 → 3.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/.github/workflows/windows.yml +5 -3
- data/.gitignore +1 -0
- data/.rubocop.yml +6 -0
- data/CHANGELOG.md +53 -0
- data/Rakefile +23 -0
- data/config.yml +311 -0
- data/core/dir.rbs +1 -1
- data/core/kernel.rbs +2 -2
- data/core/process.rbs +1 -1
- data/core/set.rbs +1 -1
- data/docs/syntax.md +6 -4
- data/ext/rbs_extension/extconf.rb +10 -0
- data/ext/rbs_extension/parser.c +103 -110
- data/ext/rbs_extension/rbs_extension.h +1 -2
- data/{ext/rbs_extension → include/rbs}/constants.h +21 -19
- data/include/rbs/ruby_objs.h +72 -0
- data/include/rbs.h +7 -0
- data/lib/rbs/collection/config/lockfile_generator.rb +34 -5
- data/lib/rbs/collection/config.rb +2 -2
- data/lib/rbs/environment_loader.rb +5 -0
- data/lib/rbs/prototype/rb.rb +7 -3
- data/lib/rbs/types.rb +10 -3
- data/lib/rbs/version.rb +1 -1
- data/sig/ancestor_graph.rbs +1 -1
- data/sig/collection/config/lockfile_generator.rbs +9 -1
- data/sig/definition.rbs +1 -1
- data/sig/definition_builder.rbs +1 -1
- data/sig/environment.rbs +1 -1
- data/sig/prototype/rb.rbs +1 -1
- data/sig/type_alias_dependency.rbs +2 -2
- data/sig/type_alias_regularity.rbs +1 -1
- data/sig/type_param.rbs +3 -3
- data/sig/vendorer.rbs +1 -1
- data/{ext/rbs_extension → src}/constants.c +35 -36
- data/src/ruby_objs.c +793 -0
- data/stdlib/cgi/0/manifest.yaml +1 -0
- data/stdlib/csv/0/manifest.yaml +1 -0
- data/stdlib/did_you_mean/0/did_you_mean.rbs +1 -1
- data/stdlib/json/0/json.rbs +1 -1
- data/stdlib/minitest/0/kernel.rbs +2 -2
- data/stdlib/minitest/0/minitest/abstract_reporter.rbs +4 -1
- data/stdlib/minitest/0/minitest/assertion.rbs +1 -0
- data/stdlib/minitest/0/minitest/assertions.rbs +58 -13
- data/stdlib/minitest/0/minitest/backtrace_filter.rbs +7 -0
- data/stdlib/minitest/0/minitest/bench_spec.rbs +8 -8
- data/stdlib/minitest/0/minitest/benchmark.rbs +17 -16
- data/stdlib/minitest/0/minitest/compress.rbs +13 -0
- data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
- data/stdlib/minitest/0/minitest/mock.rbs +9 -5
- data/stdlib/minitest/0/minitest/parallel/executor.rbs +4 -0
- data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +0 -1
- data/stdlib/minitest/0/minitest/pride_io.rbs +8 -0
- data/stdlib/minitest/0/minitest/pride_lol.rbs +2 -0
- data/stdlib/minitest/0/minitest/progress_reporter.rbs +1 -1
- data/stdlib/minitest/0/minitest/reportable.rbs +2 -0
- data/stdlib/minitest/0/minitest/runnable.rbs +33 -1
- data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +1 -1
- data/stdlib/minitest/0/minitest/spec/dsl.rbs +10 -6
- data/stdlib/minitest/0/minitest/spec.rbs +1 -1
- data/stdlib/minitest/0/minitest/statistics_reporter.rbs +5 -0
- data/stdlib/minitest/0/minitest/summary_reporter.rbs +0 -7
- data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +1 -1
- data/stdlib/minitest/0/minitest/test.rbs +7 -14
- data/stdlib/minitest/0/minitest/unexpected_error.rbs +2 -0
- data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
- data/stdlib/minitest/0/minitest/unit.rbs +1 -2
- data/stdlib/minitest/0/minitest.rbs +41 -892
- data/stdlib/open-uri/0/manifest.yaml +1 -0
- data/stdlib/openssl/0/manifest.yaml +1 -0
- data/stdlib/openssl/0/openssl.rbs +26 -1
- data/stdlib/psych/0/core_ext.rbs +12 -0
- data/templates/include/rbs/constants.h.erb +20 -0
- data/templates/include/rbs/ruby_objs.h.erb +10 -0
- data/templates/src/constants.c.erb +36 -0
- data/templates/src/ruby_objs.c.erb +27 -0
- data/templates/template.rb +122 -0
- metadata +19 -9
- data/ext/rbs_extension/ruby_objs.c +0 -602
- data/ext/rbs_extension/ruby_objs.h +0 -51
- data/stdlib/minitest/0/manifest.yaml +0 -2
- /data/{core/string_io.rbs → stdlib/stringio/0/stringio.rbs} +0 -0
data/src/ruby_objs.c
ADDED
@@ -0,0 +1,793 @@
|
|
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/ruby_objs.c.erb */
|
6
|
+
/*----------------------------------------------------------------------------*/
|
7
|
+
|
8
|
+
#include "rbs_extension.h"
|
9
|
+
|
10
|
+
#ifdef RB_PASS_KEYWORDS
|
11
|
+
// Ruby 2.7 or later
|
12
|
+
#define CLASS_NEW_INSTANCE(klass, argc, argv)\
|
13
|
+
rb_class_new_instance_kw(argc, argv, klass, RB_PASS_KEYWORDS)
|
14
|
+
#else
|
15
|
+
// Ruby 2.6
|
16
|
+
#define CLASS_NEW_INSTANCE(receiver, argc, argv)\
|
17
|
+
rb_class_new_instance(argc, argv, receiver)
|
18
|
+
#endif
|
19
|
+
|
20
|
+
VALUE rbs_ast_annotation(VALUE string, VALUE location) {
|
21
|
+
VALUE _init_kwargs = rb_hash_new();
|
22
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("string")), string);
|
23
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
24
|
+
|
25
|
+
return CLASS_NEW_INSTANCE(
|
26
|
+
RBS_AST_Annotation,
|
27
|
+
1,
|
28
|
+
&_init_kwargs
|
29
|
+
);
|
30
|
+
}
|
31
|
+
|
32
|
+
VALUE rbs_ast_comment(VALUE string, VALUE location) {
|
33
|
+
VALUE _init_kwargs = rb_hash_new();
|
34
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("string")), string);
|
35
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
36
|
+
|
37
|
+
return CLASS_NEW_INSTANCE(
|
38
|
+
RBS_AST_Comment,
|
39
|
+
1,
|
40
|
+
&_init_kwargs
|
41
|
+
);
|
42
|
+
}
|
43
|
+
|
44
|
+
VALUE rbs_ast_decl_class(VALUE name, VALUE type_params, VALUE super_class, VALUE members, VALUE annotations, VALUE location, VALUE comment) {
|
45
|
+
VALUE _init_kwargs = rb_hash_new();
|
46
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
47
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type_params")), type_params);
|
48
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("super_class")), super_class);
|
49
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("members")), members);
|
50
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations);
|
51
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
52
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
53
|
+
|
54
|
+
return CLASS_NEW_INSTANCE(
|
55
|
+
RBS_AST_Declarations_Class,
|
56
|
+
1,
|
57
|
+
&_init_kwargs
|
58
|
+
);
|
59
|
+
}
|
60
|
+
|
61
|
+
VALUE rbs_ast_decl_class_super(VALUE name, VALUE args, VALUE location) {
|
62
|
+
VALUE _init_kwargs = rb_hash_new();
|
63
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
64
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("args")), args);
|
65
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
66
|
+
|
67
|
+
return CLASS_NEW_INSTANCE(
|
68
|
+
RBS_AST_Declarations_Class_Super,
|
69
|
+
1,
|
70
|
+
&_init_kwargs
|
71
|
+
);
|
72
|
+
}
|
73
|
+
|
74
|
+
VALUE rbs_ast_decl_class_alias(VALUE new_name, VALUE old_name, VALUE location, VALUE comment) {
|
75
|
+
VALUE _init_kwargs = rb_hash_new();
|
76
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("new_name")), new_name);
|
77
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("old_name")), old_name);
|
78
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
79
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
80
|
+
|
81
|
+
return CLASS_NEW_INSTANCE(
|
82
|
+
RBS_AST_Declarations_ClassAlias,
|
83
|
+
1,
|
84
|
+
&_init_kwargs
|
85
|
+
);
|
86
|
+
}
|
87
|
+
|
88
|
+
VALUE rbs_ast_decl_constant(VALUE name, VALUE type, VALUE location, VALUE comment) {
|
89
|
+
VALUE _init_kwargs = rb_hash_new();
|
90
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
91
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type")), type);
|
92
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
93
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
94
|
+
|
95
|
+
return CLASS_NEW_INSTANCE(
|
96
|
+
RBS_AST_Declarations_Constant,
|
97
|
+
1,
|
98
|
+
&_init_kwargs
|
99
|
+
);
|
100
|
+
}
|
101
|
+
|
102
|
+
VALUE rbs_ast_decl_global(VALUE name, VALUE type, VALUE location, VALUE comment) {
|
103
|
+
VALUE _init_kwargs = rb_hash_new();
|
104
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
105
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type")), type);
|
106
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
107
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
108
|
+
|
109
|
+
return CLASS_NEW_INSTANCE(
|
110
|
+
RBS_AST_Declarations_Global,
|
111
|
+
1,
|
112
|
+
&_init_kwargs
|
113
|
+
);
|
114
|
+
}
|
115
|
+
|
116
|
+
VALUE rbs_ast_decl_interface(VALUE name, VALUE type_params, VALUE members, VALUE annotations, VALUE location, VALUE comment) {
|
117
|
+
VALUE _init_kwargs = rb_hash_new();
|
118
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
119
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type_params")), type_params);
|
120
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("members")), members);
|
121
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations);
|
122
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
123
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
124
|
+
|
125
|
+
return CLASS_NEW_INSTANCE(
|
126
|
+
RBS_AST_Declarations_Interface,
|
127
|
+
1,
|
128
|
+
&_init_kwargs
|
129
|
+
);
|
130
|
+
}
|
131
|
+
|
132
|
+
VALUE rbs_ast_decl_module(VALUE name, VALUE type_params, VALUE self_types, VALUE members, VALUE annotations, VALUE location, VALUE comment) {
|
133
|
+
VALUE _init_kwargs = rb_hash_new();
|
134
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
135
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type_params")), type_params);
|
136
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("self_types")), self_types);
|
137
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("members")), members);
|
138
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations);
|
139
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
140
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
141
|
+
|
142
|
+
return CLASS_NEW_INSTANCE(
|
143
|
+
RBS_AST_Declarations_Module,
|
144
|
+
1,
|
145
|
+
&_init_kwargs
|
146
|
+
);
|
147
|
+
}
|
148
|
+
|
149
|
+
VALUE rbs_ast_decl_module_self(VALUE name, VALUE args, VALUE location) {
|
150
|
+
VALUE _init_kwargs = rb_hash_new();
|
151
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
152
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("args")), args);
|
153
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
154
|
+
|
155
|
+
return CLASS_NEW_INSTANCE(
|
156
|
+
RBS_AST_Declarations_Module_Self,
|
157
|
+
1,
|
158
|
+
&_init_kwargs
|
159
|
+
);
|
160
|
+
}
|
161
|
+
|
162
|
+
VALUE rbs_ast_decl_module_alias(VALUE new_name, VALUE old_name, VALUE location, VALUE comment) {
|
163
|
+
VALUE _init_kwargs = rb_hash_new();
|
164
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("new_name")), new_name);
|
165
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("old_name")), old_name);
|
166
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
167
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
168
|
+
|
169
|
+
return CLASS_NEW_INSTANCE(
|
170
|
+
RBS_AST_Declarations_ModuleAlias,
|
171
|
+
1,
|
172
|
+
&_init_kwargs
|
173
|
+
);
|
174
|
+
}
|
175
|
+
|
176
|
+
VALUE rbs_ast_decl_type_alias(VALUE name, VALUE type_params, VALUE type, VALUE annotations, VALUE location, VALUE comment) {
|
177
|
+
VALUE _init_kwargs = rb_hash_new();
|
178
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
179
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type_params")), type_params);
|
180
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type")), type);
|
181
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations);
|
182
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
183
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
184
|
+
|
185
|
+
return CLASS_NEW_INSTANCE(
|
186
|
+
RBS_AST_Declarations_TypeAlias,
|
187
|
+
1,
|
188
|
+
&_init_kwargs
|
189
|
+
);
|
190
|
+
}
|
191
|
+
|
192
|
+
VALUE rbs_ast_directives_use(VALUE clauses, VALUE location) {
|
193
|
+
VALUE _init_kwargs = rb_hash_new();
|
194
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("clauses")), clauses);
|
195
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
196
|
+
|
197
|
+
return CLASS_NEW_INSTANCE(
|
198
|
+
RBS_AST_Directives_Use,
|
199
|
+
1,
|
200
|
+
&_init_kwargs
|
201
|
+
);
|
202
|
+
}
|
203
|
+
|
204
|
+
VALUE rbs_ast_directives_use_single_clause(VALUE type_name, VALUE new_name, VALUE location) {
|
205
|
+
VALUE _init_kwargs = rb_hash_new();
|
206
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type_name")), type_name);
|
207
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("new_name")), new_name);
|
208
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
209
|
+
|
210
|
+
return CLASS_NEW_INSTANCE(
|
211
|
+
RBS_AST_Directives_Use_SingleClause,
|
212
|
+
1,
|
213
|
+
&_init_kwargs
|
214
|
+
);
|
215
|
+
}
|
216
|
+
|
217
|
+
VALUE rbs_ast_directives_use_wildcard_clause(VALUE namespace, VALUE location) {
|
218
|
+
VALUE _init_kwargs = rb_hash_new();
|
219
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("namespace")), namespace);
|
220
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
221
|
+
|
222
|
+
return CLASS_NEW_INSTANCE(
|
223
|
+
RBS_AST_Directives_Use_WildcardClause,
|
224
|
+
1,
|
225
|
+
&_init_kwargs
|
226
|
+
);
|
227
|
+
}
|
228
|
+
|
229
|
+
VALUE rbs_ast_members_alias(VALUE new_name, VALUE old_name, VALUE kind, VALUE annotations, VALUE location, VALUE comment) {
|
230
|
+
VALUE _init_kwargs = rb_hash_new();
|
231
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("new_name")), new_name);
|
232
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("old_name")), old_name);
|
233
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("kind")), kind);
|
234
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations);
|
235
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
236
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
237
|
+
|
238
|
+
return CLASS_NEW_INSTANCE(
|
239
|
+
RBS_AST_Members_Alias,
|
240
|
+
1,
|
241
|
+
&_init_kwargs
|
242
|
+
);
|
243
|
+
}
|
244
|
+
|
245
|
+
VALUE rbs_ast_members_attr_accessor(VALUE name, VALUE type, VALUE ivar_name, VALUE kind, VALUE annotations, VALUE location, VALUE comment, VALUE visibility) {
|
246
|
+
VALUE _init_kwargs = rb_hash_new();
|
247
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
248
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type")), type);
|
249
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("ivar_name")), ivar_name);
|
250
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("kind")), kind);
|
251
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations);
|
252
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
253
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
254
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("visibility")), visibility);
|
255
|
+
|
256
|
+
return CLASS_NEW_INSTANCE(
|
257
|
+
RBS_AST_Members_AttrAccessor,
|
258
|
+
1,
|
259
|
+
&_init_kwargs
|
260
|
+
);
|
261
|
+
}
|
262
|
+
|
263
|
+
VALUE rbs_ast_members_attr_reader(VALUE name, VALUE type, VALUE ivar_name, VALUE kind, VALUE annotations, VALUE location, VALUE comment, VALUE visibility) {
|
264
|
+
VALUE _init_kwargs = rb_hash_new();
|
265
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
266
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type")), type);
|
267
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("ivar_name")), ivar_name);
|
268
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("kind")), kind);
|
269
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations);
|
270
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
271
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
272
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("visibility")), visibility);
|
273
|
+
|
274
|
+
return CLASS_NEW_INSTANCE(
|
275
|
+
RBS_AST_Members_AttrReader,
|
276
|
+
1,
|
277
|
+
&_init_kwargs
|
278
|
+
);
|
279
|
+
}
|
280
|
+
|
281
|
+
VALUE rbs_ast_members_attr_writer(VALUE name, VALUE type, VALUE ivar_name, VALUE kind, VALUE annotations, VALUE location, VALUE comment, VALUE visibility) {
|
282
|
+
VALUE _init_kwargs = rb_hash_new();
|
283
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
284
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type")), type);
|
285
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("ivar_name")), ivar_name);
|
286
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("kind")), kind);
|
287
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations);
|
288
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
289
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
290
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("visibility")), visibility);
|
291
|
+
|
292
|
+
return CLASS_NEW_INSTANCE(
|
293
|
+
RBS_AST_Members_AttrWriter,
|
294
|
+
1,
|
295
|
+
&_init_kwargs
|
296
|
+
);
|
297
|
+
}
|
298
|
+
|
299
|
+
VALUE rbs_ast_members_class_instance_variable(VALUE name, VALUE type, VALUE location, VALUE comment) {
|
300
|
+
VALUE _init_kwargs = rb_hash_new();
|
301
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
302
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type")), type);
|
303
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
304
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
305
|
+
|
306
|
+
return CLASS_NEW_INSTANCE(
|
307
|
+
RBS_AST_Members_ClassInstanceVariable,
|
308
|
+
1,
|
309
|
+
&_init_kwargs
|
310
|
+
);
|
311
|
+
}
|
312
|
+
|
313
|
+
VALUE rbs_ast_members_class_variable(VALUE name, VALUE type, VALUE location, VALUE comment) {
|
314
|
+
VALUE _init_kwargs = rb_hash_new();
|
315
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
316
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type")), type);
|
317
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
318
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
319
|
+
|
320
|
+
return CLASS_NEW_INSTANCE(
|
321
|
+
RBS_AST_Members_ClassVariable,
|
322
|
+
1,
|
323
|
+
&_init_kwargs
|
324
|
+
);
|
325
|
+
}
|
326
|
+
|
327
|
+
VALUE rbs_ast_members_extend(VALUE name, VALUE args, VALUE annotations, VALUE location, VALUE comment) {
|
328
|
+
VALUE _init_kwargs = rb_hash_new();
|
329
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
330
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("args")), args);
|
331
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations);
|
332
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
333
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
334
|
+
|
335
|
+
return CLASS_NEW_INSTANCE(
|
336
|
+
RBS_AST_Members_Extend,
|
337
|
+
1,
|
338
|
+
&_init_kwargs
|
339
|
+
);
|
340
|
+
}
|
341
|
+
|
342
|
+
VALUE rbs_ast_members_include(VALUE name, VALUE args, VALUE annotations, VALUE location, VALUE comment) {
|
343
|
+
VALUE _init_kwargs = rb_hash_new();
|
344
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
345
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("args")), args);
|
346
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations);
|
347
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
348
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
349
|
+
|
350
|
+
return CLASS_NEW_INSTANCE(
|
351
|
+
RBS_AST_Members_Include,
|
352
|
+
1,
|
353
|
+
&_init_kwargs
|
354
|
+
);
|
355
|
+
}
|
356
|
+
|
357
|
+
VALUE rbs_ast_members_instance_variable(VALUE name, VALUE type, VALUE location, VALUE comment) {
|
358
|
+
VALUE _init_kwargs = rb_hash_new();
|
359
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
360
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type")), type);
|
361
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
362
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
363
|
+
|
364
|
+
return CLASS_NEW_INSTANCE(
|
365
|
+
RBS_AST_Members_InstanceVariable,
|
366
|
+
1,
|
367
|
+
&_init_kwargs
|
368
|
+
);
|
369
|
+
}
|
370
|
+
|
371
|
+
VALUE rbs_ast_members_method_definition(VALUE name, VALUE kind, VALUE overloads, VALUE annotations, VALUE location, VALUE comment, VALUE overloading, VALUE visibility) {
|
372
|
+
VALUE _init_kwargs = rb_hash_new();
|
373
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
374
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("kind")), kind);
|
375
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("overloads")), overloads);
|
376
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations);
|
377
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
378
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
379
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("overloading")), overloading);
|
380
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("visibility")), visibility);
|
381
|
+
|
382
|
+
return CLASS_NEW_INSTANCE(
|
383
|
+
RBS_AST_Members_MethodDefinition,
|
384
|
+
1,
|
385
|
+
&_init_kwargs
|
386
|
+
);
|
387
|
+
}
|
388
|
+
|
389
|
+
VALUE rbs_ast_members_method_definition_overload(VALUE annotations, VALUE method_type) {
|
390
|
+
VALUE _init_kwargs = rb_hash_new();
|
391
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations);
|
392
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("method_type")), method_type);
|
393
|
+
|
394
|
+
return CLASS_NEW_INSTANCE(
|
395
|
+
RBS_AST_Members_MethodDefinition_Overload,
|
396
|
+
1,
|
397
|
+
&_init_kwargs
|
398
|
+
);
|
399
|
+
}
|
400
|
+
|
401
|
+
VALUE rbs_ast_members_prepend(VALUE name, VALUE args, VALUE annotations, VALUE location, VALUE comment) {
|
402
|
+
VALUE _init_kwargs = rb_hash_new();
|
403
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
404
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("args")), args);
|
405
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations);
|
406
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
407
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment")), comment);
|
408
|
+
|
409
|
+
return CLASS_NEW_INSTANCE(
|
410
|
+
RBS_AST_Members_Prepend,
|
411
|
+
1,
|
412
|
+
&_init_kwargs
|
413
|
+
);
|
414
|
+
}
|
415
|
+
|
416
|
+
VALUE rbs_ast_members_private(VALUE location) {
|
417
|
+
VALUE _init_kwargs = rb_hash_new();
|
418
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
419
|
+
|
420
|
+
return CLASS_NEW_INSTANCE(
|
421
|
+
RBS_AST_Members_Private,
|
422
|
+
1,
|
423
|
+
&_init_kwargs
|
424
|
+
);
|
425
|
+
}
|
426
|
+
|
427
|
+
VALUE rbs_ast_members_public(VALUE location) {
|
428
|
+
VALUE _init_kwargs = rb_hash_new();
|
429
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
430
|
+
|
431
|
+
return CLASS_NEW_INSTANCE(
|
432
|
+
RBS_AST_Members_Public,
|
433
|
+
1,
|
434
|
+
&_init_kwargs
|
435
|
+
);
|
436
|
+
}
|
437
|
+
|
438
|
+
VALUE rbs_ast_type_param(VALUE name, VALUE variance, VALUE upper_bound, VALUE default_type, VALUE location) {
|
439
|
+
VALUE _init_kwargs = rb_hash_new();
|
440
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
441
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("variance")), variance);
|
442
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("upper_bound")), upper_bound);
|
443
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("default_type")), default_type);
|
444
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
445
|
+
|
446
|
+
return CLASS_NEW_INSTANCE(
|
447
|
+
RBS_AST_TypeParam,
|
448
|
+
1,
|
449
|
+
&_init_kwargs
|
450
|
+
);
|
451
|
+
}
|
452
|
+
|
453
|
+
VALUE rbs_method_type(VALUE type_params, VALUE type, VALUE block, VALUE location) {
|
454
|
+
VALUE _init_kwargs = rb_hash_new();
|
455
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type_params")), type_params);
|
456
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type")), type);
|
457
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("block")), block);
|
458
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
459
|
+
|
460
|
+
return CLASS_NEW_INSTANCE(
|
461
|
+
RBS_MethodType,
|
462
|
+
1,
|
463
|
+
&_init_kwargs
|
464
|
+
);
|
465
|
+
}
|
466
|
+
|
467
|
+
VALUE rbs_namespace(VALUE path, VALUE absolute) {
|
468
|
+
VALUE _init_kwargs = rb_hash_new();
|
469
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("path")), path);
|
470
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("absolute")), absolute);
|
471
|
+
|
472
|
+
return CLASS_NEW_INSTANCE(
|
473
|
+
RBS_Namespace,
|
474
|
+
1,
|
475
|
+
&_init_kwargs
|
476
|
+
);
|
477
|
+
}
|
478
|
+
|
479
|
+
VALUE rbs_type_name(VALUE namespace, VALUE name) {
|
480
|
+
VALUE _init_kwargs = rb_hash_new();
|
481
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("namespace")), namespace);
|
482
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
483
|
+
|
484
|
+
return CLASS_NEW_INSTANCE(
|
485
|
+
RBS_TypeName,
|
486
|
+
1,
|
487
|
+
&_init_kwargs
|
488
|
+
);
|
489
|
+
}
|
490
|
+
|
491
|
+
VALUE rbs_alias(VALUE name, VALUE args, VALUE location) {
|
492
|
+
VALUE _init_kwargs = rb_hash_new();
|
493
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
494
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("args")), args);
|
495
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
496
|
+
|
497
|
+
return CLASS_NEW_INSTANCE(
|
498
|
+
RBS_Types_Alias,
|
499
|
+
1,
|
500
|
+
&_init_kwargs
|
501
|
+
);
|
502
|
+
}
|
503
|
+
|
504
|
+
VALUE rbs_bases_any(VALUE location) {
|
505
|
+
VALUE _init_kwargs = rb_hash_new();
|
506
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
507
|
+
|
508
|
+
return CLASS_NEW_INSTANCE(
|
509
|
+
RBS_Types_Bases_Any,
|
510
|
+
1,
|
511
|
+
&_init_kwargs
|
512
|
+
);
|
513
|
+
}
|
514
|
+
|
515
|
+
VALUE rbs_bases_bool(VALUE location) {
|
516
|
+
VALUE _init_kwargs = rb_hash_new();
|
517
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
518
|
+
|
519
|
+
return CLASS_NEW_INSTANCE(
|
520
|
+
RBS_Types_Bases_Bool,
|
521
|
+
1,
|
522
|
+
&_init_kwargs
|
523
|
+
);
|
524
|
+
}
|
525
|
+
|
526
|
+
VALUE rbs_bases_bottom(VALUE location) {
|
527
|
+
VALUE _init_kwargs = rb_hash_new();
|
528
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
529
|
+
|
530
|
+
return CLASS_NEW_INSTANCE(
|
531
|
+
RBS_Types_Bases_Bottom,
|
532
|
+
1,
|
533
|
+
&_init_kwargs
|
534
|
+
);
|
535
|
+
}
|
536
|
+
|
537
|
+
VALUE rbs_bases_class(VALUE location) {
|
538
|
+
VALUE _init_kwargs = rb_hash_new();
|
539
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
540
|
+
|
541
|
+
return CLASS_NEW_INSTANCE(
|
542
|
+
RBS_Types_Bases_Class,
|
543
|
+
1,
|
544
|
+
&_init_kwargs
|
545
|
+
);
|
546
|
+
}
|
547
|
+
|
548
|
+
VALUE rbs_bases_instance(VALUE location) {
|
549
|
+
VALUE _init_kwargs = rb_hash_new();
|
550
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
551
|
+
|
552
|
+
return CLASS_NEW_INSTANCE(
|
553
|
+
RBS_Types_Bases_Instance,
|
554
|
+
1,
|
555
|
+
&_init_kwargs
|
556
|
+
);
|
557
|
+
}
|
558
|
+
|
559
|
+
VALUE rbs_bases_nil(VALUE location) {
|
560
|
+
VALUE _init_kwargs = rb_hash_new();
|
561
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
562
|
+
|
563
|
+
return CLASS_NEW_INSTANCE(
|
564
|
+
RBS_Types_Bases_Nil,
|
565
|
+
1,
|
566
|
+
&_init_kwargs
|
567
|
+
);
|
568
|
+
}
|
569
|
+
|
570
|
+
VALUE rbs_bases_self(VALUE location) {
|
571
|
+
VALUE _init_kwargs = rb_hash_new();
|
572
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
573
|
+
|
574
|
+
return CLASS_NEW_INSTANCE(
|
575
|
+
RBS_Types_Bases_Self,
|
576
|
+
1,
|
577
|
+
&_init_kwargs
|
578
|
+
);
|
579
|
+
}
|
580
|
+
|
581
|
+
VALUE rbs_bases_top(VALUE location) {
|
582
|
+
VALUE _init_kwargs = rb_hash_new();
|
583
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
584
|
+
|
585
|
+
return CLASS_NEW_INSTANCE(
|
586
|
+
RBS_Types_Bases_Top,
|
587
|
+
1,
|
588
|
+
&_init_kwargs
|
589
|
+
);
|
590
|
+
}
|
591
|
+
|
592
|
+
VALUE rbs_bases_void(VALUE location) {
|
593
|
+
VALUE _init_kwargs = rb_hash_new();
|
594
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
595
|
+
|
596
|
+
return CLASS_NEW_INSTANCE(
|
597
|
+
RBS_Types_Bases_Void,
|
598
|
+
1,
|
599
|
+
&_init_kwargs
|
600
|
+
);
|
601
|
+
}
|
602
|
+
|
603
|
+
VALUE rbs_block(VALUE type, VALUE required, VALUE self_type) {
|
604
|
+
VALUE _init_kwargs = rb_hash_new();
|
605
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type")), type);
|
606
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("required")), required);
|
607
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("self_type")), self_type);
|
608
|
+
|
609
|
+
return CLASS_NEW_INSTANCE(
|
610
|
+
RBS_Types_Block,
|
611
|
+
1,
|
612
|
+
&_init_kwargs
|
613
|
+
);
|
614
|
+
}
|
615
|
+
|
616
|
+
VALUE rbs_class_instance(VALUE name, VALUE args, VALUE location) {
|
617
|
+
VALUE _init_kwargs = rb_hash_new();
|
618
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
619
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("args")), args);
|
620
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
621
|
+
|
622
|
+
return CLASS_NEW_INSTANCE(
|
623
|
+
RBS_Types_ClassInstance,
|
624
|
+
1,
|
625
|
+
&_init_kwargs
|
626
|
+
);
|
627
|
+
}
|
628
|
+
|
629
|
+
VALUE rbs_class_singleton(VALUE name, VALUE location) {
|
630
|
+
VALUE _init_kwargs = rb_hash_new();
|
631
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
632
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
633
|
+
|
634
|
+
return CLASS_NEW_INSTANCE(
|
635
|
+
RBS_Types_ClassSingleton,
|
636
|
+
1,
|
637
|
+
&_init_kwargs
|
638
|
+
);
|
639
|
+
}
|
640
|
+
|
641
|
+
VALUE rbs_function(VALUE required_positionals, VALUE optional_positionals, VALUE rest_positionals, VALUE trailing_positionals, VALUE required_keywords, VALUE optional_keywords, VALUE rest_keywords, VALUE return_type) {
|
642
|
+
VALUE _init_kwargs = rb_hash_new();
|
643
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("required_positionals")), required_positionals);
|
644
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("optional_positionals")), optional_positionals);
|
645
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("rest_positionals")), rest_positionals);
|
646
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("trailing_positionals")), trailing_positionals);
|
647
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("required_keywords")), required_keywords);
|
648
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("optional_keywords")), optional_keywords);
|
649
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("rest_keywords")), rest_keywords);
|
650
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("return_type")), return_type);
|
651
|
+
|
652
|
+
return CLASS_NEW_INSTANCE(
|
653
|
+
RBS_Types_Function,
|
654
|
+
1,
|
655
|
+
&_init_kwargs
|
656
|
+
);
|
657
|
+
}
|
658
|
+
|
659
|
+
VALUE rbs_function_param(VALUE type, VALUE name, VALUE location) {
|
660
|
+
VALUE _init_kwargs = rb_hash_new();
|
661
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type")), type);
|
662
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
663
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
664
|
+
|
665
|
+
return CLASS_NEW_INSTANCE(
|
666
|
+
RBS_Types_Function_Param,
|
667
|
+
1,
|
668
|
+
&_init_kwargs
|
669
|
+
);
|
670
|
+
}
|
671
|
+
|
672
|
+
VALUE rbs_interface(VALUE name, VALUE args, VALUE location) {
|
673
|
+
VALUE _init_kwargs = rb_hash_new();
|
674
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
675
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("args")), args);
|
676
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
677
|
+
|
678
|
+
return CLASS_NEW_INSTANCE(
|
679
|
+
RBS_Types_Interface,
|
680
|
+
1,
|
681
|
+
&_init_kwargs
|
682
|
+
);
|
683
|
+
}
|
684
|
+
|
685
|
+
VALUE rbs_intersection(VALUE types, VALUE location) {
|
686
|
+
VALUE _init_kwargs = rb_hash_new();
|
687
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("types")), types);
|
688
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
689
|
+
|
690
|
+
return CLASS_NEW_INSTANCE(
|
691
|
+
RBS_Types_Intersection,
|
692
|
+
1,
|
693
|
+
&_init_kwargs
|
694
|
+
);
|
695
|
+
}
|
696
|
+
|
697
|
+
VALUE rbs_literal(VALUE literal, VALUE location) {
|
698
|
+
VALUE _init_kwargs = rb_hash_new();
|
699
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("literal")), literal);
|
700
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
701
|
+
|
702
|
+
return CLASS_NEW_INSTANCE(
|
703
|
+
RBS_Types_Literal,
|
704
|
+
1,
|
705
|
+
&_init_kwargs
|
706
|
+
);
|
707
|
+
}
|
708
|
+
|
709
|
+
VALUE rbs_optional(VALUE type, VALUE location) {
|
710
|
+
VALUE _init_kwargs = rb_hash_new();
|
711
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type")), type);
|
712
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
713
|
+
|
714
|
+
return CLASS_NEW_INSTANCE(
|
715
|
+
RBS_Types_Optional,
|
716
|
+
1,
|
717
|
+
&_init_kwargs
|
718
|
+
);
|
719
|
+
}
|
720
|
+
|
721
|
+
VALUE rbs_proc(VALUE type, VALUE block, VALUE location, VALUE self_type) {
|
722
|
+
VALUE _init_kwargs = rb_hash_new();
|
723
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type")), type);
|
724
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("block")), block);
|
725
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
726
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("self_type")), self_type);
|
727
|
+
|
728
|
+
return CLASS_NEW_INSTANCE(
|
729
|
+
RBS_Types_Proc,
|
730
|
+
1,
|
731
|
+
&_init_kwargs
|
732
|
+
);
|
733
|
+
}
|
734
|
+
|
735
|
+
VALUE rbs_record(VALUE all_fields, VALUE location) {
|
736
|
+
VALUE _init_kwargs = rb_hash_new();
|
737
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("all_fields")), all_fields);
|
738
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
739
|
+
|
740
|
+
return CLASS_NEW_INSTANCE(
|
741
|
+
RBS_Types_Record,
|
742
|
+
1,
|
743
|
+
&_init_kwargs
|
744
|
+
);
|
745
|
+
}
|
746
|
+
|
747
|
+
VALUE rbs_tuple(VALUE types, VALUE location) {
|
748
|
+
VALUE _init_kwargs = rb_hash_new();
|
749
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("types")), types);
|
750
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
751
|
+
|
752
|
+
return CLASS_NEW_INSTANCE(
|
753
|
+
RBS_Types_Tuple,
|
754
|
+
1,
|
755
|
+
&_init_kwargs
|
756
|
+
);
|
757
|
+
}
|
758
|
+
|
759
|
+
VALUE rbs_union(VALUE types, VALUE location) {
|
760
|
+
VALUE _init_kwargs = rb_hash_new();
|
761
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("types")), types);
|
762
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
763
|
+
|
764
|
+
return CLASS_NEW_INSTANCE(
|
765
|
+
RBS_Types_Union,
|
766
|
+
1,
|
767
|
+
&_init_kwargs
|
768
|
+
);
|
769
|
+
}
|
770
|
+
|
771
|
+
VALUE rbs_untyped_function(VALUE return_type) {
|
772
|
+
VALUE _init_kwargs = rb_hash_new();
|
773
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("return_type")), return_type);
|
774
|
+
|
775
|
+
return CLASS_NEW_INSTANCE(
|
776
|
+
RBS_Types_UntypedFunction,
|
777
|
+
1,
|
778
|
+
&_init_kwargs
|
779
|
+
);
|
780
|
+
}
|
781
|
+
|
782
|
+
VALUE rbs_variable(VALUE name, VALUE location) {
|
783
|
+
VALUE _init_kwargs = rb_hash_new();
|
784
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name);
|
785
|
+
rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location);
|
786
|
+
|
787
|
+
return CLASS_NEW_INSTANCE(
|
788
|
+
RBS_Types_Variable,
|
789
|
+
1,
|
790
|
+
&_init_kwargs
|
791
|
+
);
|
792
|
+
}
|
793
|
+
|