rbs 4.0.0.dev.5 → 4.0.1.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/.clang-format +1 -0
- data/.github/workflows/c-check.yml +8 -4
- data/.github/workflows/comments.yml +3 -1
- data/.github/workflows/dependabot.yml +1 -1
- data/.github/workflows/ruby.yml +10 -0
- data/.github/workflows/rust.yml +95 -0
- data/CHANGELOG.md +323 -0
- data/Rakefile +12 -29
- data/Steepfile +1 -0
- data/config.yml +393 -37
- data/core/array.rbs +218 -188
- data/core/basic_object.rbs +9 -8
- data/core/class.rbs +6 -5
- data/core/comparable.rbs +45 -31
- data/core/complex.rbs +52 -40
- data/core/dir.rbs +57 -45
- data/core/encoding.rbs +5 -5
- data/core/enumerable.rbs +96 -91
- data/core/enumerator.rbs +4 -3
- data/core/errno.rbs +3 -2
- data/core/errors.rbs +31 -29
- data/core/exception.rbs +12 -12
- data/core/fiber.rbs +36 -36
- data/core/file.rbs +186 -113
- data/core/file_test.rbs +2 -2
- data/core/float.rbs +41 -32
- data/core/gc.rbs +78 -70
- data/core/hash.rbs +70 -60
- data/core/integer.rbs +32 -28
- data/core/io/buffer.rbs +36 -36
- data/core/io/wait.rbs +7 -7
- data/core/io.rbs +120 -135
- data/core/kernel.rbs +189 -139
- data/core/marshal.rbs +3 -3
- data/core/match_data.rbs +14 -12
- data/core/math.rbs +69 -67
- data/core/method.rbs +6 -6
- data/core/module.rbs +146 -85
- data/core/nil_class.rbs +4 -3
- data/core/numeric.rbs +35 -32
- data/core/object.rbs +6 -8
- data/core/object_space.rbs +11 -10
- data/core/pathname.rbs +131 -81
- data/core/proc.rbs +65 -33
- data/core/process.rbs +219 -201
- data/core/ractor.rbs +15 -11
- data/core/random.rbs +4 -3
- data/core/range.rbs +52 -47
- data/core/rational.rbs +5 -5
- data/core/rbs/unnamed/argf.rbs +58 -51
- data/core/rbs/unnamed/env_class.rbs +18 -13
- data/core/rbs/unnamed/main_class.rbs +123 -0
- data/core/rbs/unnamed/random.rbs +7 -5
- data/core/regexp.rbs +236 -197
- data/core/ruby.rbs +1 -1
- data/core/ruby_vm.rbs +32 -30
- data/core/rubygems/config_file.rbs +5 -5
- data/core/rubygems/errors.rbs +1 -1
- data/core/rubygems/requirement.rbs +5 -5
- data/core/rubygems/rubygems.rbs +5 -3
- data/core/set.rbs +17 -16
- data/core/signal.rbs +2 -2
- data/core/string.rbs +311 -292
- data/core/struct.rbs +26 -25
- data/core/symbol.rbs +25 -24
- data/core/thread.rbs +40 -34
- data/core/time.rbs +47 -42
- data/core/trace_point.rbs +34 -31
- data/core/true_class.rbs +2 -2
- data/core/unbound_method.rbs +10 -10
- data/core/warning.rbs +7 -7
- data/docs/collection.md +1 -1
- data/docs/config.md +171 -0
- data/docs/inline.md +110 -4
- data/docs/syntax.md +13 -12
- data/ext/rbs_extension/ast_translation.c +489 -135
- data/ext/rbs_extension/class_constants.c +8 -0
- data/ext/rbs_extension/class_constants.h +4 -0
- data/ext/rbs_extension/legacy_location.c +28 -51
- data/ext/rbs_extension/legacy_location.h +37 -0
- data/ext/rbs_extension/main.c +12 -20
- data/include/rbs/ast.h +423 -195
- data/include/rbs/lexer.h +2 -2
- data/include/rbs/location.h +25 -44
- data/include/rbs/parser.h +2 -2
- data/include/rbs/util/rbs_constant_pool.h +0 -3
- data/include/rbs.h +8 -0
- data/lib/rbs/ast/ruby/annotations.rb +157 -4
- data/lib/rbs/ast/ruby/members.rb +374 -22
- data/lib/rbs/cli/validate.rb +5 -60
- data/lib/rbs/collection/config/lockfile_generator.rb +6 -2
- data/lib/rbs/definition_builder.rb +60 -27
- data/lib/rbs/errors.rb +0 -11
- data/lib/rbs/inline_parser.rb +1 -1
- data/lib/rbs/parser_aux.rb +20 -7
- data/lib/rbs/prototype/helpers.rb +57 -0
- data/lib/rbs/prototype/rb.rb +1 -26
- data/lib/rbs/prototype/rbi.rb +1 -20
- data/lib/rbs/test/type_check.rb +3 -0
- data/lib/rbs/types.rb +62 -52
- data/lib/rbs/unit_test/type_assertions.rb +35 -8
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +0 -1
- data/rbs.gemspec +1 -1
- data/rust/.gitignore +1 -0
- data/rust/Cargo.lock +378 -0
- data/rust/Cargo.toml +7 -0
- data/rust/ruby-rbs/Cargo.toml +22 -0
- data/rust/ruby-rbs/build.rs +764 -0
- data/rust/ruby-rbs/examples/locations.rs +60 -0
- data/rust/ruby-rbs/src/lib.rs +1 -0
- data/rust/ruby-rbs/src/node/mod.rs +742 -0
- data/rust/ruby-rbs/tests/sanity.rs +47 -0
- data/rust/ruby-rbs/vendor/rbs/config.yml +1 -0
- data/rust/ruby-rbs-sys/Cargo.toml +23 -0
- data/rust/ruby-rbs-sys/build.rs +204 -0
- data/rust/ruby-rbs-sys/src/lib.rs +50 -0
- data/rust/ruby-rbs-sys/vendor/rbs/include +1 -0
- data/rust/ruby-rbs-sys/vendor/rbs/src +1 -0
- data/rust/ruby-rbs-sys/wrapper.h +1 -0
- data/sig/ast/ruby/annotations.rbs +191 -4
- data/sig/ast/ruby/members.rbs +21 -1
- data/sig/cli/validate.rbs +1 -6
- data/sig/definition_builder.rbs +2 -0
- data/sig/errors.rbs +0 -8
- data/sig/method_types.rbs +1 -1
- data/sig/parser.rbs +17 -13
- data/sig/prototype/helpers.rbs +2 -0
- data/sig/types.rbs +10 -11
- data/sig/unit_test/spy.rbs +0 -8
- data/sig/unit_test/type_assertions.rbs +11 -0
- data/src/ast.c +339 -161
- data/src/lexstate.c +1 -1
- data/src/location.c +7 -47
- data/src/parser.c +674 -480
- data/src/util/rbs_constant_pool.c +0 -4
- data/stdlib/bigdecimal/0/big_decimal.rbs +16 -16
- data/stdlib/cgi-escape/0/escape.rbs +4 -4
- data/stdlib/coverage/0/coverage.rbs +4 -3
- data/stdlib/date/0/date.rbs +33 -28
- data/stdlib/date/0/date_time.rbs +24 -23
- data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
- data/stdlib/erb/0/erb.rbs +64 -53
- data/stdlib/etc/0/etc.rbs +55 -50
- data/stdlib/fileutils/0/fileutils.rbs +138 -125
- data/stdlib/forwardable/0/forwardable.rbs +10 -10
- data/stdlib/io-console/0/io-console.rbs +2 -2
- data/stdlib/json/0/json.rbs +135 -108
- data/stdlib/monitor/0/monitor.rbs +3 -3
- data/stdlib/net-http/0/net-http.rbs +159 -134
- data/stdlib/objspace/0/objspace.rbs +8 -7
- data/stdlib/open-uri/0/open-uri.rbs +8 -8
- data/stdlib/open3/0/open3.rbs +36 -35
- data/stdlib/openssl/0/openssl.rbs +144 -129
- data/stdlib/optparse/0/optparse.rbs +18 -14
- data/stdlib/pathname/0/pathname.rbs +2 -2
- data/stdlib/pp/0/pp.rbs +9 -8
- data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
- data/stdlib/pstore/0/pstore.rbs +35 -30
- data/stdlib/psych/0/psych.rbs +61 -8
- data/stdlib/psych/0/store.rbs +2 -4
- data/stdlib/pty/0/pty.rbs +9 -6
- data/stdlib/random-formatter/0/random-formatter.rbs +2 -2
- data/stdlib/ripper/0/ripper.rbs +20 -17
- data/stdlib/securerandom/0/securerandom.rbs +1 -1
- data/stdlib/shellwords/0/shellwords.rbs +2 -2
- data/stdlib/socket/0/addrinfo.rbs +7 -7
- data/stdlib/socket/0/basic_socket.rbs +3 -3
- data/stdlib/socket/0/ip_socket.rbs +10 -8
- data/stdlib/socket/0/socket.rbs +10 -9
- data/stdlib/socket/0/tcp_server.rbs +1 -1
- data/stdlib/socket/0/tcp_socket.rbs +1 -1
- data/stdlib/socket/0/udp_socket.rbs +1 -1
- data/stdlib/socket/0/unix_server.rbs +1 -1
- data/stdlib/stringio/0/stringio.rbs +55 -54
- data/stdlib/strscan/0/string_scanner.rbs +46 -44
- data/stdlib/tempfile/0/tempfile.rbs +24 -20
- data/stdlib/time/0/time.rbs +7 -5
- data/stdlib/tsort/0/tsort.rbs +7 -6
- data/stdlib/uri/0/common.rbs +26 -18
- data/stdlib/uri/0/file.rbs +2 -2
- data/stdlib/uri/0/generic.rbs +2 -2
- data/stdlib/uri/0/http.rbs +2 -2
- data/stdlib/uri/0/ldap.rbs +2 -2
- data/stdlib/uri/0/mailto.rbs +3 -3
- data/stdlib/uri/0/rfc2396_parser.rbs +6 -5
- data/stdlib/zlib/0/deflate.rbs +4 -3
- data/stdlib/zlib/0/gzip_reader.rbs +4 -4
- data/stdlib/zlib/0/gzip_writer.rbs +14 -12
- data/stdlib/zlib/0/inflate.rbs +1 -1
- data/stdlib/zlib/0/need_dict.rbs +1 -1
- metadata +23 -5
- data/.github/workflows/valgrind.yml +0 -42
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
VALUE EMPTY_ARRAY;
|
|
15
15
|
VALUE EMPTY_HASH;
|
|
16
16
|
|
|
17
|
-
#define
|
|
17
|
+
#define RBS_LOCATION_CHILDREN_SIZE(cap) (sizeof(rbs_location_children) + sizeof(rbs_location_entry) * ((cap) - 1))
|
|
18
|
+
#define RBS_LOCATION_REQUIRED_P(loc, i) ((loc)->children->required_p & (1 << (i)))
|
|
19
|
+
#define RBS_LOCATION_OPTIONAL_P(loc, i) (!RBS_LOCATION_REQUIRED_P((loc), (i)))
|
|
18
20
|
|
|
19
21
|
rbs_translation_context_t rbs_translation_context_create(rbs_constant_pool_t *constant_pool, VALUE buffer, rb_encoding *ruby_encoding) {
|
|
20
22
|
return (rbs_translation_context_t) {
|
|
@@ -50,36 +52,120 @@ VALUE rbs_hash_to_ruby_hash(rbs_translation_context_t ctx, rbs_hash_t *rbs_hash)
|
|
|
50
52
|
return ruby_hash;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
VALUE
|
|
54
|
-
if (
|
|
55
|
+
VALUE rbs_location_range_to_ruby_location(rbs_translation_context_t ctx, rbs_location_range range) {
|
|
56
|
+
if (RBS_LOCATION_NULL_RANGE_P(range)) {
|
|
55
57
|
return Qnil;
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
rbs_loc *new_loc_struct = rbs_check_location(new_loc);
|
|
60
|
-
|
|
61
|
-
if (source_loc->children != NULL) {
|
|
62
|
-
rbs_loc_legacy_alloc_children(new_loc_struct, source_loc->children->cap);
|
|
63
|
-
memcpy(new_loc_struct->children, source_loc->children, RBS_LOC_CHILDREN_SIZE(source_loc->children->cap));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return new_loc;
|
|
60
|
+
return rbs_new_location2(ctx.buffer, range.start_char, range.end_char);
|
|
67
61
|
}
|
|
68
62
|
|
|
69
|
-
VALUE
|
|
63
|
+
VALUE rbs_location_range_list_to_ruby_array(rbs_translation_context_t ctx, rbs_location_range_list_t *list) {
|
|
70
64
|
if (list == NULL) {
|
|
71
65
|
return EMPTY_ARRAY;
|
|
72
66
|
}
|
|
73
67
|
|
|
74
68
|
VALUE ruby_array = rb_ary_new();
|
|
75
69
|
|
|
76
|
-
for (
|
|
77
|
-
rb_ary_push(ruby_array,
|
|
70
|
+
for (rbs_location_range_list_node_t *n = list->head; n != NULL; n = n->next) {
|
|
71
|
+
rb_ary_push(ruby_array, rbs_location_range_to_ruby_location(ctx, n->range));
|
|
78
72
|
}
|
|
79
73
|
|
|
80
74
|
return ruby_array;
|
|
81
75
|
}
|
|
82
76
|
|
|
77
|
+
VALUE rbs_attr_ivar_name_to_ruby(rbs_translation_context_t ctx, rbs_attr_ivar_name_t ivar_name) {
|
|
78
|
+
switch (ivar_name.tag) {
|
|
79
|
+
case RBS_ATTR_IVAR_NAME_TAG_NAME: {
|
|
80
|
+
rbs_constant_t *constant = rbs_constant_pool_id_to_constant(ctx.constant_pool, ivar_name.name);
|
|
81
|
+
assert(constant != NULL && "constant is NULL");
|
|
82
|
+
assert(constant->start != NULL && "constant->start is NULL");
|
|
83
|
+
|
|
84
|
+
return ID2SYM(rb_intern3((const char *) constant->start, constant->length, ctx.encoding));
|
|
85
|
+
}
|
|
86
|
+
case RBS_ATTR_IVAR_NAME_TAG_UNSPECIFIED:
|
|
87
|
+
return Qnil;
|
|
88
|
+
case RBS_ATTR_IVAR_NAME_TAG_EMPTY:
|
|
89
|
+
return Qfalse;
|
|
90
|
+
default:
|
|
91
|
+
rb_fatal("unknown enum rbs_attr_ivar_name_tag ivar_name.tag: %d", ivar_name.tag);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
VALUE rbs_attribute_visibility_to_ruby(enum rbs_attribute_visibility value) {
|
|
96
|
+
switch (value) {
|
|
97
|
+
case RBS_ATTRIBUTE_VISIBILITY_UNSPECIFIED:
|
|
98
|
+
return Qnil;
|
|
99
|
+
case RBS_ATTRIBUTE_VISIBILITY_PUBLIC:
|
|
100
|
+
return rb_id2sym(rb_intern("public"));
|
|
101
|
+
case RBS_ATTRIBUTE_VISIBILITY_PRIVATE:
|
|
102
|
+
return rb_id2sym(rb_intern("private"));
|
|
103
|
+
default:
|
|
104
|
+
rb_fatal("unknown enum rbs_attribute_visibility value: %d", value);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
VALUE rbs_attribute_kind_to_ruby(enum rbs_attribute_kind value) {
|
|
109
|
+
switch (value) {
|
|
110
|
+
case RBS_ATTRIBUTE_KIND_INSTANCE:
|
|
111
|
+
return rb_id2sym(rb_intern("instance"));
|
|
112
|
+
case RBS_ATTRIBUTE_KIND_SINGLETON:
|
|
113
|
+
return rb_id2sym(rb_intern("singleton"));
|
|
114
|
+
default:
|
|
115
|
+
rb_fatal("unknown enum rbs_attribute_kind value: %d", value);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
VALUE rbs_alias_kind_to_ruby(enum rbs_alias_kind value) {
|
|
120
|
+
switch (value) {
|
|
121
|
+
case RBS_ALIAS_KIND_INSTANCE:
|
|
122
|
+
return rb_id2sym(rb_intern("instance"));
|
|
123
|
+
case RBS_ALIAS_KIND_SINGLETON:
|
|
124
|
+
return rb_id2sym(rb_intern("singleton"));
|
|
125
|
+
default:
|
|
126
|
+
rb_fatal("unknown enum rbs_alias_kind value: %d", value);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
VALUE rbs_method_definition_kind_to_ruby(enum rbs_method_definition_kind value) {
|
|
131
|
+
switch (value) {
|
|
132
|
+
case RBS_METHOD_DEFINITION_KIND_INSTANCE:
|
|
133
|
+
return rb_id2sym(rb_intern("instance"));
|
|
134
|
+
case RBS_METHOD_DEFINITION_KIND_SINGLETON:
|
|
135
|
+
return rb_id2sym(rb_intern("singleton"));
|
|
136
|
+
case RBS_METHOD_DEFINITION_KIND_SINGLETON_INSTANCE:
|
|
137
|
+
return rb_id2sym(rb_intern("singleton_instance"));
|
|
138
|
+
default:
|
|
139
|
+
rb_fatal("unknown enum rbs_method_definition_kind value: %d", value);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
VALUE rbs_method_definition_visibility_to_ruby(enum rbs_method_definition_visibility value) {
|
|
144
|
+
switch (value) {
|
|
145
|
+
case RBS_METHOD_DEFINITION_VISIBILITY_UNSPECIFIED:
|
|
146
|
+
return Qnil;
|
|
147
|
+
case RBS_METHOD_DEFINITION_VISIBILITY_PUBLIC:
|
|
148
|
+
return rb_id2sym(rb_intern("public"));
|
|
149
|
+
case RBS_METHOD_DEFINITION_VISIBILITY_PRIVATE:
|
|
150
|
+
return rb_id2sym(rb_intern("private"));
|
|
151
|
+
default:
|
|
152
|
+
rb_fatal("unknown enum rbs_method_definition_visibility value: %d", value);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
VALUE rbs_type_param_variance_to_ruby(enum rbs_type_param_variance value) {
|
|
157
|
+
switch (value) {
|
|
158
|
+
case RBS_TYPE_PARAM_VARIANCE_INVARIANT:
|
|
159
|
+
return rb_id2sym(rb_intern("invariant"));
|
|
160
|
+
case RBS_TYPE_PARAM_VARIANCE_COVARIANT:
|
|
161
|
+
return rb_id2sym(rb_intern("covariant"));
|
|
162
|
+
case RBS_TYPE_PARAM_VARIANCE_CONTRAVARIANT:
|
|
163
|
+
return rb_id2sym(rb_intern("contravariant"));
|
|
164
|
+
default:
|
|
165
|
+
rb_fatal("unknown enum rbs_type_param_variance value: %d", value);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
83
169
|
#ifdef RB_PASS_KEYWORDS
|
|
84
170
|
// Ruby 2.7 or later
|
|
85
171
|
#define CLASS_NEW_INSTANCE(klass, argc, argv) \
|
|
@@ -98,7 +184,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
98
184
|
rbs_ast_annotation_t *node = (rbs_ast_annotation_t *) instance;
|
|
99
185
|
|
|
100
186
|
VALUE h = rb_hash_new();
|
|
101
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
187
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
102
188
|
rb_hash_aset(h, ID2SYM(rb_intern("string")), rbs_string_to_ruby_string(&node->string, ctx.encoding));
|
|
103
189
|
|
|
104
190
|
return CLASS_NEW_INSTANCE(
|
|
@@ -114,7 +200,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
114
200
|
rbs_ast_comment_t *node = (rbs_ast_comment_t *) instance;
|
|
115
201
|
|
|
116
202
|
VALUE h = rb_hash_new();
|
|
117
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
203
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
118
204
|
rb_hash_aset(h, ID2SYM(rb_intern("string")), rbs_string_to_ruby_string(&node->string, ctx.encoding));
|
|
119
205
|
|
|
120
206
|
return CLASS_NEW_INSTANCE(
|
|
@@ -127,7 +213,15 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
127
213
|
rbs_ast_declarations_class_t *node = (rbs_ast_declarations_class_t *) instance;
|
|
128
214
|
|
|
129
215
|
VALUE h = rb_hash_new();
|
|
130
|
-
|
|
216
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
217
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
218
|
+
rbs_loc_legacy_alloc_children(loc, 5);
|
|
219
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("keyword"), (rbs_loc_range) { .start = node->keyword_range.start_char, .end = node->keyword_range.end_char });
|
|
220
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
221
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("end"), (rbs_loc_range) { .start = node->end_range.start_char, .end = node->end_range.end_char });
|
|
222
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("type_params"), (rbs_loc_range) { .start = node->type_params_range.start_char, .end = node->type_params_range.end_char });
|
|
223
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("lt"), (rbs_loc_range) { .start = node->lt_range.start_char, .end = node->lt_range.end_char });
|
|
224
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
131
225
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
132
226
|
rb_hash_aset(h, ID2SYM(rb_intern("type_params")), rbs_node_list_to_ruby_array(ctx, node->type_params));
|
|
133
227
|
rb_hash_aset(h, ID2SYM(rb_intern("super_class")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->super_class)); // rbs_ast_declarations_class_super
|
|
@@ -151,7 +245,12 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
151
245
|
rbs_ast_declarations_class_super_t *node = (rbs_ast_declarations_class_super_t *) instance;
|
|
152
246
|
|
|
153
247
|
VALUE h = rb_hash_new();
|
|
154
|
-
|
|
248
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
249
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
250
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
251
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
252
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("args"), (rbs_loc_range) { .start = node->args_range.start_char, .end = node->args_range.end_char });
|
|
253
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
155
254
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
156
255
|
rb_hash_aset(h, ID2SYM(rb_intern("args")), rbs_node_list_to_ruby_array(ctx, node->args));
|
|
157
256
|
|
|
@@ -165,7 +264,14 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
165
264
|
rbs_ast_declarations_class_alias_t *node = (rbs_ast_declarations_class_alias_t *) instance;
|
|
166
265
|
|
|
167
266
|
VALUE h = rb_hash_new();
|
|
168
|
-
|
|
267
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
268
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
269
|
+
rbs_loc_legacy_alloc_children(loc, 4);
|
|
270
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("keyword"), (rbs_loc_range) { .start = node->keyword_range.start_char, .end = node->keyword_range.end_char });
|
|
271
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("new_name"), (rbs_loc_range) { .start = node->new_name_range.start_char, .end = node->new_name_range.end_char });
|
|
272
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("eq"), (rbs_loc_range) { .start = node->eq_range.start_char, .end = node->eq_range.end_char });
|
|
273
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("old_name"), (rbs_loc_range) { .start = node->old_name_range.start_char, .end = node->old_name_range.end_char });
|
|
274
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
169
275
|
rb_hash_aset(h, ID2SYM(rb_intern("new_name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->new_name)); // rbs_type_name
|
|
170
276
|
rb_hash_aset(h, ID2SYM(rb_intern("old_name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->old_name)); // rbs_type_name
|
|
171
277
|
rb_hash_aset(h, ID2SYM(rb_intern("comment")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment)); // rbs_ast_comment
|
|
@@ -181,7 +287,12 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
181
287
|
rbs_ast_declarations_constant_t *node = (rbs_ast_declarations_constant_t *) instance;
|
|
182
288
|
|
|
183
289
|
VALUE h = rb_hash_new();
|
|
184
|
-
|
|
290
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
291
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
292
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
293
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
294
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("colon"), (rbs_loc_range) { .start = node->colon_range.start_char, .end = node->colon_range.end_char });
|
|
295
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
185
296
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
186
297
|
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
187
298
|
rb_hash_aset(h, ID2SYM(rb_intern("comment")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment)); // rbs_ast_comment
|
|
@@ -197,7 +308,12 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
197
308
|
rbs_ast_declarations_global_t *node = (rbs_ast_declarations_global_t *) instance;
|
|
198
309
|
|
|
199
310
|
VALUE h = rb_hash_new();
|
|
200
|
-
|
|
311
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
312
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
313
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
314
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
315
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("colon"), (rbs_loc_range) { .start = node->colon_range.start_char, .end = node->colon_range.end_char });
|
|
316
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
201
317
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_ast_symbol
|
|
202
318
|
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
203
319
|
rb_hash_aset(h, ID2SYM(rb_intern("comment")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment)); // rbs_ast_comment
|
|
@@ -213,7 +329,14 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
213
329
|
rbs_ast_declarations_interface_t *node = (rbs_ast_declarations_interface_t *) instance;
|
|
214
330
|
|
|
215
331
|
VALUE h = rb_hash_new();
|
|
216
|
-
|
|
332
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
333
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
334
|
+
rbs_loc_legacy_alloc_children(loc, 4);
|
|
335
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("keyword"), (rbs_loc_range) { .start = node->keyword_range.start_char, .end = node->keyword_range.end_char });
|
|
336
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
337
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("end"), (rbs_loc_range) { .start = node->end_range.start_char, .end = node->end_range.end_char });
|
|
338
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("type_params"), (rbs_loc_range) { .start = node->type_params_range.start_char, .end = node->type_params_range.end_char });
|
|
339
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
217
340
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
218
341
|
rb_hash_aset(h, ID2SYM(rb_intern("type_params")), rbs_node_list_to_ruby_array(ctx, node->type_params));
|
|
219
342
|
rb_hash_aset(h, ID2SYM(rb_intern("members")), rbs_node_list_to_ruby_array(ctx, node->members));
|
|
@@ -236,7 +359,16 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
236
359
|
rbs_ast_declarations_module_t *node = (rbs_ast_declarations_module_t *) instance;
|
|
237
360
|
|
|
238
361
|
VALUE h = rb_hash_new();
|
|
239
|
-
|
|
362
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
363
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
364
|
+
rbs_loc_legacy_alloc_children(loc, 6);
|
|
365
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("keyword"), (rbs_loc_range) { .start = node->keyword_range.start_char, .end = node->keyword_range.end_char });
|
|
366
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
367
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("end"), (rbs_loc_range) { .start = node->end_range.start_char, .end = node->end_range.end_char });
|
|
368
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("type_params"), (rbs_loc_range) { .start = node->type_params_range.start_char, .end = node->type_params_range.end_char });
|
|
369
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("colon"), (rbs_loc_range) { .start = node->colon_range.start_char, .end = node->colon_range.end_char });
|
|
370
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("self_types"), (rbs_loc_range) { .start = node->self_types_range.start_char, .end = node->self_types_range.end_char });
|
|
371
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
240
372
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
241
373
|
rb_hash_aset(h, ID2SYM(rb_intern("type_params")), rbs_node_list_to_ruby_array(ctx, node->type_params));
|
|
242
374
|
rb_hash_aset(h, ID2SYM(rb_intern("self_types")), rbs_node_list_to_ruby_array(ctx, node->self_types));
|
|
@@ -260,7 +392,12 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
260
392
|
rbs_ast_declarations_module_self_t *node = (rbs_ast_declarations_module_self_t *) instance;
|
|
261
393
|
|
|
262
394
|
VALUE h = rb_hash_new();
|
|
263
|
-
|
|
395
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
396
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
397
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
398
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
399
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("args"), (rbs_loc_range) { .start = node->args_range.start_char, .end = node->args_range.end_char });
|
|
400
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
264
401
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
265
402
|
rb_hash_aset(h, ID2SYM(rb_intern("args")), rbs_node_list_to_ruby_array(ctx, node->args));
|
|
266
403
|
|
|
@@ -274,7 +411,14 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
274
411
|
rbs_ast_declarations_module_alias_t *node = (rbs_ast_declarations_module_alias_t *) instance;
|
|
275
412
|
|
|
276
413
|
VALUE h = rb_hash_new();
|
|
277
|
-
|
|
414
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
415
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
416
|
+
rbs_loc_legacy_alloc_children(loc, 4);
|
|
417
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("keyword"), (rbs_loc_range) { .start = node->keyword_range.start_char, .end = node->keyword_range.end_char });
|
|
418
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("new_name"), (rbs_loc_range) { .start = node->new_name_range.start_char, .end = node->new_name_range.end_char });
|
|
419
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("eq"), (rbs_loc_range) { .start = node->eq_range.start_char, .end = node->eq_range.end_char });
|
|
420
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("old_name"), (rbs_loc_range) { .start = node->old_name_range.start_char, .end = node->old_name_range.end_char });
|
|
421
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
278
422
|
rb_hash_aset(h, ID2SYM(rb_intern("new_name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->new_name)); // rbs_type_name
|
|
279
423
|
rb_hash_aset(h, ID2SYM(rb_intern("old_name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->old_name)); // rbs_type_name
|
|
280
424
|
rb_hash_aset(h, ID2SYM(rb_intern("comment")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment)); // rbs_ast_comment
|
|
@@ -290,7 +434,14 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
290
434
|
rbs_ast_declarations_type_alias_t *node = (rbs_ast_declarations_type_alias_t *) instance;
|
|
291
435
|
|
|
292
436
|
VALUE h = rb_hash_new();
|
|
293
|
-
|
|
437
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
438
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
439
|
+
rbs_loc_legacy_alloc_children(loc, 4);
|
|
440
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("keyword"), (rbs_loc_range) { .start = node->keyword_range.start_char, .end = node->keyword_range.end_char });
|
|
441
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
442
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("eq"), (rbs_loc_range) { .start = node->eq_range.start_char, .end = node->eq_range.end_char });
|
|
443
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("type_params"), (rbs_loc_range) { .start = node->type_params_range.start_char, .end = node->type_params_range.end_char });
|
|
444
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
294
445
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
295
446
|
rb_hash_aset(h, ID2SYM(rb_intern("type_params")), rbs_node_list_to_ruby_array(ctx, node->type_params));
|
|
296
447
|
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
@@ -313,7 +464,11 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
313
464
|
rbs_ast_directives_use_t *node = (rbs_ast_directives_use_t *) instance;
|
|
314
465
|
|
|
315
466
|
VALUE h = rb_hash_new();
|
|
316
|
-
|
|
467
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
468
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
469
|
+
rbs_loc_legacy_alloc_children(loc, 1);
|
|
470
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("keyword"), (rbs_loc_range) { .start = node->keyword_range.start_char, .end = node->keyword_range.end_char });
|
|
471
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
317
472
|
rb_hash_aset(h, ID2SYM(rb_intern("clauses")), rbs_node_list_to_ruby_array(ctx, node->clauses));
|
|
318
473
|
|
|
319
474
|
return CLASS_NEW_INSTANCE(
|
|
@@ -326,7 +481,13 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
326
481
|
rbs_ast_directives_use_single_clause_t *node = (rbs_ast_directives_use_single_clause_t *) instance;
|
|
327
482
|
|
|
328
483
|
VALUE h = rb_hash_new();
|
|
329
|
-
|
|
484
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
485
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
486
|
+
rbs_loc_legacy_alloc_children(loc, 3);
|
|
487
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("type_name"), (rbs_loc_range) { .start = node->type_name_range.start_char, .end = node->type_name_range.end_char });
|
|
488
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("keyword"), (rbs_loc_range) { .start = node->keyword_range.start_char, .end = node->keyword_range.end_char });
|
|
489
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("new_name"), (rbs_loc_range) { .start = node->new_name_range.start_char, .end = node->new_name_range.end_char });
|
|
490
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
330
491
|
rb_hash_aset(h, ID2SYM(rb_intern("type_name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type_name)); // rbs_type_name
|
|
331
492
|
rb_hash_aset(h, ID2SYM(rb_intern("new_name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->new_name)); // rbs_ast_symbol
|
|
332
493
|
|
|
@@ -340,7 +501,12 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
340
501
|
rbs_ast_directives_use_wildcard_clause_t *node = (rbs_ast_directives_use_wildcard_clause_t *) instance;
|
|
341
502
|
|
|
342
503
|
VALUE h = rb_hash_new();
|
|
343
|
-
|
|
504
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
505
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
506
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
507
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("namespace"), (rbs_loc_range) { .start = node->namespace_range.start_char, .end = node->namespace_range.end_char });
|
|
508
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("star"), (rbs_loc_range) { .start = node->star_range.start_char, .end = node->star_range.end_char });
|
|
509
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
344
510
|
rb_hash_aset(h, ID2SYM(rb_intern("namespace")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->rbs_namespace)); // rbs_namespace
|
|
345
511
|
|
|
346
512
|
return CLASS_NEW_INSTANCE(
|
|
@@ -361,10 +527,18 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
361
527
|
rbs_ast_members_alias_t *node = (rbs_ast_members_alias_t *) instance;
|
|
362
528
|
|
|
363
529
|
VALUE h = rb_hash_new();
|
|
364
|
-
|
|
530
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
531
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
532
|
+
rbs_loc_legacy_alloc_children(loc, 5);
|
|
533
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("keyword"), (rbs_loc_range) { .start = node->keyword_range.start_char, .end = node->keyword_range.end_char });
|
|
534
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("new_name"), (rbs_loc_range) { .start = node->new_name_range.start_char, .end = node->new_name_range.end_char });
|
|
535
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("old_name"), (rbs_loc_range) { .start = node->old_name_range.start_char, .end = node->old_name_range.end_char });
|
|
536
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("new_kind"), (rbs_loc_range) { .start = node->new_kind_range.start_char, .end = node->new_kind_range.end_char });
|
|
537
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("old_kind"), (rbs_loc_range) { .start = node->old_kind_range.start_char, .end = node->old_kind_range.end_char });
|
|
538
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
365
539
|
rb_hash_aset(h, ID2SYM(rb_intern("new_name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->new_name)); // rbs_ast_symbol
|
|
366
540
|
rb_hash_aset(h, ID2SYM(rb_intern("old_name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->old_name)); // rbs_ast_symbol
|
|
367
|
-
rb_hash_aset(h, ID2SYM(rb_intern("kind")),
|
|
541
|
+
rb_hash_aset(h, ID2SYM(rb_intern("kind")), rbs_alias_kind_to_ruby(node->kind)); // alias_kind
|
|
368
542
|
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), rbs_node_list_to_ruby_array(ctx, node->annotations));
|
|
369
543
|
rb_hash_aset(h, ID2SYM(rb_intern("comment")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment)); // rbs_ast_comment
|
|
370
544
|
|
|
@@ -378,14 +552,24 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
378
552
|
rbs_ast_members_attr_accessor_t *node = (rbs_ast_members_attr_accessor_t *) instance;
|
|
379
553
|
|
|
380
554
|
VALUE h = rb_hash_new();
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
555
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
556
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
557
|
+
rbs_loc_legacy_alloc_children(loc, 7);
|
|
558
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("keyword"), (rbs_loc_range) { .start = node->keyword_range.start_char, .end = node->keyword_range.end_char });
|
|
559
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
560
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("colon"), (rbs_loc_range) { .start = node->colon_range.start_char, .end = node->colon_range.end_char });
|
|
561
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("kind"), (rbs_loc_range) { .start = node->kind_range.start_char, .end = node->kind_range.end_char });
|
|
562
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("ivar"), (rbs_loc_range) { .start = node->ivar_range.start_char, .end = node->ivar_range.end_char });
|
|
563
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("ivar_name"), (rbs_loc_range) { .start = node->ivar_name_range.start_char, .end = node->ivar_name_range.end_char });
|
|
564
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("visibility"), (rbs_loc_range) { .start = node->visibility_range.start_char, .end = node->visibility_range.end_char });
|
|
565
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
566
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_ast_symbol
|
|
567
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
568
|
+
rb_hash_aset(h, ID2SYM(rb_intern("ivar_name")), rbs_attr_ivar_name_to_ruby(ctx, node->ivar_name)); // rbs_attr_ivar_name_t
|
|
569
|
+
rb_hash_aset(h, ID2SYM(rb_intern("kind")), rbs_attribute_kind_to_ruby(node->kind)); // attribute_kind
|
|
386
570
|
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), rbs_node_list_to_ruby_array(ctx, node->annotations));
|
|
387
|
-
rb_hash_aset(h, ID2SYM(rb_intern("comment")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment));
|
|
388
|
-
rb_hash_aset(h, ID2SYM(rb_intern("visibility")),
|
|
571
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment)); // rbs_ast_comment
|
|
572
|
+
rb_hash_aset(h, ID2SYM(rb_intern("visibility")), rbs_attribute_visibility_to_ruby(node->visibility)); // attribute_visibility
|
|
389
573
|
|
|
390
574
|
return CLASS_NEW_INSTANCE(
|
|
391
575
|
RBS_AST_Members_AttrAccessor,
|
|
@@ -397,14 +581,24 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
397
581
|
rbs_ast_members_attr_reader_t *node = (rbs_ast_members_attr_reader_t *) instance;
|
|
398
582
|
|
|
399
583
|
VALUE h = rb_hash_new();
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
584
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
585
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
586
|
+
rbs_loc_legacy_alloc_children(loc, 7);
|
|
587
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("keyword"), (rbs_loc_range) { .start = node->keyword_range.start_char, .end = node->keyword_range.end_char });
|
|
588
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
589
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("colon"), (rbs_loc_range) { .start = node->colon_range.start_char, .end = node->colon_range.end_char });
|
|
590
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("kind"), (rbs_loc_range) { .start = node->kind_range.start_char, .end = node->kind_range.end_char });
|
|
591
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("ivar"), (rbs_loc_range) { .start = node->ivar_range.start_char, .end = node->ivar_range.end_char });
|
|
592
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("ivar_name"), (rbs_loc_range) { .start = node->ivar_name_range.start_char, .end = node->ivar_name_range.end_char });
|
|
593
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("visibility"), (rbs_loc_range) { .start = node->visibility_range.start_char, .end = node->visibility_range.end_char });
|
|
594
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
595
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_ast_symbol
|
|
596
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
597
|
+
rb_hash_aset(h, ID2SYM(rb_intern("ivar_name")), rbs_attr_ivar_name_to_ruby(ctx, node->ivar_name)); // rbs_attr_ivar_name_t
|
|
598
|
+
rb_hash_aset(h, ID2SYM(rb_intern("kind")), rbs_attribute_kind_to_ruby(node->kind)); // attribute_kind
|
|
405
599
|
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), rbs_node_list_to_ruby_array(ctx, node->annotations));
|
|
406
|
-
rb_hash_aset(h, ID2SYM(rb_intern("comment")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment));
|
|
407
|
-
rb_hash_aset(h, ID2SYM(rb_intern("visibility")),
|
|
600
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment)); // rbs_ast_comment
|
|
601
|
+
rb_hash_aset(h, ID2SYM(rb_intern("visibility")), rbs_attribute_visibility_to_ruby(node->visibility)); // attribute_visibility
|
|
408
602
|
|
|
409
603
|
return CLASS_NEW_INSTANCE(
|
|
410
604
|
RBS_AST_Members_AttrReader,
|
|
@@ -416,14 +610,24 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
416
610
|
rbs_ast_members_attr_writer_t *node = (rbs_ast_members_attr_writer_t *) instance;
|
|
417
611
|
|
|
418
612
|
VALUE h = rb_hash_new();
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
613
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
614
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
615
|
+
rbs_loc_legacy_alloc_children(loc, 7);
|
|
616
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("keyword"), (rbs_loc_range) { .start = node->keyword_range.start_char, .end = node->keyword_range.end_char });
|
|
617
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
618
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("colon"), (rbs_loc_range) { .start = node->colon_range.start_char, .end = node->colon_range.end_char });
|
|
619
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("kind"), (rbs_loc_range) { .start = node->kind_range.start_char, .end = node->kind_range.end_char });
|
|
620
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("ivar"), (rbs_loc_range) { .start = node->ivar_range.start_char, .end = node->ivar_range.end_char });
|
|
621
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("ivar_name"), (rbs_loc_range) { .start = node->ivar_name_range.start_char, .end = node->ivar_name_range.end_char });
|
|
622
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("visibility"), (rbs_loc_range) { .start = node->visibility_range.start_char, .end = node->visibility_range.end_char });
|
|
623
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
624
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_ast_symbol
|
|
625
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
626
|
+
rb_hash_aset(h, ID2SYM(rb_intern("ivar_name")), rbs_attr_ivar_name_to_ruby(ctx, node->ivar_name)); // rbs_attr_ivar_name_t
|
|
627
|
+
rb_hash_aset(h, ID2SYM(rb_intern("kind")), rbs_attribute_kind_to_ruby(node->kind)); // attribute_kind
|
|
424
628
|
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), rbs_node_list_to_ruby_array(ctx, node->annotations));
|
|
425
|
-
rb_hash_aset(h, ID2SYM(rb_intern("comment")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment));
|
|
426
|
-
rb_hash_aset(h, ID2SYM(rb_intern("visibility")),
|
|
629
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment)); // rbs_ast_comment
|
|
630
|
+
rb_hash_aset(h, ID2SYM(rb_intern("visibility")), rbs_attribute_visibility_to_ruby(node->visibility)); // attribute_visibility
|
|
427
631
|
|
|
428
632
|
return CLASS_NEW_INSTANCE(
|
|
429
633
|
RBS_AST_Members_AttrWriter,
|
|
@@ -435,7 +639,13 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
435
639
|
rbs_ast_members_class_instance_variable_t *node = (rbs_ast_members_class_instance_variable_t *) instance;
|
|
436
640
|
|
|
437
641
|
VALUE h = rb_hash_new();
|
|
438
|
-
|
|
642
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
643
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
644
|
+
rbs_loc_legacy_alloc_children(loc, 3);
|
|
645
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
646
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("colon"), (rbs_loc_range) { .start = node->colon_range.start_char, .end = node->colon_range.end_char });
|
|
647
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("kind"), (rbs_loc_range) { .start = node->kind_range.start_char, .end = node->kind_range.end_char });
|
|
648
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
439
649
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_ast_symbol
|
|
440
650
|
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
441
651
|
rb_hash_aset(h, ID2SYM(rb_intern("comment")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment)); // rbs_ast_comment
|
|
@@ -450,7 +660,13 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
450
660
|
rbs_ast_members_class_variable_t *node = (rbs_ast_members_class_variable_t *) instance;
|
|
451
661
|
|
|
452
662
|
VALUE h = rb_hash_new();
|
|
453
|
-
|
|
663
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
664
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
665
|
+
rbs_loc_legacy_alloc_children(loc, 3);
|
|
666
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
667
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("colon"), (rbs_loc_range) { .start = node->colon_range.start_char, .end = node->colon_range.end_char });
|
|
668
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("kind"), (rbs_loc_range) { .start = node->kind_range.start_char, .end = node->kind_range.end_char });
|
|
669
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
454
670
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_ast_symbol
|
|
455
671
|
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
456
672
|
rb_hash_aset(h, ID2SYM(rb_intern("comment")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment)); // rbs_ast_comment
|
|
@@ -465,7 +681,13 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
465
681
|
rbs_ast_members_extend_t *node = (rbs_ast_members_extend_t *) instance;
|
|
466
682
|
|
|
467
683
|
VALUE h = rb_hash_new();
|
|
468
|
-
|
|
684
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
685
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
686
|
+
rbs_loc_legacy_alloc_children(loc, 3);
|
|
687
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
688
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("keyword"), (rbs_loc_range) { .start = node->keyword_range.start_char, .end = node->keyword_range.end_char });
|
|
689
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("args"), (rbs_loc_range) { .start = node->args_range.start_char, .end = node->args_range.end_char });
|
|
690
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
469
691
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
470
692
|
rb_hash_aset(h, ID2SYM(rb_intern("args")), rbs_node_list_to_ruby_array(ctx, node->args));
|
|
471
693
|
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), rbs_node_list_to_ruby_array(ctx, node->annotations));
|
|
@@ -481,7 +703,13 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
481
703
|
rbs_ast_members_include_t *node = (rbs_ast_members_include_t *) instance;
|
|
482
704
|
|
|
483
705
|
VALUE h = rb_hash_new();
|
|
484
|
-
|
|
706
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
707
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
708
|
+
rbs_loc_legacy_alloc_children(loc, 3);
|
|
709
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
710
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("keyword"), (rbs_loc_range) { .start = node->keyword_range.start_char, .end = node->keyword_range.end_char });
|
|
711
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("args"), (rbs_loc_range) { .start = node->args_range.start_char, .end = node->args_range.end_char });
|
|
712
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
485
713
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
486
714
|
rb_hash_aset(h, ID2SYM(rb_intern("args")), rbs_node_list_to_ruby_array(ctx, node->args));
|
|
487
715
|
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), rbs_node_list_to_ruby_array(ctx, node->annotations));
|
|
@@ -497,7 +725,13 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
497
725
|
rbs_ast_members_instance_variable_t *node = (rbs_ast_members_instance_variable_t *) instance;
|
|
498
726
|
|
|
499
727
|
VALUE h = rb_hash_new();
|
|
500
|
-
|
|
728
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
729
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
730
|
+
rbs_loc_legacy_alloc_children(loc, 3);
|
|
731
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
732
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("colon"), (rbs_loc_range) { .start = node->colon_range.start_char, .end = node->colon_range.end_char });
|
|
733
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("kind"), (rbs_loc_range) { .start = node->kind_range.start_char, .end = node->kind_range.end_char });
|
|
734
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
501
735
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_ast_symbol
|
|
502
736
|
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
503
737
|
rb_hash_aset(h, ID2SYM(rb_intern("comment")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment)); // rbs_ast_comment
|
|
@@ -512,14 +746,22 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
512
746
|
rbs_ast_members_method_definition_t *node = (rbs_ast_members_method_definition_t *) instance;
|
|
513
747
|
|
|
514
748
|
VALUE h = rb_hash_new();
|
|
515
|
-
|
|
749
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
750
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
751
|
+
rbs_loc_legacy_alloc_children(loc, 5);
|
|
752
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("keyword"), (rbs_loc_range) { .start = node->keyword_range.start_char, .end = node->keyword_range.end_char });
|
|
753
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
754
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("kind"), (rbs_loc_range) { .start = node->kind_range.start_char, .end = node->kind_range.end_char });
|
|
755
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("overloading"), (rbs_loc_range) { .start = node->overloading_range.start_char, .end = node->overloading_range.end_char });
|
|
756
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("visibility"), (rbs_loc_range) { .start = node->visibility_range.start_char, .end = node->visibility_range.end_char });
|
|
757
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
516
758
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_ast_symbol
|
|
517
|
-
rb_hash_aset(h, ID2SYM(rb_intern("kind")),
|
|
759
|
+
rb_hash_aset(h, ID2SYM(rb_intern("kind")), rbs_method_definition_kind_to_ruby(node->kind)); // method_definition_kind
|
|
518
760
|
rb_hash_aset(h, ID2SYM(rb_intern("overloads")), rbs_node_list_to_ruby_array(ctx, node->overloads));
|
|
519
761
|
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), rbs_node_list_to_ruby_array(ctx, node->annotations));
|
|
520
762
|
rb_hash_aset(h, ID2SYM(rb_intern("comment")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment)); // rbs_ast_comment
|
|
521
763
|
rb_hash_aset(h, ID2SYM(rb_intern("overloading")), node->overloading ? Qtrue : Qfalse);
|
|
522
|
-
rb_hash_aset(h, ID2SYM(rb_intern("visibility")),
|
|
764
|
+
rb_hash_aset(h, ID2SYM(rb_intern("visibility")), rbs_method_definition_visibility_to_ruby(node->visibility)); // method_definition_visibility
|
|
523
765
|
|
|
524
766
|
return CLASS_NEW_INSTANCE(
|
|
525
767
|
RBS_AST_Members_MethodDefinition,
|
|
@@ -544,7 +786,13 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
544
786
|
rbs_ast_members_prepend_t *node = (rbs_ast_members_prepend_t *) instance;
|
|
545
787
|
|
|
546
788
|
VALUE h = rb_hash_new();
|
|
547
|
-
|
|
789
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
790
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
791
|
+
rbs_loc_legacy_alloc_children(loc, 3);
|
|
792
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
793
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("keyword"), (rbs_loc_range) { .start = node->keyword_range.start_char, .end = node->keyword_range.end_char });
|
|
794
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("args"), (rbs_loc_range) { .start = node->args_range.start_char, .end = node->args_range.end_char });
|
|
795
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
548
796
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
549
797
|
rb_hash_aset(h, ID2SYM(rb_intern("args")), rbs_node_list_to_ruby_array(ctx, node->args));
|
|
550
798
|
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), rbs_node_list_to_ruby_array(ctx, node->annotations));
|
|
@@ -560,7 +808,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
560
808
|
rbs_ast_members_private_t *node = (rbs_ast_members_private_t *) instance;
|
|
561
809
|
|
|
562
810
|
VALUE h = rb_hash_new();
|
|
563
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
811
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
564
812
|
|
|
565
813
|
return CLASS_NEW_INSTANCE(
|
|
566
814
|
RBS_AST_Members_Private,
|
|
@@ -572,7 +820,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
572
820
|
rbs_ast_members_public_t *node = (rbs_ast_members_public_t *) instance;
|
|
573
821
|
|
|
574
822
|
VALUE h = rb_hash_new();
|
|
575
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
823
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
576
824
|
|
|
577
825
|
return CLASS_NEW_INSTANCE(
|
|
578
826
|
RBS_AST_Members_Public,
|
|
@@ -580,15 +828,35 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
580
828
|
&h
|
|
581
829
|
);
|
|
582
830
|
}
|
|
831
|
+
case RBS_AST_RUBY_ANNOTATIONS_BLOCK_PARAM_TYPE_ANNOTATION: {
|
|
832
|
+
rbs_ast_ruby_annotations_block_param_type_annotation_t *node = (rbs_ast_ruby_annotations_block_param_type_annotation_t *) instance;
|
|
833
|
+
|
|
834
|
+
VALUE h = rb_hash_new();
|
|
835
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
836
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), rbs_location_range_to_ruby_location(ctx, node->prefix_location));
|
|
837
|
+
rb_hash_aset(h, ID2SYM(rb_intern("ampersand_location")), rbs_location_range_to_ruby_location(ctx, node->ampersand_location));
|
|
838
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name_location")), rbs_location_range_to_ruby_location(ctx, node->name_location)); // optional
|
|
839
|
+
rb_hash_aset(h, ID2SYM(rb_intern("colon_location")), rbs_location_range_to_ruby_location(ctx, node->colon_location));
|
|
840
|
+
rb_hash_aset(h, ID2SYM(rb_intern("question_location")), rbs_location_range_to_ruby_location(ctx, node->question_location)); // optional
|
|
841
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_location")), rbs_location_range_to_ruby_location(ctx, node->type_location));
|
|
842
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type_)); // rbs_node
|
|
843
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")), rbs_location_range_to_ruby_location(ctx, node->comment_location)); // optional
|
|
844
|
+
|
|
845
|
+
return CLASS_NEW_INSTANCE(
|
|
846
|
+
RBS_AST_Ruby_Annotations_BlockParamTypeAnnotation,
|
|
847
|
+
1,
|
|
848
|
+
&h
|
|
849
|
+
);
|
|
850
|
+
}
|
|
583
851
|
case RBS_AST_RUBY_ANNOTATIONS_CLASS_ALIAS_ANNOTATION: {
|
|
584
852
|
rbs_ast_ruby_annotations_class_alias_annotation_t *node = (rbs_ast_ruby_annotations_class_alias_annotation_t *) instance;
|
|
585
853
|
|
|
586
854
|
VALUE h = rb_hash_new();
|
|
587
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
588
|
-
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")),
|
|
589
|
-
rb_hash_aset(h, ID2SYM(rb_intern("keyword_location")),
|
|
590
|
-
rb_hash_aset(h, ID2SYM(rb_intern("type_name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type_name));
|
|
591
|
-
rb_hash_aset(h, ID2SYM(rb_intern("type_name_location")),
|
|
855
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
856
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), rbs_location_range_to_ruby_location(ctx, node->prefix_location));
|
|
857
|
+
rb_hash_aset(h, ID2SYM(rb_intern("keyword_location")), rbs_location_range_to_ruby_location(ctx, node->keyword_location));
|
|
858
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type_name)); // rbs_type_name
|
|
859
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_name_location")), rbs_location_range_to_ruby_location(ctx, node->type_name_location)); // optional
|
|
592
860
|
|
|
593
861
|
return CLASS_NEW_INSTANCE(
|
|
594
862
|
RBS_AST_Ruby_Annotations_ClassAliasAnnotation,
|
|
@@ -600,8 +868,8 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
600
868
|
rbs_ast_ruby_annotations_colon_method_type_annotation_t *node = (rbs_ast_ruby_annotations_colon_method_type_annotation_t *) instance;
|
|
601
869
|
|
|
602
870
|
VALUE h = rb_hash_new();
|
|
603
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
604
|
-
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")),
|
|
871
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
872
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), rbs_location_range_to_ruby_location(ctx, node->prefix_location));
|
|
605
873
|
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), rbs_node_list_to_ruby_array(ctx, node->annotations));
|
|
606
874
|
rb_hash_aset(h, ID2SYM(rb_intern("method_type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->method_type)); // rbs_node
|
|
607
875
|
|
|
@@ -611,17 +879,35 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
611
879
|
&h
|
|
612
880
|
);
|
|
613
881
|
}
|
|
882
|
+
case RBS_AST_RUBY_ANNOTATIONS_DOUBLE_SPLAT_PARAM_TYPE_ANNOTATION: {
|
|
883
|
+
rbs_ast_ruby_annotations_double_splat_param_type_annotation_t *node = (rbs_ast_ruby_annotations_double_splat_param_type_annotation_t *) instance;
|
|
884
|
+
|
|
885
|
+
VALUE h = rb_hash_new();
|
|
886
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
887
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), rbs_location_range_to_ruby_location(ctx, node->prefix_location));
|
|
888
|
+
rb_hash_aset(h, ID2SYM(rb_intern("star2_location")), rbs_location_range_to_ruby_location(ctx, node->star2_location));
|
|
889
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name_location")), rbs_location_range_to_ruby_location(ctx, node->name_location)); // optional
|
|
890
|
+
rb_hash_aset(h, ID2SYM(rb_intern("colon_location")), rbs_location_range_to_ruby_location(ctx, node->colon_location));
|
|
891
|
+
rb_hash_aset(h, ID2SYM(rb_intern("param_type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->param_type)); // rbs_node
|
|
892
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")), rbs_location_range_to_ruby_location(ctx, node->comment_location)); // optional
|
|
893
|
+
|
|
894
|
+
return CLASS_NEW_INSTANCE(
|
|
895
|
+
RBS_AST_Ruby_Annotations_DoubleSplatParamTypeAnnotation,
|
|
896
|
+
1,
|
|
897
|
+
&h
|
|
898
|
+
);
|
|
899
|
+
}
|
|
614
900
|
case RBS_AST_RUBY_ANNOTATIONS_INSTANCE_VARIABLE_ANNOTATION: {
|
|
615
901
|
rbs_ast_ruby_annotations_instance_variable_annotation_t *node = (rbs_ast_ruby_annotations_instance_variable_annotation_t *) instance;
|
|
616
902
|
|
|
617
903
|
VALUE h = rb_hash_new();
|
|
618
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
619
|
-
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")),
|
|
904
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
905
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), rbs_location_range_to_ruby_location(ctx, node->prefix_location));
|
|
620
906
|
rb_hash_aset(h, ID2SYM(rb_intern("ivar_name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->ivar_name)); // rbs_ast_symbol
|
|
621
|
-
rb_hash_aset(h, ID2SYM(rb_intern("ivar_name_location")),
|
|
622
|
-
rb_hash_aset(h, ID2SYM(rb_intern("colon_location")),
|
|
623
|
-
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type));
|
|
624
|
-
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")),
|
|
907
|
+
rb_hash_aset(h, ID2SYM(rb_intern("ivar_name_location")), rbs_location_range_to_ruby_location(ctx, node->ivar_name_location));
|
|
908
|
+
rb_hash_aset(h, ID2SYM(rb_intern("colon_location")), rbs_location_range_to_ruby_location(ctx, node->colon_location));
|
|
909
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
910
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")), rbs_location_range_to_ruby_location(ctx, node->comment_location)); // optional
|
|
625
911
|
|
|
626
912
|
return CLASS_NEW_INSTANCE(
|
|
627
913
|
RBS_AST_Ruby_Annotations_InstanceVariableAnnotation,
|
|
@@ -633,10 +919,11 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
633
919
|
rbs_ast_ruby_annotations_method_types_annotation_t *node = (rbs_ast_ruby_annotations_method_types_annotation_t *) instance;
|
|
634
920
|
|
|
635
921
|
VALUE h = rb_hash_new();
|
|
636
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
637
|
-
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")),
|
|
922
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
923
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), rbs_location_range_to_ruby_location(ctx, node->prefix_location));
|
|
638
924
|
rb_hash_aset(h, ID2SYM(rb_intern("overloads")), rbs_node_list_to_ruby_array(ctx, node->overloads));
|
|
639
|
-
rb_hash_aset(h, ID2SYM(rb_intern("vertical_bar_locations")),
|
|
925
|
+
rb_hash_aset(h, ID2SYM(rb_intern("vertical_bar_locations")), rbs_location_range_list_to_ruby_array(ctx, node->vertical_bar_locations));
|
|
926
|
+
rb_hash_aset(h, ID2SYM(rb_intern("dot3_location")), rbs_location_range_to_ruby_location(ctx, node->dot3_location)); // optional
|
|
640
927
|
|
|
641
928
|
return CLASS_NEW_INSTANCE(
|
|
642
929
|
RBS_AST_Ruby_Annotations_MethodTypesAnnotation,
|
|
@@ -648,11 +935,11 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
648
935
|
rbs_ast_ruby_annotations_module_alias_annotation_t *node = (rbs_ast_ruby_annotations_module_alias_annotation_t *) instance;
|
|
649
936
|
|
|
650
937
|
VALUE h = rb_hash_new();
|
|
651
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
652
|
-
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")),
|
|
653
|
-
rb_hash_aset(h, ID2SYM(rb_intern("keyword_location")),
|
|
654
|
-
rb_hash_aset(h, ID2SYM(rb_intern("type_name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type_name));
|
|
655
|
-
rb_hash_aset(h, ID2SYM(rb_intern("type_name_location")),
|
|
938
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
939
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), rbs_location_range_to_ruby_location(ctx, node->prefix_location));
|
|
940
|
+
rb_hash_aset(h, ID2SYM(rb_intern("keyword_location")), rbs_location_range_to_ruby_location(ctx, node->keyword_location));
|
|
941
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type_name)); // rbs_type_name
|
|
942
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_name_location")), rbs_location_range_to_ruby_location(ctx, node->type_name_location)); // optional
|
|
656
943
|
|
|
657
944
|
return CLASS_NEW_INSTANCE(
|
|
658
945
|
RBS_AST_Ruby_Annotations_ModuleAliasAnnotation,
|
|
@@ -664,8 +951,8 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
664
951
|
rbs_ast_ruby_annotations_node_type_assertion_t *node = (rbs_ast_ruby_annotations_node_type_assertion_t *) instance;
|
|
665
952
|
|
|
666
953
|
VALUE h = rb_hash_new();
|
|
667
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
668
|
-
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")),
|
|
954
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
955
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), rbs_location_range_to_ruby_location(ctx, node->prefix_location));
|
|
669
956
|
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
670
957
|
|
|
671
958
|
return CLASS_NEW_INSTANCE(
|
|
@@ -674,16 +961,33 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
674
961
|
&h
|
|
675
962
|
);
|
|
676
963
|
}
|
|
964
|
+
case RBS_AST_RUBY_ANNOTATIONS_PARAM_TYPE_ANNOTATION: {
|
|
965
|
+
rbs_ast_ruby_annotations_param_type_annotation_t *node = (rbs_ast_ruby_annotations_param_type_annotation_t *) instance;
|
|
966
|
+
|
|
967
|
+
VALUE h = rb_hash_new();
|
|
968
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
969
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), rbs_location_range_to_ruby_location(ctx, node->prefix_location));
|
|
970
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name_location")), rbs_location_range_to_ruby_location(ctx, node->name_location));
|
|
971
|
+
rb_hash_aset(h, ID2SYM(rb_intern("colon_location")), rbs_location_range_to_ruby_location(ctx, node->colon_location));
|
|
972
|
+
rb_hash_aset(h, ID2SYM(rb_intern("param_type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->param_type)); // rbs_node
|
|
973
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")), rbs_location_range_to_ruby_location(ctx, node->comment_location)); // optional
|
|
974
|
+
|
|
975
|
+
return CLASS_NEW_INSTANCE(
|
|
976
|
+
RBS_AST_Ruby_Annotations_ParamTypeAnnotation,
|
|
977
|
+
1,
|
|
978
|
+
&h
|
|
979
|
+
);
|
|
980
|
+
}
|
|
677
981
|
case RBS_AST_RUBY_ANNOTATIONS_RETURN_TYPE_ANNOTATION: {
|
|
678
982
|
rbs_ast_ruby_annotations_return_type_annotation_t *node = (rbs_ast_ruby_annotations_return_type_annotation_t *) instance;
|
|
679
983
|
|
|
680
984
|
VALUE h = rb_hash_new();
|
|
681
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
682
|
-
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")),
|
|
683
|
-
rb_hash_aset(h, ID2SYM(rb_intern("return_location")),
|
|
684
|
-
rb_hash_aset(h, ID2SYM(rb_intern("colon_location")),
|
|
685
|
-
rb_hash_aset(h, ID2SYM(rb_intern("return_type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->return_type));
|
|
686
|
-
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")),
|
|
985
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
986
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), rbs_location_range_to_ruby_location(ctx, node->prefix_location));
|
|
987
|
+
rb_hash_aset(h, ID2SYM(rb_intern("return_location")), rbs_location_range_to_ruby_location(ctx, node->return_location));
|
|
988
|
+
rb_hash_aset(h, ID2SYM(rb_intern("colon_location")), rbs_location_range_to_ruby_location(ctx, node->colon_location));
|
|
989
|
+
rb_hash_aset(h, ID2SYM(rb_intern("return_type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->return_type)); // rbs_node
|
|
990
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")), rbs_location_range_to_ruby_location(ctx, node->comment_location)); // optional
|
|
687
991
|
|
|
688
992
|
return CLASS_NEW_INSTANCE(
|
|
689
993
|
RBS_AST_Ruby_Annotations_ReturnTypeAnnotation,
|
|
@@ -695,10 +999,10 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
695
999
|
rbs_ast_ruby_annotations_skip_annotation_t *node = (rbs_ast_ruby_annotations_skip_annotation_t *) instance;
|
|
696
1000
|
|
|
697
1001
|
VALUE h = rb_hash_new();
|
|
698
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
699
|
-
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")),
|
|
700
|
-
rb_hash_aset(h, ID2SYM(rb_intern("skip_location")),
|
|
701
|
-
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")),
|
|
1002
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
1003
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), rbs_location_range_to_ruby_location(ctx, node->prefix_location));
|
|
1004
|
+
rb_hash_aset(h, ID2SYM(rb_intern("skip_location")), rbs_location_range_to_ruby_location(ctx, node->skip_location));
|
|
1005
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")), rbs_location_range_to_ruby_location(ctx, node->comment_location)); // optional
|
|
702
1006
|
|
|
703
1007
|
return CLASS_NEW_INSTANCE(
|
|
704
1008
|
RBS_AST_Ruby_Annotations_SkipAnnotation,
|
|
@@ -706,15 +1010,33 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
706
1010
|
&h
|
|
707
1011
|
);
|
|
708
1012
|
}
|
|
1013
|
+
case RBS_AST_RUBY_ANNOTATIONS_SPLAT_PARAM_TYPE_ANNOTATION: {
|
|
1014
|
+
rbs_ast_ruby_annotations_splat_param_type_annotation_t *node = (rbs_ast_ruby_annotations_splat_param_type_annotation_t *) instance;
|
|
1015
|
+
|
|
1016
|
+
VALUE h = rb_hash_new();
|
|
1017
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
1018
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), rbs_location_range_to_ruby_location(ctx, node->prefix_location));
|
|
1019
|
+
rb_hash_aset(h, ID2SYM(rb_intern("star_location")), rbs_location_range_to_ruby_location(ctx, node->star_location));
|
|
1020
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name_location")), rbs_location_range_to_ruby_location(ctx, node->name_location)); // optional
|
|
1021
|
+
rb_hash_aset(h, ID2SYM(rb_intern("colon_location")), rbs_location_range_to_ruby_location(ctx, node->colon_location));
|
|
1022
|
+
rb_hash_aset(h, ID2SYM(rb_intern("param_type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->param_type)); // rbs_node
|
|
1023
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")), rbs_location_range_to_ruby_location(ctx, node->comment_location)); // optional
|
|
1024
|
+
|
|
1025
|
+
return CLASS_NEW_INSTANCE(
|
|
1026
|
+
RBS_AST_Ruby_Annotations_SplatParamTypeAnnotation,
|
|
1027
|
+
1,
|
|
1028
|
+
&h
|
|
1029
|
+
);
|
|
1030
|
+
}
|
|
709
1031
|
case RBS_AST_RUBY_ANNOTATIONS_TYPE_APPLICATION_ANNOTATION: {
|
|
710
1032
|
rbs_ast_ruby_annotations_type_application_annotation_t *node = (rbs_ast_ruby_annotations_type_application_annotation_t *) instance;
|
|
711
1033
|
|
|
712
1034
|
VALUE h = rb_hash_new();
|
|
713
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
714
|
-
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")),
|
|
1035
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
1036
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), rbs_location_range_to_ruby_location(ctx, node->prefix_location));
|
|
715
1037
|
rb_hash_aset(h, ID2SYM(rb_intern("type_args")), rbs_node_list_to_ruby_array(ctx, node->type_args));
|
|
716
|
-
rb_hash_aset(h, ID2SYM(rb_intern("close_bracket_location")),
|
|
717
|
-
rb_hash_aset(h, ID2SYM(rb_intern("comma_locations")),
|
|
1038
|
+
rb_hash_aset(h, ID2SYM(rb_intern("close_bracket_location")), rbs_location_range_to_ruby_location(ctx, node->close_bracket_location));
|
|
1039
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comma_locations")), rbs_location_range_list_to_ruby_array(ctx, node->comma_locations));
|
|
718
1040
|
|
|
719
1041
|
return CLASS_NEW_INSTANCE(
|
|
720
1042
|
RBS_AST_Ruby_Annotations_TypeApplicationAnnotation,
|
|
@@ -732,9 +1054,18 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
732
1054
|
rbs_ast_type_param_t *node = (rbs_ast_type_param_t *) instance;
|
|
733
1055
|
|
|
734
1056
|
VALUE h = rb_hash_new();
|
|
735
|
-
|
|
1057
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1058
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
1059
|
+
rbs_loc_legacy_alloc_children(loc, 6);
|
|
1060
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
1061
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("variance"), (rbs_loc_range) { .start = node->variance_range.start_char, .end = node->variance_range.end_char });
|
|
1062
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("unchecked"), (rbs_loc_range) { .start = node->unchecked_range.start_char, .end = node->unchecked_range.end_char });
|
|
1063
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("upper_bound"), (rbs_loc_range) { .start = node->upper_bound_range.start_char, .end = node->upper_bound_range.end_char });
|
|
1064
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("lower_bound"), (rbs_loc_range) { .start = node->lower_bound_range.start_char, .end = node->lower_bound_range.end_char });
|
|
1065
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("default"), (rbs_loc_range) { .start = node->default_range.start_char, .end = node->default_range.end_char });
|
|
1066
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
736
1067
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_ast_symbol
|
|
737
|
-
rb_hash_aset(h, ID2SYM(rb_intern("variance")),
|
|
1068
|
+
rb_hash_aset(h, ID2SYM(rb_intern("variance")), rbs_type_param_variance_to_ruby(node->variance)); // type_param_variance
|
|
738
1069
|
rb_hash_aset(h, ID2SYM(rb_intern("upper_bound")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->upper_bound)); // rbs_node
|
|
739
1070
|
rb_hash_aset(h, ID2SYM(rb_intern("lower_bound")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->lower_bound)); // rbs_node
|
|
740
1071
|
rb_hash_aset(h, ID2SYM(rb_intern("default_type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->default_type)); // rbs_node
|
|
@@ -750,7 +1081,12 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
750
1081
|
rbs_method_type_t *node = (rbs_method_type_t *) instance;
|
|
751
1082
|
|
|
752
1083
|
VALUE h = rb_hash_new();
|
|
753
|
-
|
|
1084
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1085
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
1086
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
1087
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("type"), (rbs_loc_range) { .start = node->type_range.start_char, .end = node->type_range.end_char });
|
|
1088
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("type_params"), (rbs_loc_range) { .start = node->type_params_range.start_char, .end = node->type_params_range.end_char });
|
|
1089
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
754
1090
|
rb_hash_aset(h, ID2SYM(rb_intern("type_params")), rbs_node_list_to_ruby_array(ctx, node->type_params));
|
|
755
1091
|
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
756
1092
|
rb_hash_aset(h, ID2SYM(rb_intern("block")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->block)); // rbs_types_block
|
|
@@ -805,7 +1141,12 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
805
1141
|
rbs_types_alias_t *node = (rbs_types_alias_t *) instance;
|
|
806
1142
|
|
|
807
1143
|
VALUE h = rb_hash_new();
|
|
808
|
-
|
|
1144
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1145
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
1146
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
1147
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
1148
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("args"), (rbs_loc_range) { .start = node->args_range.start_char, .end = node->args_range.end_char });
|
|
1149
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
809
1150
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
810
1151
|
rb_hash_aset(h, ID2SYM(rb_intern("args")), rbs_node_list_to_ruby_array(ctx, node->args));
|
|
811
1152
|
|
|
@@ -819,7 +1160,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
819
1160
|
rbs_types_bases_any_t *node = (rbs_types_bases_any_t *) instance;
|
|
820
1161
|
|
|
821
1162
|
VALUE h = rb_hash_new();
|
|
822
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1163
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
823
1164
|
rb_hash_aset(h, ID2SYM(rb_intern("todo")), node->todo ? Qtrue : Qfalse);
|
|
824
1165
|
|
|
825
1166
|
return CLASS_NEW_INSTANCE(
|
|
@@ -832,7 +1173,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
832
1173
|
rbs_types_bases_bool_t *node = (rbs_types_bases_bool_t *) instance;
|
|
833
1174
|
|
|
834
1175
|
VALUE h = rb_hash_new();
|
|
835
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1176
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
836
1177
|
|
|
837
1178
|
return CLASS_NEW_INSTANCE(
|
|
838
1179
|
RBS_Types_Bases_Bool,
|
|
@@ -844,7 +1185,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
844
1185
|
rbs_types_bases_bottom_t *node = (rbs_types_bases_bottom_t *) instance;
|
|
845
1186
|
|
|
846
1187
|
VALUE h = rb_hash_new();
|
|
847
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1188
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
848
1189
|
|
|
849
1190
|
return CLASS_NEW_INSTANCE(
|
|
850
1191
|
RBS_Types_Bases_Bottom,
|
|
@@ -856,7 +1197,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
856
1197
|
rbs_types_bases_class_t *node = (rbs_types_bases_class_t *) instance;
|
|
857
1198
|
|
|
858
1199
|
VALUE h = rb_hash_new();
|
|
859
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1200
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
860
1201
|
|
|
861
1202
|
return CLASS_NEW_INSTANCE(
|
|
862
1203
|
RBS_Types_Bases_Class,
|
|
@@ -868,7 +1209,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
868
1209
|
rbs_types_bases_instance_t *node = (rbs_types_bases_instance_t *) instance;
|
|
869
1210
|
|
|
870
1211
|
VALUE h = rb_hash_new();
|
|
871
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1212
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
872
1213
|
|
|
873
1214
|
return CLASS_NEW_INSTANCE(
|
|
874
1215
|
RBS_Types_Bases_Instance,
|
|
@@ -880,7 +1221,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
880
1221
|
rbs_types_bases_nil_t *node = (rbs_types_bases_nil_t *) instance;
|
|
881
1222
|
|
|
882
1223
|
VALUE h = rb_hash_new();
|
|
883
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1224
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
884
1225
|
|
|
885
1226
|
return CLASS_NEW_INSTANCE(
|
|
886
1227
|
RBS_Types_Bases_Nil,
|
|
@@ -892,7 +1233,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
892
1233
|
rbs_types_bases_self_t *node = (rbs_types_bases_self_t *) instance;
|
|
893
1234
|
|
|
894
1235
|
VALUE h = rb_hash_new();
|
|
895
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1236
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
896
1237
|
|
|
897
1238
|
return CLASS_NEW_INSTANCE(
|
|
898
1239
|
RBS_Types_Bases_Self,
|
|
@@ -904,7 +1245,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
904
1245
|
rbs_types_bases_top_t *node = (rbs_types_bases_top_t *) instance;
|
|
905
1246
|
|
|
906
1247
|
VALUE h = rb_hash_new();
|
|
907
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1248
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
908
1249
|
|
|
909
1250
|
return CLASS_NEW_INSTANCE(
|
|
910
1251
|
RBS_Types_Bases_Top,
|
|
@@ -916,7 +1257,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
916
1257
|
rbs_types_bases_void_t *node = (rbs_types_bases_void_t *) instance;
|
|
917
1258
|
|
|
918
1259
|
VALUE h = rb_hash_new();
|
|
919
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1260
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
920
1261
|
|
|
921
1262
|
return CLASS_NEW_INSTANCE(
|
|
922
1263
|
RBS_Types_Bases_Void,
|
|
@@ -928,7 +1269,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
928
1269
|
rbs_types_block_t *node = (rbs_types_block_t *) instance;
|
|
929
1270
|
|
|
930
1271
|
VALUE h = rb_hash_new();
|
|
931
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1272
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
932
1273
|
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
933
1274
|
rb_hash_aset(h, ID2SYM(rb_intern("required")), node->required ? Qtrue : Qfalse);
|
|
934
1275
|
rb_hash_aset(h, ID2SYM(rb_intern("self_type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->self_type)); // rbs_node
|
|
@@ -943,7 +1284,12 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
943
1284
|
rbs_types_class_instance_t *node = (rbs_types_class_instance_t *) instance;
|
|
944
1285
|
|
|
945
1286
|
VALUE h = rb_hash_new();
|
|
946
|
-
|
|
1287
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1288
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
1289
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
1290
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
1291
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("args"), (rbs_loc_range) { .start = node->args_range.start_char, .end = node->args_range.end_char });
|
|
1292
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
947
1293
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
948
1294
|
rb_hash_aset(h, ID2SYM(rb_intern("args")), rbs_node_list_to_ruby_array(ctx, node->args));
|
|
949
1295
|
|
|
@@ -957,8 +1303,14 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
957
1303
|
rbs_types_class_singleton_t *node = (rbs_types_class_singleton_t *) instance;
|
|
958
1304
|
|
|
959
1305
|
VALUE h = rb_hash_new();
|
|
960
|
-
|
|
1306
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1307
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
1308
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
1309
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
1310
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("args"), (rbs_loc_range) { .start = node->args_range.start_char, .end = node->args_range.end_char });
|
|
1311
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
961
1312
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
1313
|
+
rb_hash_aset(h, ID2SYM(rb_intern("args")), rbs_node_list_to_ruby_array(ctx, node->args));
|
|
962
1314
|
|
|
963
1315
|
return CLASS_NEW_INSTANCE(
|
|
964
1316
|
RBS_Types_ClassSingleton,
|
|
@@ -989,7 +1341,11 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
989
1341
|
rbs_types_function_param_t *node = (rbs_types_function_param_t *) instance;
|
|
990
1342
|
|
|
991
1343
|
VALUE h = rb_hash_new();
|
|
992
|
-
|
|
1344
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1345
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
1346
|
+
rbs_loc_legacy_alloc_children(loc, 1);
|
|
1347
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
1348
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
993
1349
|
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
994
1350
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_ast_symbol
|
|
995
1351
|
|
|
@@ -1003,7 +1359,12 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
1003
1359
|
rbs_types_interface_t *node = (rbs_types_interface_t *) instance;
|
|
1004
1360
|
|
|
1005
1361
|
VALUE h = rb_hash_new();
|
|
1006
|
-
|
|
1362
|
+
VALUE location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1363
|
+
rbs_loc *loc = rbs_check_location(location);
|
|
1364
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
1365
|
+
rbs_loc_legacy_add_required_child(loc, rb_intern("name"), (rbs_loc_range) { .start = node->name_range.start_char, .end = node->name_range.end_char });
|
|
1366
|
+
rbs_loc_legacy_add_optional_child(loc, rb_intern("args"), (rbs_loc_range) { .start = node->args_range.start_char, .end = node->args_range.end_char });
|
|
1367
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), location);
|
|
1007
1368
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
1008
1369
|
rb_hash_aset(h, ID2SYM(rb_intern("args")), rbs_node_list_to_ruby_array(ctx, node->args));
|
|
1009
1370
|
|
|
@@ -1017,7 +1378,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
1017
1378
|
rbs_types_intersection_t *node = (rbs_types_intersection_t *) instance;
|
|
1018
1379
|
|
|
1019
1380
|
VALUE h = rb_hash_new();
|
|
1020
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1381
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
1021
1382
|
rb_hash_aset(h, ID2SYM(rb_intern("types")), rbs_node_list_to_ruby_array(ctx, node->types));
|
|
1022
1383
|
|
|
1023
1384
|
return CLASS_NEW_INSTANCE(
|
|
@@ -1030,7 +1391,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
1030
1391
|
rbs_types_literal_t *node = (rbs_types_literal_t *) instance;
|
|
1031
1392
|
|
|
1032
1393
|
VALUE h = rb_hash_new();
|
|
1033
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1394
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
1034
1395
|
rb_hash_aset(h, ID2SYM(rb_intern("literal")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->literal)); // rbs_node
|
|
1035
1396
|
|
|
1036
1397
|
return CLASS_NEW_INSTANCE(
|
|
@@ -1043,7 +1404,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
1043
1404
|
rbs_types_optional_t *node = (rbs_types_optional_t *) instance;
|
|
1044
1405
|
|
|
1045
1406
|
VALUE h = rb_hash_new();
|
|
1046
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1407
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
1047
1408
|
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
1048
1409
|
|
|
1049
1410
|
return CLASS_NEW_INSTANCE(
|
|
@@ -1056,7 +1417,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
1056
1417
|
rbs_types_proc_t *node = (rbs_types_proc_t *) instance;
|
|
1057
1418
|
|
|
1058
1419
|
VALUE h = rb_hash_new();
|
|
1059
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1420
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
1060
1421
|
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
1061
1422
|
rb_hash_aset(h, ID2SYM(rb_intern("block")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->block)); // rbs_types_block
|
|
1062
1423
|
rb_hash_aset(h, ID2SYM(rb_intern("self_type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->self_type)); // rbs_node
|
|
@@ -1071,7 +1432,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
1071
1432
|
rbs_types_record_t *node = (rbs_types_record_t *) instance;
|
|
1072
1433
|
|
|
1073
1434
|
VALUE h = rb_hash_new();
|
|
1074
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1435
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
1075
1436
|
rb_hash_aset(h, ID2SYM(rb_intern("all_fields")), rbs_hash_to_ruby_hash(ctx, node->all_fields));
|
|
1076
1437
|
|
|
1077
1438
|
return CLASS_NEW_INSTANCE(
|
|
@@ -1092,7 +1453,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
1092
1453
|
rbs_types_tuple_t *node = (rbs_types_tuple_t *) instance;
|
|
1093
1454
|
|
|
1094
1455
|
VALUE h = rb_hash_new();
|
|
1095
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1456
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
1096
1457
|
rb_hash_aset(h, ID2SYM(rb_intern("types")), rbs_node_list_to_ruby_array(ctx, node->types));
|
|
1097
1458
|
|
|
1098
1459
|
return CLASS_NEW_INSTANCE(
|
|
@@ -1105,7 +1466,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
1105
1466
|
rbs_types_union_t *node = (rbs_types_union_t *) instance;
|
|
1106
1467
|
|
|
1107
1468
|
VALUE h = rb_hash_new();
|
|
1108
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1469
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
1109
1470
|
rb_hash_aset(h, ID2SYM(rb_intern("types")), rbs_node_list_to_ruby_array(ctx, node->types));
|
|
1110
1471
|
|
|
1111
1472
|
return CLASS_NEW_INSTANCE(
|
|
@@ -1130,7 +1491,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
1130
1491
|
rbs_types_variable_t *node = (rbs_types_variable_t *) instance;
|
|
1131
1492
|
|
|
1132
1493
|
VALUE h = rb_hash_new();
|
|
1133
|
-
rb_hash_aset(h, ID2SYM(rb_intern("location")),
|
|
1494
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
1134
1495
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_ast_symbol
|
|
1135
1496
|
|
|
1136
1497
|
return CLASS_NEW_INSTANCE(
|
|
@@ -1139,15 +1500,8 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
1139
1500
|
&h
|
|
1140
1501
|
);
|
|
1141
1502
|
}
|
|
1142
|
-
case RBS_KEYWORD: {
|
|
1143
|
-
rbs_constant_t *constant = rbs_constant_pool_id_to_constant(RBS_GLOBAL_CONSTANT_POOL, ((rbs_keyword_t *) instance)->constant_id);
|
|
1144
|
-
assert(constant != NULL && "constant is NULL");
|
|
1145
|
-
assert(constant->start != NULL && "constant->start is NULL");
|
|
1146
|
-
|
|
1147
|
-
return ID2SYM(rb_intern2((const char *) constant->start, constant->length));
|
|
1148
|
-
}
|
|
1149
1503
|
case RBS_AST_SYMBOL: {
|
|
1150
|
-
rbs_constant_t *constant = rbs_constant_pool_id_to_constant(ctx.constant_pool, ((
|
|
1504
|
+
rbs_constant_t *constant = rbs_constant_pool_id_to_constant(ctx.constant_pool, ((rbs_ast_symbol_t *) instance)->constant_id);
|
|
1151
1505
|
assert(constant != NULL && "constant is NULL");
|
|
1152
1506
|
assert(constant->start != NULL && "constant->start is NULL");
|
|
1153
1507
|
|