rbs 3.10.4 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +14 -14
- data/.github/workflows/bundle-update.yml +60 -0
- data/.github/workflows/c-check.yml +7 -5
- data/.github/workflows/comments.yml +2 -2
- data/.github/workflows/dependabot.yml +2 -2
- data/.github/workflows/ruby.yml +16 -26
- data/.github/workflows/rust.yml +95 -0
- data/.github/workflows/typecheck.yml +1 -1
- data/.github/workflows/windows.yml +2 -2
- data/.rubocop.yml +2 -2
- data/.vscode/extensions.json +5 -0
- data/.vscode/settings.json +19 -0
- data/CHANGELOG.md +202 -2
- data/Rakefile +9 -23
- data/Steepfile +2 -0
- data/config.yml +457 -13
- data/core/array.rbs +218 -188
- data/core/basic_object.rbs +9 -8
- data/core/binding.rbs +0 -2
- data/core/builtin.rbs +2 -2
- data/core/class.rbs +6 -5
- data/core/comparable.rbs +45 -31
- data/core/complex.rbs +66 -55
- data/core/dir.rbs +57 -45
- data/core/encoding.rbs +6 -6
- data/core/enumerable.rbs +105 -91
- data/core/enumerator/arithmetic_sequence.rbs +70 -0
- data/core/enumerator.rbs +24 -3
- data/core/errno.rbs +3 -2
- data/core/errors.rbs +31 -29
- data/core/exception.rbs +12 -12
- data/core/fiber.rbs +47 -36
- data/core/file.rbs +242 -169
- data/core/file_test.rbs +2 -2
- data/core/float.rbs +42 -68
- data/core/gc.rbs +78 -70
- data/core/hash.rbs +70 -60
- data/core/integer.rbs +32 -75
- data/core/io/buffer.rbs +36 -36
- data/core/io/wait.rbs +7 -7
- data/core/io.rbs +192 -146
- data/core/kernel.rbs +198 -147
- data/core/marshal.rbs +3 -3
- data/core/match_data.rbs +14 -12
- data/core/math.rbs +69 -67
- data/core/method.rbs +6 -8
- data/core/module.rbs +148 -88
- data/core/nil_class.rbs +4 -3
- data/core/numeric.rbs +53 -50
- data/core/object.rbs +6 -8
- data/core/object_space.rbs +11 -10
- data/core/pathname.rbs +131 -81
- data/core/proc.rbs +65 -34
- data/core/process.rbs +221 -201
- data/core/ractor.rbs +15 -11
- data/core/random.rbs +21 -3
- data/core/range.rbs +152 -49
- data/core/rational.rbs +5 -56
- 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 -116
- 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 +318 -298
- data/core/struct.rbs +26 -25
- data/core/symbol.rbs +25 -24
- data/core/thread.rbs +40 -41
- 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 +576 -0
- data/docs/syntax.md +46 -16
- data/docs/type_fingerprint.md +21 -0
- data/exe/rbs +1 -1
- data/ext/rbs_extension/ast_translation.c +595 -98
- data/ext/rbs_extension/class_constants.c +30 -0
- data/ext/rbs_extension/class_constants.h +15 -0
- data/ext/rbs_extension/legacy_location.c +30 -53
- data/ext/rbs_extension/legacy_location.h +37 -0
- data/ext/rbs_extension/main.c +125 -24
- data/include/rbs/ast.h +485 -150
- data/include/rbs/lexer.h +11 -4
- data/include/rbs/location.h +25 -44
- data/include/rbs/parser.h +20 -2
- data/include/rbs/util/rbs_constant_pool.h +0 -3
- data/include/rbs.h +8 -0
- data/lib/rbs/ast/annotation.rb +1 -1
- data/lib/rbs/ast/comment.rb +1 -1
- data/lib/rbs/ast/declarations.rb +10 -10
- data/lib/rbs/ast/members.rb +14 -14
- data/lib/rbs/ast/ruby/annotations.rb +409 -0
- data/lib/rbs/ast/ruby/comment_block.rb +245 -0
- data/lib/rbs/ast/ruby/declarations.rb +281 -0
- data/lib/rbs/ast/ruby/helpers/constant_helper.rb +28 -0
- data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
- data/lib/rbs/ast/ruby/members.rb +723 -0
- data/lib/rbs/ast/type_param.rb +24 -4
- data/lib/rbs/buffer.rb +105 -20
- data/lib/rbs/cli/diff.rb +16 -15
- data/lib/rbs/cli/validate.rb +62 -125
- data/lib/rbs/cli.rb +55 -23
- data/lib/rbs/collection/config/lockfile_generator.rb +8 -4
- data/lib/rbs/collection/sources/git.rb +1 -0
- data/lib/rbs/collection.rb +0 -1
- data/lib/rbs/definition.rb +6 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +119 -63
- data/lib/rbs/definition_builder/method_builder.rb +65 -30
- data/lib/rbs/definition_builder.rb +177 -20
- data/lib/rbs/diff.rb +7 -1
- data/lib/rbs/environment/class_entry.rb +69 -0
- data/lib/rbs/environment/module_entry.rb +66 -0
- data/lib/rbs/environment.rb +338 -155
- data/lib/rbs/environment_loader.rb +2 -2
- data/lib/rbs/errors.rb +30 -20
- data/lib/rbs/inline_parser/comment_association.rb +117 -0
- data/lib/rbs/inline_parser.rb +542 -0
- data/lib/rbs/location_aux.rb +36 -4
- data/lib/rbs/locator.rb +5 -1
- data/lib/rbs/method_type.rb +5 -3
- data/lib/rbs/namespace.rb +0 -7
- data/lib/rbs/parser_aux.rb +31 -8
- data/lib/rbs/prototype/helpers.rb +57 -0
- data/lib/rbs/prototype/rb.rb +3 -28
- data/lib/rbs/prototype/rbi.rb +3 -20
- data/lib/rbs/prototype/runtime.rb +10 -2
- data/lib/rbs/resolver/type_name_resolver.rb +0 -8
- data/lib/rbs/source.rb +99 -0
- data/lib/rbs/subtractor.rb +4 -3
- data/lib/rbs/test/type_check.rb +5 -2
- data/lib/rbs/type_name.rb +1 -8
- data/lib/rbs/types.rb +88 -78
- data/lib/rbs/unit_test/convertibles.rb +1 -0
- data/lib/rbs/unit_test/type_assertions.rb +35 -8
- data/lib/rbs/validator.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +12 -1
- data/rbs.gemspec +3 -2
- 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/schema/typeParam.json +17 -1
- data/sig/ancestor_builder.rbs +1 -1
- data/sig/ast/ruby/annotations.rbs +421 -0
- data/sig/ast/ruby/comment_block.rbs +127 -0
- data/sig/ast/ruby/declarations.rbs +158 -0
- data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
- data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
- data/sig/ast/ruby/members.rbs +178 -0
- data/sig/buffer.rbs +63 -5
- data/sig/cli/diff.rbs +5 -11
- data/sig/cli/validate.rbs +12 -8
- data/sig/cli.rbs +18 -18
- data/sig/definition.rbs +6 -0
- data/sig/definition_builder.rbs +3 -1
- data/sig/environment/class_entry.rbs +50 -0
- data/sig/environment/module_entry.rbs +50 -0
- data/sig/environment.rbs +37 -81
- data/sig/errors.rbs +26 -20
- data/sig/inline_parser/comment_association.rbs +71 -0
- data/sig/inline_parser.rbs +124 -0
- data/sig/location.rbs +32 -7
- data/sig/locator.rbs +0 -2
- data/sig/method_builder.rbs +9 -4
- data/sig/namespace.rbs +0 -5
- data/sig/parser.rbs +47 -13
- data/sig/prototype/helpers.rbs +2 -0
- data/sig/resolver/type_name_resolver.rbs +0 -3
- data/sig/source.rbs +48 -0
- data/sig/type_param.rbs +13 -8
- data/sig/typename.rbs +0 -5
- data/sig/types.rbs +6 -7
- data/sig/unit_test/spy.rbs +0 -8
- data/sig/unit_test/type_assertions.rbs +11 -0
- data/src/ast.c +491 -143
- data/src/lexer.c +1552 -1314
- data/src/lexer.re +7 -0
- data/src/lexstate.c +8 -1
- data/src/location.c +8 -48
- data/src/parser.c +1107 -409
- 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/digest/0/digest.rbs +110 -0
- data/stdlib/erb/0/erb.rbs +64 -53
- data/stdlib/etc/0/etc.rbs +55 -50
- data/stdlib/fileutils/0/fileutils.rbs +140 -126
- data/stdlib/forwardable/0/forwardable.rbs +10 -10
- data/stdlib/io-console/0/io-console.rbs +2 -2
- data/stdlib/json/0/json.rbs +158 -131
- 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 -30
- data/stdlib/open-uri/0/open-uri.rbs +8 -8
- data/stdlib/open3/0/open3.rbs +469 -10
- data/stdlib/openssl/0/openssl.rbs +144 -129
- data/stdlib/optparse/0/optparse.rbs +23 -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 +62 -9
- data/stdlib/psych/0/store.rbs +2 -4
- data/stdlib/pty/0/pty.rbs +9 -6
- data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
- data/stdlib/rdoc/0/code_object.rbs +2 -1
- data/stdlib/rdoc/0/parser.rbs +1 -1
- data/stdlib/rdoc/0/store.rbs +1 -1
- data/stdlib/ripper/0/ripper.rbs +20 -17
- data/stdlib/securerandom/0/manifest.yaml +2 -0
- data/stdlib/securerandom/0/securerandom.rbs +7 -20
- data/stdlib/shellwords/0/shellwords.rbs +2 -2
- data/stdlib/socket/0/addrinfo.rbs +9 -9
- 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 +31 -18
- data/stdlib/uri/0/file.rbs +2 -2
- data/stdlib/uri/0/generic.rbs +9 -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 +6 -6
- 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 +66 -3
|
@@ -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,6 +828,222 @@ 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
|
+
}
|
|
851
|
+
case RBS_AST_RUBY_ANNOTATIONS_CLASS_ALIAS_ANNOTATION: {
|
|
852
|
+
rbs_ast_ruby_annotations_class_alias_annotation_t *node = (rbs_ast_ruby_annotations_class_alias_annotation_t *) instance;
|
|
853
|
+
|
|
854
|
+
VALUE h = rb_hash_new();
|
|
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
|
|
860
|
+
|
|
861
|
+
return CLASS_NEW_INSTANCE(
|
|
862
|
+
RBS_AST_Ruby_Annotations_ClassAliasAnnotation,
|
|
863
|
+
1,
|
|
864
|
+
&h
|
|
865
|
+
);
|
|
866
|
+
}
|
|
867
|
+
case RBS_AST_RUBY_ANNOTATIONS_COLON_METHOD_TYPE_ANNOTATION: {
|
|
868
|
+
rbs_ast_ruby_annotations_colon_method_type_annotation_t *node = (rbs_ast_ruby_annotations_colon_method_type_annotation_t *) instance;
|
|
869
|
+
|
|
870
|
+
VALUE h = rb_hash_new();
|
|
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));
|
|
873
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), rbs_node_list_to_ruby_array(ctx, node->annotations));
|
|
874
|
+
rb_hash_aset(h, ID2SYM(rb_intern("method_type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->method_type)); // rbs_node
|
|
875
|
+
|
|
876
|
+
return CLASS_NEW_INSTANCE(
|
|
877
|
+
RBS_AST_Ruby_Annotations_ColonMethodTypeAnnotation,
|
|
878
|
+
1,
|
|
879
|
+
&h
|
|
880
|
+
);
|
|
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
|
+
}
|
|
900
|
+
case RBS_AST_RUBY_ANNOTATIONS_INSTANCE_VARIABLE_ANNOTATION: {
|
|
901
|
+
rbs_ast_ruby_annotations_instance_variable_annotation_t *node = (rbs_ast_ruby_annotations_instance_variable_annotation_t *) instance;
|
|
902
|
+
|
|
903
|
+
VALUE h = rb_hash_new();
|
|
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));
|
|
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
|
|
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
|
|
911
|
+
|
|
912
|
+
return CLASS_NEW_INSTANCE(
|
|
913
|
+
RBS_AST_Ruby_Annotations_InstanceVariableAnnotation,
|
|
914
|
+
1,
|
|
915
|
+
&h
|
|
916
|
+
);
|
|
917
|
+
}
|
|
918
|
+
case RBS_AST_RUBY_ANNOTATIONS_METHOD_TYPES_ANNOTATION: {
|
|
919
|
+
rbs_ast_ruby_annotations_method_types_annotation_t *node = (rbs_ast_ruby_annotations_method_types_annotation_t *) instance;
|
|
920
|
+
|
|
921
|
+
VALUE h = rb_hash_new();
|
|
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));
|
|
924
|
+
rb_hash_aset(h, ID2SYM(rb_intern("overloads")), rbs_node_list_to_ruby_array(ctx, node->overloads));
|
|
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
|
|
927
|
+
|
|
928
|
+
return CLASS_NEW_INSTANCE(
|
|
929
|
+
RBS_AST_Ruby_Annotations_MethodTypesAnnotation,
|
|
930
|
+
1,
|
|
931
|
+
&h
|
|
932
|
+
);
|
|
933
|
+
}
|
|
934
|
+
case RBS_AST_RUBY_ANNOTATIONS_MODULE_ALIAS_ANNOTATION: {
|
|
935
|
+
rbs_ast_ruby_annotations_module_alias_annotation_t *node = (rbs_ast_ruby_annotations_module_alias_annotation_t *) instance;
|
|
936
|
+
|
|
937
|
+
VALUE h = rb_hash_new();
|
|
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
|
|
943
|
+
|
|
944
|
+
return CLASS_NEW_INSTANCE(
|
|
945
|
+
RBS_AST_Ruby_Annotations_ModuleAliasAnnotation,
|
|
946
|
+
1,
|
|
947
|
+
&h
|
|
948
|
+
);
|
|
949
|
+
}
|
|
950
|
+
case RBS_AST_RUBY_ANNOTATIONS_NODE_TYPE_ASSERTION: {
|
|
951
|
+
rbs_ast_ruby_annotations_node_type_assertion_t *node = (rbs_ast_ruby_annotations_node_type_assertion_t *) instance;
|
|
952
|
+
|
|
953
|
+
VALUE h = rb_hash_new();
|
|
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));
|
|
956
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
957
|
+
|
|
958
|
+
return CLASS_NEW_INSTANCE(
|
|
959
|
+
RBS_AST_Ruby_Annotations_NodeTypeAssertion,
|
|
960
|
+
1,
|
|
961
|
+
&h
|
|
962
|
+
);
|
|
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
|
+
}
|
|
981
|
+
case RBS_AST_RUBY_ANNOTATIONS_RETURN_TYPE_ANNOTATION: {
|
|
982
|
+
rbs_ast_ruby_annotations_return_type_annotation_t *node = (rbs_ast_ruby_annotations_return_type_annotation_t *) instance;
|
|
983
|
+
|
|
984
|
+
VALUE h = rb_hash_new();
|
|
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
|
|
991
|
+
|
|
992
|
+
return CLASS_NEW_INSTANCE(
|
|
993
|
+
RBS_AST_Ruby_Annotations_ReturnTypeAnnotation,
|
|
994
|
+
1,
|
|
995
|
+
&h
|
|
996
|
+
);
|
|
997
|
+
}
|
|
998
|
+
case RBS_AST_RUBY_ANNOTATIONS_SKIP_ANNOTATION: {
|
|
999
|
+
rbs_ast_ruby_annotations_skip_annotation_t *node = (rbs_ast_ruby_annotations_skip_annotation_t *) instance;
|
|
1000
|
+
|
|
1001
|
+
VALUE h = rb_hash_new();
|
|
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
|
|
1006
|
+
|
|
1007
|
+
return CLASS_NEW_INSTANCE(
|
|
1008
|
+
RBS_AST_Ruby_Annotations_SkipAnnotation,
|
|
1009
|
+
1,
|
|
1010
|
+
&h
|
|
1011
|
+
);
|
|
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
|
+
}
|
|
1031
|
+
case RBS_AST_RUBY_ANNOTATIONS_TYPE_APPLICATION_ANNOTATION: {
|
|
1032
|
+
rbs_ast_ruby_annotations_type_application_annotation_t *node = (rbs_ast_ruby_annotations_type_application_annotation_t *) instance;
|
|
1033
|
+
|
|
1034
|
+
VALUE h = rb_hash_new();
|
|
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));
|
|
1037
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_args")), rbs_node_list_to_ruby_array(ctx, node->type_args));
|
|
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));
|
|
1040
|
+
|
|
1041
|
+
return CLASS_NEW_INSTANCE(
|
|
1042
|
+
RBS_AST_Ruby_Annotations_TypeApplicationAnnotation,
|
|
1043
|
+
1,
|
|
1044
|
+
&h
|
|
1045
|
+
);
|
|
1046
|
+
}
|
|
583
1047
|
case RBS_AST_STRING: {
|
|
584
1048
|
rbs_ast_string_t *string_node = (rbs_ast_string_t *) instance;
|
|
585
1049
|
rbs_string_t s = string_node->string;
|
|
@@ -590,10 +1054,20 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
590
1054
|
rbs_ast_type_param_t *node = (rbs_ast_type_param_t *) instance;
|
|
591
1055
|
|
|
592
1056
|
VALUE h = rb_hash_new();
|
|
593
|
-
|
|
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);
|
|
594
1067
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_ast_symbol
|
|
595
|
-
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
|
|
596
1069
|
rb_hash_aset(h, ID2SYM(rb_intern("upper_bound")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->upper_bound)); // rbs_node
|
|
1070
|
+
rb_hash_aset(h, ID2SYM(rb_intern("lower_bound")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->lower_bound)); // rbs_node
|
|
597
1071
|
rb_hash_aset(h, ID2SYM(rb_intern("default_type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->default_type)); // rbs_node
|
|
598
1072
|
rb_hash_aset(h, ID2SYM(rb_intern("unchecked")), node->unchecked ? Qtrue : Qfalse);
|
|
599
1073
|
|
|
@@ -607,7 +1081,12 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
607
1081
|
rbs_method_type_t *node = (rbs_method_type_t *) instance;
|
|
608
1082
|
|
|
609
1083
|
VALUE h = rb_hash_new();
|
|
610
|
-
|
|
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);
|
|
611
1090
|
rb_hash_aset(h, ID2SYM(rb_intern("type_params")), rbs_node_list_to_ruby_array(ctx, node->type_params));
|
|
612
1091
|
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
613
1092
|
rb_hash_aset(h, ID2SYM(rb_intern("block")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->block)); // rbs_types_block
|
|
@@ -662,7 +1141,12 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
662
1141
|
rbs_types_alias_t *node = (rbs_types_alias_t *) instance;
|
|
663
1142
|
|
|
664
1143
|
VALUE h = rb_hash_new();
|
|
665
|
-
|
|
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);
|
|
666
1150
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
667
1151
|
rb_hash_aset(h, ID2SYM(rb_intern("args")), rbs_node_list_to_ruby_array(ctx, node->args));
|
|
668
1152
|
|
|
@@ -676,7 +1160,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
676
1160
|
rbs_types_bases_any_t *node = (rbs_types_bases_any_t *) instance;
|
|
677
1161
|
|
|
678
1162
|
VALUE h = rb_hash_new();
|
|
679
|
-
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));
|
|
680
1164
|
rb_hash_aset(h, ID2SYM(rb_intern("todo")), node->todo ? Qtrue : Qfalse);
|
|
681
1165
|
|
|
682
1166
|
return CLASS_NEW_INSTANCE(
|
|
@@ -689,7 +1173,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
689
1173
|
rbs_types_bases_bool_t *node = (rbs_types_bases_bool_t *) instance;
|
|
690
1174
|
|
|
691
1175
|
VALUE h = rb_hash_new();
|
|
692
|
-
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));
|
|
693
1177
|
|
|
694
1178
|
return CLASS_NEW_INSTANCE(
|
|
695
1179
|
RBS_Types_Bases_Bool,
|
|
@@ -701,7 +1185,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
701
1185
|
rbs_types_bases_bottom_t *node = (rbs_types_bases_bottom_t *) instance;
|
|
702
1186
|
|
|
703
1187
|
VALUE h = rb_hash_new();
|
|
704
|
-
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));
|
|
705
1189
|
|
|
706
1190
|
return CLASS_NEW_INSTANCE(
|
|
707
1191
|
RBS_Types_Bases_Bottom,
|
|
@@ -713,7 +1197,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
713
1197
|
rbs_types_bases_class_t *node = (rbs_types_bases_class_t *) instance;
|
|
714
1198
|
|
|
715
1199
|
VALUE h = rb_hash_new();
|
|
716
|
-
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));
|
|
717
1201
|
|
|
718
1202
|
return CLASS_NEW_INSTANCE(
|
|
719
1203
|
RBS_Types_Bases_Class,
|
|
@@ -725,7 +1209,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
725
1209
|
rbs_types_bases_instance_t *node = (rbs_types_bases_instance_t *) instance;
|
|
726
1210
|
|
|
727
1211
|
VALUE h = rb_hash_new();
|
|
728
|
-
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));
|
|
729
1213
|
|
|
730
1214
|
return CLASS_NEW_INSTANCE(
|
|
731
1215
|
RBS_Types_Bases_Instance,
|
|
@@ -737,7 +1221,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
737
1221
|
rbs_types_bases_nil_t *node = (rbs_types_bases_nil_t *) instance;
|
|
738
1222
|
|
|
739
1223
|
VALUE h = rb_hash_new();
|
|
740
|
-
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));
|
|
741
1225
|
|
|
742
1226
|
return CLASS_NEW_INSTANCE(
|
|
743
1227
|
RBS_Types_Bases_Nil,
|
|
@@ -749,7 +1233,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
749
1233
|
rbs_types_bases_self_t *node = (rbs_types_bases_self_t *) instance;
|
|
750
1234
|
|
|
751
1235
|
VALUE h = rb_hash_new();
|
|
752
|
-
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));
|
|
753
1237
|
|
|
754
1238
|
return CLASS_NEW_INSTANCE(
|
|
755
1239
|
RBS_Types_Bases_Self,
|
|
@@ -761,7 +1245,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
761
1245
|
rbs_types_bases_top_t *node = (rbs_types_bases_top_t *) instance;
|
|
762
1246
|
|
|
763
1247
|
VALUE h = rb_hash_new();
|
|
764
|
-
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));
|
|
765
1249
|
|
|
766
1250
|
return CLASS_NEW_INSTANCE(
|
|
767
1251
|
RBS_Types_Bases_Top,
|
|
@@ -773,7 +1257,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
773
1257
|
rbs_types_bases_void_t *node = (rbs_types_bases_void_t *) instance;
|
|
774
1258
|
|
|
775
1259
|
VALUE h = rb_hash_new();
|
|
776
|
-
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));
|
|
777
1261
|
|
|
778
1262
|
return CLASS_NEW_INSTANCE(
|
|
779
1263
|
RBS_Types_Bases_Void,
|
|
@@ -785,7 +1269,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
785
1269
|
rbs_types_block_t *node = (rbs_types_block_t *) instance;
|
|
786
1270
|
|
|
787
1271
|
VALUE h = rb_hash_new();
|
|
788
|
-
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));
|
|
789
1273
|
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
790
1274
|
rb_hash_aset(h, ID2SYM(rb_intern("required")), node->required ? Qtrue : Qfalse);
|
|
791
1275
|
rb_hash_aset(h, ID2SYM(rb_intern("self_type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->self_type)); // rbs_node
|
|
@@ -800,7 +1284,12 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
800
1284
|
rbs_types_class_instance_t *node = (rbs_types_class_instance_t *) instance;
|
|
801
1285
|
|
|
802
1286
|
VALUE h = rb_hash_new();
|
|
803
|
-
|
|
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);
|
|
804
1293
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
805
1294
|
rb_hash_aset(h, ID2SYM(rb_intern("args")), rbs_node_list_to_ruby_array(ctx, node->args));
|
|
806
1295
|
|
|
@@ -814,8 +1303,14 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
814
1303
|
rbs_types_class_singleton_t *node = (rbs_types_class_singleton_t *) instance;
|
|
815
1304
|
|
|
816
1305
|
VALUE h = rb_hash_new();
|
|
817
|
-
|
|
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);
|
|
818
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));
|
|
819
1314
|
|
|
820
1315
|
return CLASS_NEW_INSTANCE(
|
|
821
1316
|
RBS_Types_ClassSingleton,
|
|
@@ -846,7 +1341,11 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
846
1341
|
rbs_types_function_param_t *node = (rbs_types_function_param_t *) instance;
|
|
847
1342
|
|
|
848
1343
|
VALUE h = rb_hash_new();
|
|
849
|
-
|
|
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);
|
|
850
1349
|
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
851
1350
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_ast_symbol
|
|
852
1351
|
|
|
@@ -860,7 +1359,12 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
860
1359
|
rbs_types_interface_t *node = (rbs_types_interface_t *) instance;
|
|
861
1360
|
|
|
862
1361
|
VALUE h = rb_hash_new();
|
|
863
|
-
|
|
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);
|
|
864
1368
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
865
1369
|
rb_hash_aset(h, ID2SYM(rb_intern("args")), rbs_node_list_to_ruby_array(ctx, node->args));
|
|
866
1370
|
|
|
@@ -874,7 +1378,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
874
1378
|
rbs_types_intersection_t *node = (rbs_types_intersection_t *) instance;
|
|
875
1379
|
|
|
876
1380
|
VALUE h = rb_hash_new();
|
|
877
|
-
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));
|
|
878
1382
|
rb_hash_aset(h, ID2SYM(rb_intern("types")), rbs_node_list_to_ruby_array(ctx, node->types));
|
|
879
1383
|
|
|
880
1384
|
return CLASS_NEW_INSTANCE(
|
|
@@ -887,7 +1391,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
887
1391
|
rbs_types_literal_t *node = (rbs_types_literal_t *) instance;
|
|
888
1392
|
|
|
889
1393
|
VALUE h = rb_hash_new();
|
|
890
|
-
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));
|
|
891
1395
|
rb_hash_aset(h, ID2SYM(rb_intern("literal")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->literal)); // rbs_node
|
|
892
1396
|
|
|
893
1397
|
return CLASS_NEW_INSTANCE(
|
|
@@ -900,7 +1404,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
900
1404
|
rbs_types_optional_t *node = (rbs_types_optional_t *) instance;
|
|
901
1405
|
|
|
902
1406
|
VALUE h = rb_hash_new();
|
|
903
|
-
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));
|
|
904
1408
|
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
905
1409
|
|
|
906
1410
|
return CLASS_NEW_INSTANCE(
|
|
@@ -913,7 +1417,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
913
1417
|
rbs_types_proc_t *node = (rbs_types_proc_t *) instance;
|
|
914
1418
|
|
|
915
1419
|
VALUE h = rb_hash_new();
|
|
916
|
-
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));
|
|
917
1421
|
rb_hash_aset(h, ID2SYM(rb_intern("type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type)); // rbs_node
|
|
918
1422
|
rb_hash_aset(h, ID2SYM(rb_intern("block")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->block)); // rbs_types_block
|
|
919
1423
|
rb_hash_aset(h, ID2SYM(rb_intern("self_type")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->self_type)); // rbs_node
|
|
@@ -928,7 +1432,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
928
1432
|
rbs_types_record_t *node = (rbs_types_record_t *) instance;
|
|
929
1433
|
|
|
930
1434
|
VALUE h = rb_hash_new();
|
|
931
|
-
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));
|
|
932
1436
|
rb_hash_aset(h, ID2SYM(rb_intern("all_fields")), rbs_hash_to_ruby_hash(ctx, node->all_fields));
|
|
933
1437
|
|
|
934
1438
|
return CLASS_NEW_INSTANCE(
|
|
@@ -949,7 +1453,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
949
1453
|
rbs_types_tuple_t *node = (rbs_types_tuple_t *) instance;
|
|
950
1454
|
|
|
951
1455
|
VALUE h = rb_hash_new();
|
|
952
|
-
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));
|
|
953
1457
|
rb_hash_aset(h, ID2SYM(rb_intern("types")), rbs_node_list_to_ruby_array(ctx, node->types));
|
|
954
1458
|
|
|
955
1459
|
return CLASS_NEW_INSTANCE(
|
|
@@ -962,7 +1466,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
962
1466
|
rbs_types_union_t *node = (rbs_types_union_t *) instance;
|
|
963
1467
|
|
|
964
1468
|
VALUE h = rb_hash_new();
|
|
965
|
-
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));
|
|
966
1470
|
rb_hash_aset(h, ID2SYM(rb_intern("types")), rbs_node_list_to_ruby_array(ctx, node->types));
|
|
967
1471
|
|
|
968
1472
|
return CLASS_NEW_INSTANCE(
|
|
@@ -987,7 +1491,7 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
987
1491
|
rbs_types_variable_t *node = (rbs_types_variable_t *) instance;
|
|
988
1492
|
|
|
989
1493
|
VALUE h = rb_hash_new();
|
|
990
|
-
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));
|
|
991
1495
|
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_ast_symbol
|
|
992
1496
|
|
|
993
1497
|
return CLASS_NEW_INSTANCE(
|
|
@@ -996,15 +1500,8 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
996
1500
|
&h
|
|
997
1501
|
);
|
|
998
1502
|
}
|
|
999
|
-
case RBS_KEYWORD: {
|
|
1000
|
-
rbs_constant_t *constant = rbs_constant_pool_id_to_constant(RBS_GLOBAL_CONSTANT_POOL, ((rbs_keyword_t *) instance)->constant_id);
|
|
1001
|
-
assert(constant != NULL && "constant is NULL");
|
|
1002
|
-
assert(constant->start != NULL && "constant->start is NULL");
|
|
1003
|
-
|
|
1004
|
-
return ID2SYM(rb_intern2((const char *) constant->start, constant->length));
|
|
1005
|
-
}
|
|
1006
1503
|
case RBS_AST_SYMBOL: {
|
|
1007
|
-
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);
|
|
1008
1505
|
assert(constant != NULL && "constant is NULL");
|
|
1009
1506
|
assert(constant->start != NULL && "constant->start is NULL");
|
|
1010
1507
|
|