rbs 4.1.0.pre.2-java
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 +7 -0
- data/.clang-format +75 -0
- data/.clangd +2 -0
- data/.github/dependabot.yml +24 -0
- data/.github/workflows/bundle-update.yml +63 -0
- data/.github/workflows/c-check.yml +61 -0
- data/.github/workflows/comments.yml +37 -0
- data/.github/workflows/dependabot.yml +30 -0
- data/.github/workflows/jruby.yml +67 -0
- data/.github/workflows/milestone.yml +83 -0
- data/.github/workflows/ruby.yml +158 -0
- data/.github/workflows/rust.yml +184 -0
- data/.github/workflows/truffleruby.yml +54 -0
- data/.github/workflows/typecheck.yml +39 -0
- data/.github/workflows/wasm.yml +53 -0
- data/.github/workflows/windows.yml +49 -0
- data/.gitignore +38 -0
- data/.rubocop.yml +72 -0
- data/BSDL +22 -0
- data/CHANGELOG.md +2292 -0
- data/COPYING +56 -0
- data/README.md +240 -0
- data/Rakefile +869 -0
- data/Steepfile +53 -0
- data/config.yml +913 -0
- data/core/array.rbs +4142 -0
- data/core/basic_object.rbs +376 -0
- data/core/binding.rbs +148 -0
- data/core/builtin.rbs +278 -0
- data/core/class.rbs +223 -0
- data/core/comparable.rbs +192 -0
- data/core/complex.rbs +812 -0
- data/core/constants.rbs +96 -0
- data/core/data.rbs +415 -0
- data/core/dir.rbs +993 -0
- data/core/encoding.rbs +1368 -0
- data/core/enumerable.rbs +2506 -0
- data/core/enumerator/arithmetic_sequence.rbs +70 -0
- data/core/enumerator/product.rbs +92 -0
- data/core/enumerator.rbs +705 -0
- data/core/env.rbs +6 -0
- data/core/errno.rbs +682 -0
- data/core/errors.rbs +789 -0
- data/core/exception.rbs +485 -0
- data/core/false_class.rbs +82 -0
- data/core/fiber.rbs +570 -0
- data/core/fiber_error.rbs +11 -0
- data/core/file.rbs +2045 -0
- data/core/file_constants.rbs +463 -0
- data/core/file_stat.rbs +534 -0
- data/core/file_test.rbs +331 -0
- data/core/float.rbs +1316 -0
- data/core/gc.rbs +788 -0
- data/core/global_variables.rbs +184 -0
- data/core/hash.rbs +2183 -0
- data/core/integer.rbs +1374 -0
- data/core/io/buffer.rbs +995 -0
- data/core/io/wait.rbs +48 -0
- data/core/io.rbs +3472 -0
- data/core/kernel.rbs +3172 -0
- data/core/marshal.rbs +207 -0
- data/core/match_data.rbs +637 -0
- data/core/math.rbs +770 -0
- data/core/method.rbs +422 -0
- data/core/module.rbs +1856 -0
- data/core/nil_class.rbs +210 -0
- data/core/numeric.rbs +832 -0
- data/core/object.rbs +108 -0
- data/core/object_space/weak_key_map.rbs +166 -0
- data/core/object_space.rbs +197 -0
- data/core/pathname.rbs +1322 -0
- data/core/proc.rbs +905 -0
- data/core/process.rbs +2316 -0
- data/core/ractor.rbs +924 -0
- data/core/random.rbs +255 -0
- data/core/range.rbs +1209 -0
- data/core/rational.rbs +502 -0
- data/core/rb_config.rbs +88 -0
- data/core/rbs/ops.rbs +154 -0
- data/core/rbs/unnamed/argf.rbs +1236 -0
- data/core/rbs/unnamed/env_class.rbs +1214 -0
- data/core/rbs/unnamed/main_class.rbs +123 -0
- data/core/rbs/unnamed/random.rbs +186 -0
- data/core/refinement.rbs +59 -0
- data/core/regexp.rbs +1974 -0
- data/core/ruby.rbs +53 -0
- data/core/ruby_vm.rbs +809 -0
- data/core/rubygems/basic_specification.rbs +6 -0
- data/core/rubygems/config_file.rbs +38 -0
- data/core/rubygems/dependency_installer.rbs +6 -0
- data/core/rubygems/errors.rbs +109 -0
- data/core/rubygems/installer.rbs +15 -0
- data/core/rubygems/path_support.rbs +6 -0
- data/core/rubygems/platform.rbs +7 -0
- data/core/rubygems/request_set.rbs +49 -0
- data/core/rubygems/requirement.rbs +148 -0
- data/core/rubygems/rubygems.rbs +1105 -0
- data/core/rubygems/source_list.rbs +15 -0
- data/core/rubygems/specification.rbs +23 -0
- data/core/rubygems/stream_ui.rbs +5 -0
- data/core/rubygems/uninstaller.rbs +10 -0
- data/core/rubygems/version.rbs +293 -0
- data/core/set.rbs +751 -0
- data/core/signal.rbs +110 -0
- data/core/string.rbs +5532 -0
- data/core/struct.rbs +668 -0
- data/core/symbol.rbs +482 -0
- data/core/thread.rbs +1826 -0
- data/core/thread_group.rbs +79 -0
- data/core/time.rbs +1793 -0
- data/core/trace_point.rbs +483 -0
- data/core/true_class.rbs +98 -0
- data/core/unbound_method.rbs +337 -0
- data/core/warning.rbs +87 -0
- data/docs/CONTRIBUTING.md +107 -0
- data/docs/aliases.md +79 -0
- data/docs/architecture.md +110 -0
- data/docs/collection.md +192 -0
- data/docs/config.md +171 -0
- data/docs/data_and_struct.md +86 -0
- data/docs/encoding.md +56 -0
- data/docs/gem.md +56 -0
- data/docs/inline.md +634 -0
- data/docs/rbs_by_example.md +309 -0
- data/docs/repo.md +125 -0
- data/docs/rust.md +96 -0
- data/docs/sigs.md +167 -0
- data/docs/stdlib.md +147 -0
- data/docs/syntax.md +940 -0
- data/docs/tools.md +17 -0
- data/docs/type_fingerprint.md +21 -0
- data/docs/wasm_serialization.md +80 -0
- data/exe/rbs +7 -0
- data/ext/rbs_extension/ast_translation.c +1855 -0
- data/ext/rbs_extension/ast_translation.h +41 -0
- data/ext/rbs_extension/class_constants.c +187 -0
- data/ext/rbs_extension/class_constants.h +104 -0
- data/ext/rbs_extension/compat.h +10 -0
- data/ext/rbs_extension/extconf.rb +40 -0
- data/ext/rbs_extension/legacy_location.c +294 -0
- data/ext/rbs_extension/legacy_location.h +82 -0
- data/ext/rbs_extension/main.c +613 -0
- data/ext/rbs_extension/rbs_extension.h +16 -0
- data/ext/rbs_extension/rbs_string_bridging.c +9 -0
- data/ext/rbs_extension/rbs_string_bridging.h +24 -0
- data/goodcheck.yml +91 -0
- data/include/rbs/ast.h +1047 -0
- data/include/rbs/defines.h +99 -0
- data/include/rbs/lexer.h +207 -0
- data/include/rbs/location.h +40 -0
- data/include/rbs/parser.h +153 -0
- data/include/rbs/serialize.h +39 -0
- data/include/rbs/string.h +47 -0
- data/include/rbs/util/rbs_allocator.h +59 -0
- data/include/rbs/util/rbs_assert.h +20 -0
- data/include/rbs/util/rbs_buffer.h +83 -0
- data/include/rbs/util/rbs_constant_pool.h +155 -0
- data/include/rbs/util/rbs_encoding.h +282 -0
- data/include/rbs/util/rbs_unescape.h +24 -0
- data/include/rbs.h +14 -0
- data/lib/rbs/ancestor_graph.rb +92 -0
- data/lib/rbs/annotate/annotations.rb +199 -0
- data/lib/rbs/annotate/formatter.rb +82 -0
- data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
- data/lib/rbs/annotate/rdoc_source.rb +131 -0
- data/lib/rbs/annotate.rb +8 -0
- data/lib/rbs/ast/annotation.rb +29 -0
- data/lib/rbs/ast/comment.rb +29 -0
- data/lib/rbs/ast/declarations.rb +472 -0
- data/lib/rbs/ast/directives.rb +49 -0
- data/lib/rbs/ast/members.rb +451 -0
- data/lib/rbs/ast/ruby/annotations.rb +451 -0
- data/lib/rbs/ast/ruby/comment_block.rb +247 -0
- data/lib/rbs/ast/ruby/declarations.rb +291 -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 +762 -0
- data/lib/rbs/ast/type_param.rb +235 -0
- data/lib/rbs/ast/visitor.rb +137 -0
- data/lib/rbs/buffer.rb +189 -0
- data/lib/rbs/builtin_names.rb +58 -0
- data/lib/rbs/cli/colored_io.rb +48 -0
- data/lib/rbs/cli/diff.rb +84 -0
- data/lib/rbs/cli/validate.rb +294 -0
- data/lib/rbs/cli.rb +1253 -0
- data/lib/rbs/collection/cleaner.rb +38 -0
- data/lib/rbs/collection/config/lockfile.rb +92 -0
- data/lib/rbs/collection/config/lockfile_generator.rb +269 -0
- data/lib/rbs/collection/config.rb +81 -0
- data/lib/rbs/collection/installer.rb +32 -0
- data/lib/rbs/collection/sources/base.rb +14 -0
- data/lib/rbs/collection/sources/git.rb +265 -0
- data/lib/rbs/collection/sources/local.rb +81 -0
- data/lib/rbs/collection/sources/rubygems.rb +48 -0
- data/lib/rbs/collection/sources/stdlib.rb +50 -0
- data/lib/rbs/collection/sources.rb +38 -0
- data/lib/rbs/collection.rb +16 -0
- data/lib/rbs/constant.rb +28 -0
- data/lib/rbs/definition.rb +415 -0
- data/lib/rbs/definition_builder/ancestor_builder.rb +678 -0
- data/lib/rbs/definition_builder/method_builder.rb +295 -0
- data/lib/rbs/definition_builder.rb +1054 -0
- data/lib/rbs/diff.rb +131 -0
- data/lib/rbs/environment/class_entry.rb +69 -0
- data/lib/rbs/environment/module_entry.rb +66 -0
- data/lib/rbs/environment/use_map.rb +77 -0
- data/lib/rbs/environment.rb +1028 -0
- data/lib/rbs/environment_loader.rb +167 -0
- data/lib/rbs/environment_walker.rb +155 -0
- data/lib/rbs/errors.rb +634 -0
- data/lib/rbs/factory.rb +18 -0
- data/lib/rbs/file_finder.rb +28 -0
- data/lib/rbs/inline_parser/comment_association.rb +117 -0
- data/lib/rbs/inline_parser.rb +568 -0
- data/lib/rbs/location_aux.rb +170 -0
- data/lib/rbs/locator.rb +247 -0
- data/lib/rbs/method_type.rb +145 -0
- data/lib/rbs/namespace.rb +154 -0
- data/lib/rbs/parser/lex_result.rb +15 -0
- data/lib/rbs/parser/token.rb +23 -0
- data/lib/rbs/parser_aux.rb +142 -0
- data/lib/rbs/prototype/helpers.rb +197 -0
- data/lib/rbs/prototype/node_usage.rb +99 -0
- data/lib/rbs/prototype/rb.rb +816 -0
- data/lib/rbs/prototype/rbi.rb +625 -0
- data/lib/rbs/prototype/runtime/helpers.rb +59 -0
- data/lib/rbs/prototype/runtime/reflection.rb +19 -0
- data/lib/rbs/prototype/runtime/value_object_generator.rb +279 -0
- data/lib/rbs/prototype/runtime.rb +680 -0
- data/lib/rbs/repository.rb +127 -0
- data/lib/rbs/resolver/constant_resolver.rb +219 -0
- data/lib/rbs/resolver/type_name_resolver.rb +167 -0
- data/lib/rbs/rewriter.rb +70 -0
- data/lib/rbs/sorter.rb +198 -0
- data/lib/rbs/source.rb +99 -0
- data/lib/rbs/substitution.rb +83 -0
- data/lib/rbs/subtractor.rb +204 -0
- data/lib/rbs/test/errors.rb +80 -0
- data/lib/rbs/test/guaranteed.rb +30 -0
- data/lib/rbs/test/hook.rb +212 -0
- data/lib/rbs/test/observer.rb +19 -0
- data/lib/rbs/test/setup.rb +84 -0
- data/lib/rbs/test/setup_helper.rb +50 -0
- data/lib/rbs/test/tester.rb +167 -0
- data/lib/rbs/test/type_check.rb +457 -0
- data/lib/rbs/test.rb +112 -0
- data/lib/rbs/type_alias_dependency.rb +100 -0
- data/lib/rbs/type_alias_regularity.rb +126 -0
- data/lib/rbs/type_name.rb +122 -0
- data/lib/rbs/types.rb +1604 -0
- data/lib/rbs/unit_test/convertibles.rb +177 -0
- data/lib/rbs/unit_test/spy.rb +138 -0
- data/lib/rbs/unit_test/type_assertions.rb +383 -0
- data/lib/rbs/unit_test/with_aliases.rb +145 -0
- data/lib/rbs/unit_test.rb +6 -0
- data/lib/rbs/validator.rb +186 -0
- data/lib/rbs/variance_calculator.rb +189 -0
- data/lib/rbs/vendorer.rb +71 -0
- data/lib/rbs/version.rb +5 -0
- data/lib/rbs/wasm/deserializer.rb +213 -0
- data/lib/rbs/wasm/jars/asm-analysis.jar +0 -0
- data/lib/rbs/wasm/jars/asm-commons.jar +0 -0
- data/lib/rbs/wasm/jars/asm-tree.jar +0 -0
- data/lib/rbs/wasm/jars/asm-util.jar +0 -0
- data/lib/rbs/wasm/jars/asm.jar +0 -0
- data/lib/rbs/wasm/jars/compiler.jar +0 -0
- data/lib/rbs/wasm/jars/log.jar +0 -0
- data/lib/rbs/wasm/jars/runtime.jar +0 -0
- data/lib/rbs/wasm/jars/wasi.jar +0 -0
- data/lib/rbs/wasm/jars/wasm.jar +0 -0
- data/lib/rbs/wasm/location.rb +61 -0
- data/lib/rbs/wasm/parser.rb +137 -0
- data/lib/rbs/wasm/rbs_parser.wasm +0 -0
- data/lib/rbs/wasm/runtime.rb +217 -0
- data/lib/rbs/wasm/serialization_schema.rb +110 -0
- data/lib/rbs/writer.rb +424 -0
- data/lib/rbs.rb +117 -0
- data/lib/rdoc/discover.rb +20 -0
- data/lib/rdoc_plugin/parser.rb +163 -0
- data/rbs.gemspec +68 -0
- data/schema/annotation.json +14 -0
- data/schema/comment.json +26 -0
- data/schema/decls.json +326 -0
- data/schema/function.json +87 -0
- data/schema/location.json +56 -0
- data/schema/members.json +266 -0
- data/schema/methodType.json +50 -0
- data/schema/typeParam.json +52 -0
- data/schema/types.json +317 -0
- data/sig/ancestor_builder.rbs +163 -0
- data/sig/ancestor_graph.rbs +60 -0
- data/sig/annotate/annotations.rbs +102 -0
- data/sig/annotate/formatter.rbs +24 -0
- data/sig/annotate/rdoc_annotater.rbs +85 -0
- data/sig/annotate/rdoc_source.rbs +32 -0
- data/sig/annotation.rbs +27 -0
- data/sig/ast/ruby/annotations.rbs +470 -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 +198 -0
- data/sig/buffer.rbs +108 -0
- data/sig/builtin_names.rbs +44 -0
- data/sig/cli/colored_io.rbs +15 -0
- data/sig/cli/diff.rbs +15 -0
- data/sig/cli/validate.rbs +47 -0
- data/sig/cli.rbs +89 -0
- data/sig/collection/cleaner.rbs +13 -0
- data/sig/collection/config/lockfile.rbs +74 -0
- data/sig/collection/config/lockfile_generator.rbs +68 -0
- data/sig/collection/config.rbs +46 -0
- data/sig/collection/installer.rbs +17 -0
- data/sig/collection/sources.rbs +214 -0
- data/sig/collection.rbs +4 -0
- data/sig/comment.rbs +26 -0
- data/sig/constant.rbs +21 -0
- data/sig/declarations.rbs +274 -0
- data/sig/definition.rbs +232 -0
- data/sig/definition_builder.rbs +181 -0
- data/sig/diff.rbs +28 -0
- data/sig/directives.rbs +77 -0
- data/sig/environment/class_entry.rbs +50 -0
- data/sig/environment/module_entry.rbs +50 -0
- data/sig/environment.rbs +286 -0
- data/sig/environment_loader.rbs +111 -0
- data/sig/environment_walker.rbs +65 -0
- data/sig/errors.rbs +408 -0
- data/sig/factory.rbs +5 -0
- data/sig/file_finder.rbs +28 -0
- data/sig/inline_parser/comment_association.rbs +71 -0
- data/sig/inline_parser.rbs +126 -0
- data/sig/location.rbs +135 -0
- data/sig/locator.rbs +56 -0
- data/sig/manifest.yaml +5 -0
- data/sig/members.rbs +258 -0
- data/sig/method_builder.rbs +89 -0
- data/sig/method_types.rbs +58 -0
- data/sig/namespace.rbs +161 -0
- data/sig/parser.rbs +164 -0
- data/sig/prototype/helpers.rbs +29 -0
- data/sig/prototype/node_usage.rbs +20 -0
- data/sig/prototype/rb.rbs +96 -0
- data/sig/prototype/rbi.rbs +75 -0
- data/sig/prototype/runtime.rbs +182 -0
- data/sig/rbs.rbs +21 -0
- data/sig/rdoc/rbs.rbs +67 -0
- data/sig/repository.rbs +85 -0
- data/sig/resolver/constant_resolver.rbs +92 -0
- data/sig/resolver/context.rbs +34 -0
- data/sig/resolver/type_name_resolver.rbs +61 -0
- data/sig/rewriter.rbs +45 -0
- data/sig/shims/bundler.rbs +38 -0
- data/sig/shims/enumerable.rbs +5 -0
- data/sig/shims/rubygems.rbs +19 -0
- data/sig/sorter.rbs +41 -0
- data/sig/source.rbs +48 -0
- data/sig/substitution.rbs +48 -0
- data/sig/subtractor.rbs +37 -0
- data/sig/test/errors.rbs +52 -0
- data/sig/test/guranteed.rbs +9 -0
- data/sig/test/type_check.rbs +19 -0
- data/sig/test.rbs +82 -0
- data/sig/type_alias_dependency.rbs +53 -0
- data/sig/type_alias_regularity.rbs +98 -0
- data/sig/type_param.rbs +115 -0
- data/sig/typename.rbs +89 -0
- data/sig/types.rbs +578 -0
- data/sig/unit_test/convertibles.rbs +154 -0
- data/sig/unit_test/spy.rbs +22 -0
- data/sig/unit_test/type_assertions.rbs +211 -0
- data/sig/unit_test/with_aliases.rbs +136 -0
- data/sig/use_map.rbs +35 -0
- data/sig/util.rbs +9 -0
- data/sig/validator.rbs +63 -0
- data/sig/variance_calculator.rbs +87 -0
- data/sig/vendorer.rbs +51 -0
- data/sig/version.rbs +3 -0
- data/sig/visitor.rbs +47 -0
- data/sig/wasm/deserializer.rbs +66 -0
- data/sig/wasm/serialization_schema.rbs +13 -0
- data/sig/writer.rbs +127 -0
- data/src/ast.c +1628 -0
- data/src/lexer.c +3217 -0
- data/src/lexer.re +155 -0
- data/src/lexstate.c +217 -0
- data/src/location.c +31 -0
- data/src/parser.c +4255 -0
- data/src/serialize.c +958 -0
- data/src/string.c +41 -0
- data/src/util/rbs_allocator.c +162 -0
- data/src/util/rbs_assert.c +19 -0
- data/src/util/rbs_buffer.c +54 -0
- data/src/util/rbs_constant_pool.c +268 -0
- data/src/util/rbs_encoding.c +21308 -0
- data/src/util/rbs_unescape.c +167 -0
- data/stdlib/abbrev/0/abbrev.rbs +66 -0
- data/stdlib/abbrev/0/array.rbs +26 -0
- data/stdlib/base64/0/base64.rbs +355 -0
- data/stdlib/benchmark/0/benchmark.rbs +452 -0
- data/stdlib/bigdecimal/0/big_decimal.rbs +1647 -0
- data/stdlib/bigdecimal-math/0/big_math.rbs +280 -0
- data/stdlib/bigdecimal-math/0/manifest.yaml +2 -0
- data/stdlib/cgi/0/core.rbs +911 -0
- data/stdlib/cgi/0/manifest.yaml +4 -0
- data/stdlib/cgi-escape/0/escape.rbs +171 -0
- data/stdlib/coverage/0/coverage.rbs +266 -0
- data/stdlib/csv/0/csv.rbs +3776 -0
- data/stdlib/csv/0/manifest.yaml +3 -0
- data/stdlib/date/0/date.rbs +1598 -0
- data/stdlib/date/0/date_time.rbs +617 -0
- data/stdlib/date/0/time.rbs +26 -0
- data/stdlib/dbm/0/dbm.rbs +421 -0
- data/stdlib/delegate/0/delegator.rbs +187 -0
- data/stdlib/delegate/0/kernel.rbs +47 -0
- data/stdlib/delegate/0/simple_delegator.rbs +96 -0
- data/stdlib/did_you_mean/0/did_you_mean.rbs +344 -0
- data/stdlib/digest/0/digest.rbs +687 -0
- data/stdlib/erb/0/erb.rbs +933 -0
- data/stdlib/etc/0/etc.rbs +884 -0
- data/stdlib/fileutils/0/fileutils.rbs +1753 -0
- data/stdlib/find/0/find.rbs +49 -0
- data/stdlib/forwardable/0/forwardable.rbs +271 -0
- data/stdlib/io-console/0/io-console.rbs +414 -0
- data/stdlib/ipaddr/0/ipaddr.rbs +436 -0
- data/stdlib/json/0/json.rbs +1963 -0
- data/stdlib/kconv/0/kconv.rbs +166 -0
- data/stdlib/logger/0/formatter.rbs +45 -0
- data/stdlib/logger/0/log_device.rbs +100 -0
- data/stdlib/logger/0/logger.rbs +796 -0
- data/stdlib/logger/0/manifest.yaml +2 -0
- data/stdlib/logger/0/period.rbs +17 -0
- data/stdlib/logger/0/severity.rbs +34 -0
- data/stdlib/minitest/0/kernel.rbs +42 -0
- data/stdlib/minitest/0/minitest/abstract_reporter.rbs +52 -0
- data/stdlib/minitest/0/minitest/assertion.rbs +17 -0
- data/stdlib/minitest/0/minitest/assertions.rbs +590 -0
- data/stdlib/minitest/0/minitest/backtrace_filter.rbs +23 -0
- data/stdlib/minitest/0/minitest/bench_spec.rbs +102 -0
- data/stdlib/minitest/0/minitest/benchmark.rbs +259 -0
- data/stdlib/minitest/0/minitest/composite_reporter.rbs +25 -0
- data/stdlib/minitest/0/minitest/compress.rbs +13 -0
- data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
- data/stdlib/minitest/0/minitest/expectation.rbs +2 -0
- data/stdlib/minitest/0/minitest/expectations.rbs +21 -0
- data/stdlib/minitest/0/minitest/guard.rbs +64 -0
- data/stdlib/minitest/0/minitest/mock.rbs +64 -0
- data/stdlib/minitest/0/minitest/parallel/executor.rbs +46 -0
- data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +5 -0
- data/stdlib/minitest/0/minitest/parallel/test.rbs +3 -0
- data/stdlib/minitest/0/minitest/parallel.rbs +2 -0
- data/stdlib/minitest/0/minitest/pride_io.rbs +62 -0
- data/stdlib/minitest/0/minitest/pride_lol.rbs +19 -0
- data/stdlib/minitest/0/minitest/progress_reporter.rbs +11 -0
- data/stdlib/minitest/0/minitest/reportable.rbs +53 -0
- data/stdlib/minitest/0/minitest/reporter.rbs +5 -0
- data/stdlib/minitest/0/minitest/result.rbs +28 -0
- data/stdlib/minitest/0/minitest/runnable.rbs +163 -0
- data/stdlib/minitest/0/minitest/skip.rbs +6 -0
- data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +48 -0
- data/stdlib/minitest/0/minitest/spec/dsl.rbs +129 -0
- data/stdlib/minitest/0/minitest/spec.rbs +11 -0
- data/stdlib/minitest/0/minitest/statistics_reporter.rbs +81 -0
- data/stdlib/minitest/0/minitest/summary_reporter.rbs +18 -0
- data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +92 -0
- data/stdlib/minitest/0/minitest/test.rbs +69 -0
- data/stdlib/minitest/0/minitest/unexpected_error.rbs +12 -0
- data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
- data/stdlib/minitest/0/minitest/unit/test_case.rbs +3 -0
- data/stdlib/minitest/0/minitest/unit.rbs +4 -0
- data/stdlib/minitest/0/minitest.rbs +115 -0
- data/stdlib/monitor/0/monitor.rbs +363 -0
- data/stdlib/mutex_m/0/mutex_m.rbs +104 -0
- data/stdlib/net-http/0/manifest.yaml +3 -0
- data/stdlib/net-http/0/net-http.rbs +5580 -0
- data/stdlib/net-protocol/0/manifest.yaml +2 -0
- data/stdlib/net-protocol/0/net-protocol.rbs +56 -0
- data/stdlib/net-smtp/0/manifest.yaml +2 -0
- data/stdlib/net-smtp/0/net-smtp.rbs +55 -0
- data/stdlib/nkf/0/nkf.rbs +402 -0
- data/stdlib/objspace/0/objspace.rbs +470 -0
- data/stdlib/observable/0/observable.rbs +217 -0
- data/stdlib/open-uri/0/manifest.yaml +4 -0
- data/stdlib/open-uri/0/open-uri.rbs +433 -0
- data/stdlib/open3/0/open3.rbs +606 -0
- data/stdlib/openssl/0/manifest.yaml +3 -0
- data/stdlib/openssl/0/openssl.rbs +12231 -0
- data/stdlib/optparse/0/optparse.rbs +1734 -0
- data/stdlib/pathname/0/pathname.rbs +36 -0
- data/stdlib/pp/0/manifest.yaml +2 -0
- data/stdlib/pp/0/pp.rbs +301 -0
- data/stdlib/prettyprint/0/prettyprint.rbs +383 -0
- data/stdlib/pstore/0/pstore.rbs +608 -0
- data/stdlib/psych/0/core_ext.rbs +12 -0
- data/stdlib/psych/0/dbm.rbs +237 -0
- data/stdlib/psych/0/manifest.yaml +3 -0
- data/stdlib/psych/0/psych.rbs +455 -0
- data/stdlib/psych/0/store.rbs +57 -0
- data/stdlib/pty/0/pty.rbs +240 -0
- data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
- data/stdlib/rdoc/0/code_object.rbs +52 -0
- data/stdlib/rdoc/0/comment.rbs +61 -0
- data/stdlib/rdoc/0/context.rbs +153 -0
- data/stdlib/rdoc/0/markup.rbs +117 -0
- data/stdlib/rdoc/0/options.rbs +76 -0
- data/stdlib/rdoc/0/parser.rbs +56 -0
- data/stdlib/rdoc/0/rdoc.rbs +393 -0
- data/stdlib/rdoc/0/ri.rbs +17 -0
- data/stdlib/rdoc/0/store.rbs +48 -0
- data/stdlib/rdoc/0/top_level.rbs +97 -0
- data/stdlib/resolv/0/manifest.yaml +3 -0
- data/stdlib/resolv/0/resolv.rbs +1787 -0
- data/stdlib/ripper/0/ripper.rbs +1654 -0
- data/stdlib/securerandom/0/manifest.yaml +2 -0
- data/stdlib/securerandom/0/securerandom.rbs +49 -0
- data/stdlib/shellwords/0/shellwords.rbs +229 -0
- data/stdlib/singleton/0/singleton.rbs +134 -0
- data/stdlib/socket/0/addrinfo.rbs +666 -0
- data/stdlib/socket/0/basic_socket.rbs +590 -0
- data/stdlib/socket/0/constants.rbs +2295 -0
- data/stdlib/socket/0/ip_socket.rbs +94 -0
- data/stdlib/socket/0/socket.rbs +4170 -0
- data/stdlib/socket/0/socket_error.rbs +5 -0
- data/stdlib/socket/0/tcp_server.rbs +192 -0
- data/stdlib/socket/0/tcp_socket.rbs +87 -0
- data/stdlib/socket/0/udp_socket.rbs +133 -0
- data/stdlib/socket/0/unix_server.rbs +169 -0
- data/stdlib/socket/0/unix_socket.rbs +172 -0
- data/stdlib/stringio/0/stringio.rbs +1681 -0
- data/stdlib/strscan/0/string_scanner.rbs +1648 -0
- data/stdlib/tempfile/0/tempfile.rbs +483 -0
- data/stdlib/time/0/time.rbs +434 -0
- data/stdlib/timeout/0/timeout.rbs +137 -0
- data/stdlib/tmpdir/0/tmpdir.rbs +69 -0
- data/stdlib/tsort/0/cyclic.rbs +8 -0
- data/stdlib/tsort/0/interfaces.rbs +20 -0
- data/stdlib/tsort/0/tsort.rbs +410 -0
- data/stdlib/uri/0/common.rbs +621 -0
- data/stdlib/uri/0/file.rbs +118 -0
- data/stdlib/uri/0/ftp.rbs +13 -0
- data/stdlib/uri/0/generic.rbs +1116 -0
- data/stdlib/uri/0/http.rbs +104 -0
- data/stdlib/uri/0/https.rbs +14 -0
- data/stdlib/uri/0/ldap.rbs +230 -0
- data/stdlib/uri/0/ldaps.rbs +14 -0
- data/stdlib/uri/0/mailto.rbs +92 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +189 -0
- data/stdlib/uri/0/rfc3986_parser.rbs +2 -0
- data/stdlib/uri/0/ws.rbs +13 -0
- data/stdlib/uri/0/wss.rbs +9 -0
- data/stdlib/yaml/0/manifest.yaml +2 -0
- data/stdlib/yaml/0/yaml.rbs +1 -0
- data/stdlib/zlib/0/buf_error.rbs +10 -0
- data/stdlib/zlib/0/data_error.rbs +10 -0
- data/stdlib/zlib/0/deflate.rbs +211 -0
- data/stdlib/zlib/0/error.rbs +20 -0
- data/stdlib/zlib/0/gzip_file/crc_error.rbs +12 -0
- data/stdlib/zlib/0/gzip_file/error.rbs +23 -0
- data/stdlib/zlib/0/gzip_file/length_error.rbs +12 -0
- data/stdlib/zlib/0/gzip_file/no_footer.rbs +11 -0
- data/stdlib/zlib/0/gzip_file.rbs +156 -0
- data/stdlib/zlib/0/gzip_reader.rbs +293 -0
- data/stdlib/zlib/0/gzip_writer.rbs +168 -0
- data/stdlib/zlib/0/inflate.rbs +180 -0
- data/stdlib/zlib/0/mem_error.rbs +10 -0
- data/stdlib/zlib/0/need_dict.rbs +13 -0
- data/stdlib/zlib/0/stream_end.rbs +11 -0
- data/stdlib/zlib/0/stream_error.rbs +11 -0
- data/stdlib/zlib/0/version_error.rbs +11 -0
- data/stdlib/zlib/0/zlib.rbs +449 -0
- data/stdlib/zlib/0/zstream.rbs +201 -0
- data/wasm/README.md +59 -0
- data/wasm/rbs_wasm.c +411 -0
- metadata +660 -0
|
@@ -0,0 +1,1855 @@
|
|
|
1
|
+
/*----------------------------------------------------------------------------*/
|
|
2
|
+
/* This file is generated by the templates/template.rb script and should not */
|
|
3
|
+
/* be modified manually. */
|
|
4
|
+
/* To change the template see */
|
|
5
|
+
/* templates/ext/rbs_extension/ast_translation.c.erb */
|
|
6
|
+
/*----------------------------------------------------------------------------*/
|
|
7
|
+
|
|
8
|
+
#include "ast_translation.h"
|
|
9
|
+
|
|
10
|
+
#include "class_constants.h"
|
|
11
|
+
#include "rbs_string_bridging.h"
|
|
12
|
+
#include "legacy_location.h"
|
|
13
|
+
|
|
14
|
+
VALUE EMPTY_ARRAY;
|
|
15
|
+
VALUE EMPTY_HASH;
|
|
16
|
+
|
|
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)))
|
|
20
|
+
|
|
21
|
+
rbs_translation_context_t rbs_translation_context_create(rbs_constant_pool_t *constant_pool, VALUE buffer, rb_encoding *ruby_encoding) {
|
|
22
|
+
return (rbs_translation_context_t) {
|
|
23
|
+
.constant_pool = constant_pool,
|
|
24
|
+
.buffer = buffer,
|
|
25
|
+
.encoding = ruby_encoding,
|
|
26
|
+
.reusable_kwargs_hash = rb_hash_new(),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
VALUE rbs_node_list_to_ruby_array(rbs_translation_context_t ctx, rbs_node_list_t *list) {
|
|
31
|
+
VALUE ruby_array = rb_ary_new();
|
|
32
|
+
|
|
33
|
+
for (rbs_node_list_node_t *n = list->head; n != NULL; n = n->next) {
|
|
34
|
+
rb_ary_push(ruby_array, rbs_struct_to_ruby_value(ctx, n->node));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return ruby_array;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
VALUE rbs_hash_to_ruby_hash(rbs_translation_context_t ctx, rbs_hash_t *rbs_hash) {
|
|
41
|
+
if (!rbs_hash->head) {
|
|
42
|
+
return EMPTY_HASH;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
VALUE ruby_hash = rb_hash_new();
|
|
46
|
+
|
|
47
|
+
for (rbs_hash_node_t *n = rbs_hash->head; n != NULL; n = n->next) {
|
|
48
|
+
VALUE key = rbs_struct_to_ruby_value(ctx, n->key);
|
|
49
|
+
VALUE value = rbs_struct_to_ruby_value(ctx, n->value);
|
|
50
|
+
rb_hash_aset(ruby_hash, key, value);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return ruby_hash;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
VALUE rbs_location_range_to_ruby_location(rbs_translation_context_t ctx, rbs_location_range range) {
|
|
57
|
+
if (RBS_LOCATION_NULL_RANGE_P(range)) {
|
|
58
|
+
return Qnil;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return rbs_new_location2(ctx.buffer, range.start_char, range.end_char);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
VALUE rbs_location_range_list_to_ruby_array(rbs_translation_context_t ctx, rbs_location_range_list_t *list) {
|
|
65
|
+
if (list == NULL) {
|
|
66
|
+
return EMPTY_ARRAY;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
VALUE ruby_array = rb_ary_new();
|
|
70
|
+
|
|
71
|
+
for (rbs_location_range_list_node_t *n = list->head; n != NULL; n = n->next) {
|
|
72
|
+
rb_ary_push(ruby_array, rbs_location_range_to_ruby_location(ctx, n->range));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return ruby_array;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
VALUE rbs_attr_ivar_name_to_ruby(rbs_translation_context_t ctx, rbs_attr_ivar_name_t ivar_name) {
|
|
79
|
+
switch (ivar_name.tag) {
|
|
80
|
+
case RBS_ATTR_IVAR_NAME_TAG_NAME: {
|
|
81
|
+
rbs_constant_t *constant = rbs_constant_pool_id_to_constant(ctx.constant_pool, ivar_name.name);
|
|
82
|
+
assert(constant != NULL && "constant is NULL");
|
|
83
|
+
assert(constant->start != NULL && "constant->start is NULL");
|
|
84
|
+
|
|
85
|
+
return ID2SYM(rb_intern3((const char *) constant->start, constant->length, ctx.encoding));
|
|
86
|
+
}
|
|
87
|
+
case RBS_ATTR_IVAR_NAME_TAG_UNSPECIFIED:
|
|
88
|
+
return Qnil;
|
|
89
|
+
case RBS_ATTR_IVAR_NAME_TAG_EMPTY:
|
|
90
|
+
return Qfalse;
|
|
91
|
+
default:
|
|
92
|
+
rb_fatal("unknown enum rbs_attr_ivar_name_tag ivar_name.tag: %d", ivar_name.tag);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
VALUE rbs_attribute_visibility_to_ruby(enum rbs_attribute_visibility value) {
|
|
97
|
+
switch (value) {
|
|
98
|
+
case RBS_ATTRIBUTE_VISIBILITY_UNSPECIFIED:
|
|
99
|
+
return Qnil;
|
|
100
|
+
case RBS_ATTRIBUTE_VISIBILITY_PUBLIC:
|
|
101
|
+
return rb_id2sym(rb_intern("public"));
|
|
102
|
+
case RBS_ATTRIBUTE_VISIBILITY_PRIVATE:
|
|
103
|
+
return rb_id2sym(rb_intern("private"));
|
|
104
|
+
default:
|
|
105
|
+
rb_fatal("unknown enum rbs_attribute_visibility value: %d", value);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
VALUE rbs_attribute_kind_to_ruby(enum rbs_attribute_kind value) {
|
|
110
|
+
switch (value) {
|
|
111
|
+
case RBS_ATTRIBUTE_KIND_INSTANCE:
|
|
112
|
+
return rb_id2sym(rb_intern("instance"));
|
|
113
|
+
case RBS_ATTRIBUTE_KIND_SINGLETON:
|
|
114
|
+
return rb_id2sym(rb_intern("singleton"));
|
|
115
|
+
default:
|
|
116
|
+
rb_fatal("unknown enum rbs_attribute_kind value: %d", value);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
VALUE rbs_alias_kind_to_ruby(enum rbs_alias_kind value) {
|
|
121
|
+
switch (value) {
|
|
122
|
+
case RBS_ALIAS_KIND_INSTANCE:
|
|
123
|
+
return rb_id2sym(rb_intern("instance"));
|
|
124
|
+
case RBS_ALIAS_KIND_SINGLETON:
|
|
125
|
+
return rb_id2sym(rb_intern("singleton"));
|
|
126
|
+
default:
|
|
127
|
+
rb_fatal("unknown enum rbs_alias_kind value: %d", value);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
VALUE rbs_method_definition_kind_to_ruby(enum rbs_method_definition_kind value) {
|
|
132
|
+
switch (value) {
|
|
133
|
+
case RBS_METHOD_DEFINITION_KIND_INSTANCE:
|
|
134
|
+
return rb_id2sym(rb_intern("instance"));
|
|
135
|
+
case RBS_METHOD_DEFINITION_KIND_SINGLETON:
|
|
136
|
+
return rb_id2sym(rb_intern("singleton"));
|
|
137
|
+
case RBS_METHOD_DEFINITION_KIND_SINGLETON_INSTANCE:
|
|
138
|
+
return rb_id2sym(rb_intern("singleton_instance"));
|
|
139
|
+
default:
|
|
140
|
+
rb_fatal("unknown enum rbs_method_definition_kind value: %d", value);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
VALUE rbs_method_definition_visibility_to_ruby(enum rbs_method_definition_visibility value) {
|
|
145
|
+
switch (value) {
|
|
146
|
+
case RBS_METHOD_DEFINITION_VISIBILITY_UNSPECIFIED:
|
|
147
|
+
return Qnil;
|
|
148
|
+
case RBS_METHOD_DEFINITION_VISIBILITY_PUBLIC:
|
|
149
|
+
return rb_id2sym(rb_intern("public"));
|
|
150
|
+
case RBS_METHOD_DEFINITION_VISIBILITY_PRIVATE:
|
|
151
|
+
return rb_id2sym(rb_intern("private"));
|
|
152
|
+
default:
|
|
153
|
+
rb_fatal("unknown enum rbs_method_definition_visibility value: %d", value);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
VALUE rbs_type_param_variance_to_ruby(enum rbs_type_param_variance value) {
|
|
158
|
+
switch (value) {
|
|
159
|
+
case RBS_TYPE_PARAM_VARIANCE_INVARIANT:
|
|
160
|
+
return rb_id2sym(rb_intern("invariant"));
|
|
161
|
+
case RBS_TYPE_PARAM_VARIANCE_COVARIANT:
|
|
162
|
+
return rb_id2sym(rb_intern("covariant"));
|
|
163
|
+
case RBS_TYPE_PARAM_VARIANCE_CONTRAVARIANT:
|
|
164
|
+
return rb_id2sym(rb_intern("contravariant"));
|
|
165
|
+
default:
|
|
166
|
+
rb_fatal("unknown enum rbs_type_param_variance value: %d", value);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
#ifdef RB_PASS_KEYWORDS
|
|
171
|
+
// Ruby 2.7 or later
|
|
172
|
+
#define CLASS_NEW_INSTANCE(klass, argc, argv) \
|
|
173
|
+
rb_class_new_instance_kw(argc, argv, klass, RB_PASS_KEYWORDS)
|
|
174
|
+
#else
|
|
175
|
+
// Ruby 2.6
|
|
176
|
+
#define CLASS_NEW_INSTANCE(receiver, argc, argv) \
|
|
177
|
+
rb_class_new_instance(argc, argv, receiver)
|
|
178
|
+
#endif
|
|
179
|
+
|
|
180
|
+
// Route Namespace / TypeName construction through the Ruby-side
|
|
181
|
+
// flyweight cache (`RBS::Namespace.[]` / `RBS::TypeName.[]`) so that
|
|
182
|
+
// structurally equal values produced by the parser share canonical
|
|
183
|
+
// instances. An in-C trie walk was tried but did not beat
|
|
184
|
+
// `rb_funcallv` on Ruby 4.0+, where method dispatch is well optimized.
|
|
185
|
+
static ID id_intern_brackets;
|
|
186
|
+
|
|
187
|
+
static inline ID intern_brackets(void) {
|
|
188
|
+
if (!id_intern_brackets) id_intern_brackets = rb_intern("[]");
|
|
189
|
+
return id_intern_brackets;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
static VALUE rbs_intern_namespace(rbs_translation_context_t ctx, rbs_namespace_t *node) {
|
|
193
|
+
VALUE args[2];
|
|
194
|
+
args[0] = rbs_node_list_to_ruby_array(ctx, node->path);
|
|
195
|
+
args[1] = node->absolute ? Qtrue : Qfalse;
|
|
196
|
+
return rb_funcallv(RBS_Namespace, intern_brackets(), 2, args);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
static VALUE rbs_intern_type_name(VALUE namespace, VALUE name) {
|
|
200
|
+
VALUE args[2] = { namespace, name };
|
|
201
|
+
return rb_funcallv(RBS_TypeName, intern_brackets(), 2, args);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instance) {
|
|
205
|
+
if (instance == NULL) return Qnil;
|
|
206
|
+
|
|
207
|
+
switch (instance->type) {
|
|
208
|
+
case RBS_AST_ANNOTATION: {
|
|
209
|
+
rbs_ast_annotation_t *node = (rbs_ast_annotation_t *) instance;
|
|
210
|
+
|
|
211
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
212
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
213
|
+
VALUE arg_string = rbs_string_to_ruby_string(&node->string, ctx.encoding);
|
|
214
|
+
|
|
215
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
216
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
217
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
218
|
+
rb_hash_clear(h);
|
|
219
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
220
|
+
rb_hash_aset(h, ID2SYM(rb_intern("string")), arg_string);
|
|
221
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Annotation, 1, &h);
|
|
222
|
+
}
|
|
223
|
+
case RBS_AST_BOOL: {
|
|
224
|
+
return ((rbs_ast_bool_t *) instance)->value ? Qtrue : Qfalse;
|
|
225
|
+
}
|
|
226
|
+
case RBS_AST_COMMENT: {
|
|
227
|
+
rbs_ast_comment_t *node = (rbs_ast_comment_t *) instance;
|
|
228
|
+
|
|
229
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
230
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
231
|
+
VALUE arg_string = rbs_string_to_ruby_string(&node->string, ctx.encoding);
|
|
232
|
+
|
|
233
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
234
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
235
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
236
|
+
rb_hash_clear(h);
|
|
237
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
238
|
+
rb_hash_aset(h, ID2SYM(rb_intern("string")), arg_string);
|
|
239
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Comment, 1, &h);
|
|
240
|
+
}
|
|
241
|
+
case RBS_AST_DECLARATIONS_CLASS: {
|
|
242
|
+
rbs_ast_declarations_class_t *node = (rbs_ast_declarations_class_t *) instance;
|
|
243
|
+
|
|
244
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
245
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
246
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
247
|
+
{
|
|
248
|
+
rbs_loc_legacy_alloc_children(loc, 5);
|
|
249
|
+
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 });
|
|
250
|
+
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 });
|
|
251
|
+
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 });
|
|
252
|
+
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 });
|
|
253
|
+
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 });
|
|
254
|
+
}
|
|
255
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_type_name
|
|
256
|
+
VALUE arg_type_params = rbs_node_list_to_ruby_array(ctx, node->type_params);
|
|
257
|
+
VALUE arg_super_class = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->super_class); // rbs_ast_declarations_class_super
|
|
258
|
+
VALUE arg_members = rbs_node_list_to_ruby_array(ctx, node->members);
|
|
259
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
260
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
261
|
+
|
|
262
|
+
rb_funcall(
|
|
263
|
+
RBS_AST_TypeParam,
|
|
264
|
+
rb_intern("resolve_variables"),
|
|
265
|
+
1,
|
|
266
|
+
arg_type_params
|
|
267
|
+
);
|
|
268
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
269
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
270
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
271
|
+
rb_hash_clear(h);
|
|
272
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
273
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
274
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_params")), arg_type_params);
|
|
275
|
+
rb_hash_aset(h, ID2SYM(rb_intern("super_class")), arg_super_class);
|
|
276
|
+
rb_hash_aset(h, ID2SYM(rb_intern("members")), arg_members);
|
|
277
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
278
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
279
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Declarations_Class, 1, &h);
|
|
280
|
+
}
|
|
281
|
+
case RBS_AST_DECLARATIONS_CLASS_SUPER: {
|
|
282
|
+
rbs_ast_declarations_class_super_t *node = (rbs_ast_declarations_class_super_t *) instance;
|
|
283
|
+
|
|
284
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
285
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
286
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
287
|
+
{
|
|
288
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
289
|
+
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 });
|
|
290
|
+
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 });
|
|
291
|
+
}
|
|
292
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_type_name
|
|
293
|
+
VALUE arg_args = rbs_node_list_to_ruby_array(ctx, node->args);
|
|
294
|
+
|
|
295
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
296
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
297
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
298
|
+
rb_hash_clear(h);
|
|
299
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
300
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
301
|
+
rb_hash_aset(h, ID2SYM(rb_intern("args")), arg_args);
|
|
302
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Declarations_Class_Super, 1, &h);
|
|
303
|
+
}
|
|
304
|
+
case RBS_AST_DECLARATIONS_CLASS_ALIAS: {
|
|
305
|
+
rbs_ast_declarations_class_alias_t *node = (rbs_ast_declarations_class_alias_t *) instance;
|
|
306
|
+
|
|
307
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
308
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
309
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
310
|
+
{
|
|
311
|
+
rbs_loc_legacy_alloc_children(loc, 4);
|
|
312
|
+
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 });
|
|
313
|
+
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 });
|
|
314
|
+
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 });
|
|
315
|
+
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 });
|
|
316
|
+
}
|
|
317
|
+
VALUE arg_new_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->new_name); // rbs_type_name
|
|
318
|
+
VALUE arg_old_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->old_name); // rbs_type_name
|
|
319
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
320
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
321
|
+
|
|
322
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
323
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
324
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
325
|
+
rb_hash_clear(h);
|
|
326
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
327
|
+
rb_hash_aset(h, ID2SYM(rb_intern("new_name")), arg_new_name);
|
|
328
|
+
rb_hash_aset(h, ID2SYM(rb_intern("old_name")), arg_old_name);
|
|
329
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
330
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
331
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Declarations_ClassAlias, 1, &h);
|
|
332
|
+
}
|
|
333
|
+
case RBS_AST_DECLARATIONS_CONSTANT: {
|
|
334
|
+
rbs_ast_declarations_constant_t *node = (rbs_ast_declarations_constant_t *) instance;
|
|
335
|
+
|
|
336
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
337
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
338
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
339
|
+
{
|
|
340
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
341
|
+
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 });
|
|
342
|
+
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 });
|
|
343
|
+
}
|
|
344
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_type_name
|
|
345
|
+
VALUE arg_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type); // rbs_node
|
|
346
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
347
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
348
|
+
|
|
349
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
350
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
351
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
352
|
+
rb_hash_clear(h);
|
|
353
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
354
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
355
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), arg_type);
|
|
356
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
357
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
358
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Declarations_Constant, 1, &h);
|
|
359
|
+
}
|
|
360
|
+
case RBS_AST_DECLARATIONS_GLOBAL: {
|
|
361
|
+
rbs_ast_declarations_global_t *node = (rbs_ast_declarations_global_t *) instance;
|
|
362
|
+
|
|
363
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
364
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
365
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
366
|
+
{
|
|
367
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
368
|
+
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 });
|
|
369
|
+
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 });
|
|
370
|
+
}
|
|
371
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_ast_symbol
|
|
372
|
+
VALUE arg_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type); // rbs_node
|
|
373
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
374
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
375
|
+
|
|
376
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
377
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
378
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
379
|
+
rb_hash_clear(h);
|
|
380
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
381
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
382
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), arg_type);
|
|
383
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
384
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
385
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Declarations_Global, 1, &h);
|
|
386
|
+
}
|
|
387
|
+
case RBS_AST_DECLARATIONS_INTERFACE: {
|
|
388
|
+
rbs_ast_declarations_interface_t *node = (rbs_ast_declarations_interface_t *) instance;
|
|
389
|
+
|
|
390
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
391
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
392
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
393
|
+
{
|
|
394
|
+
rbs_loc_legacy_alloc_children(loc, 4);
|
|
395
|
+
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 });
|
|
396
|
+
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 });
|
|
397
|
+
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 });
|
|
398
|
+
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 });
|
|
399
|
+
}
|
|
400
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_type_name
|
|
401
|
+
VALUE arg_type_params = rbs_node_list_to_ruby_array(ctx, node->type_params);
|
|
402
|
+
VALUE arg_members = rbs_node_list_to_ruby_array(ctx, node->members);
|
|
403
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
404
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
405
|
+
|
|
406
|
+
rb_funcall(
|
|
407
|
+
RBS_AST_TypeParam,
|
|
408
|
+
rb_intern("resolve_variables"),
|
|
409
|
+
1,
|
|
410
|
+
arg_type_params
|
|
411
|
+
);
|
|
412
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
413
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
414
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
415
|
+
rb_hash_clear(h);
|
|
416
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
417
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
418
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_params")), arg_type_params);
|
|
419
|
+
rb_hash_aset(h, ID2SYM(rb_intern("members")), arg_members);
|
|
420
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
421
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
422
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Declarations_Interface, 1, &h);
|
|
423
|
+
}
|
|
424
|
+
case RBS_AST_DECLARATIONS_MODULE: {
|
|
425
|
+
rbs_ast_declarations_module_t *node = (rbs_ast_declarations_module_t *) instance;
|
|
426
|
+
|
|
427
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
428
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
429
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
430
|
+
{
|
|
431
|
+
rbs_loc_legacy_alloc_children(loc, 6);
|
|
432
|
+
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 });
|
|
433
|
+
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 });
|
|
434
|
+
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 });
|
|
435
|
+
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 });
|
|
436
|
+
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 });
|
|
437
|
+
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 });
|
|
438
|
+
}
|
|
439
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_type_name
|
|
440
|
+
VALUE arg_type_params = rbs_node_list_to_ruby_array(ctx, node->type_params);
|
|
441
|
+
VALUE arg_self_types = rbs_node_list_to_ruby_array(ctx, node->self_types);
|
|
442
|
+
VALUE arg_members = rbs_node_list_to_ruby_array(ctx, node->members);
|
|
443
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
444
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
445
|
+
|
|
446
|
+
rb_funcall(
|
|
447
|
+
RBS_AST_TypeParam,
|
|
448
|
+
rb_intern("resolve_variables"),
|
|
449
|
+
1,
|
|
450
|
+
arg_type_params
|
|
451
|
+
);
|
|
452
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
453
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
454
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
455
|
+
rb_hash_clear(h);
|
|
456
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
457
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
458
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_params")), arg_type_params);
|
|
459
|
+
rb_hash_aset(h, ID2SYM(rb_intern("self_types")), arg_self_types);
|
|
460
|
+
rb_hash_aset(h, ID2SYM(rb_intern("members")), arg_members);
|
|
461
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
462
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
463
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Declarations_Module, 1, &h);
|
|
464
|
+
}
|
|
465
|
+
case RBS_AST_DECLARATIONS_MODULE_SELF: {
|
|
466
|
+
rbs_ast_declarations_module_self_t *node = (rbs_ast_declarations_module_self_t *) instance;
|
|
467
|
+
|
|
468
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
469
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
470
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
471
|
+
{
|
|
472
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
473
|
+
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 });
|
|
474
|
+
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 });
|
|
475
|
+
}
|
|
476
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_type_name
|
|
477
|
+
VALUE arg_args = rbs_node_list_to_ruby_array(ctx, node->args);
|
|
478
|
+
|
|
479
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
480
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
481
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
482
|
+
rb_hash_clear(h);
|
|
483
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
484
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
485
|
+
rb_hash_aset(h, ID2SYM(rb_intern("args")), arg_args);
|
|
486
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Declarations_Module_Self, 1, &h);
|
|
487
|
+
}
|
|
488
|
+
case RBS_AST_DECLARATIONS_MODULE_ALIAS: {
|
|
489
|
+
rbs_ast_declarations_module_alias_t *node = (rbs_ast_declarations_module_alias_t *) instance;
|
|
490
|
+
|
|
491
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
492
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
493
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
494
|
+
{
|
|
495
|
+
rbs_loc_legacy_alloc_children(loc, 4);
|
|
496
|
+
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 });
|
|
497
|
+
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 });
|
|
498
|
+
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 });
|
|
499
|
+
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 });
|
|
500
|
+
}
|
|
501
|
+
VALUE arg_new_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->new_name); // rbs_type_name
|
|
502
|
+
VALUE arg_old_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->old_name); // rbs_type_name
|
|
503
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
504
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
505
|
+
|
|
506
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
507
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
508
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
509
|
+
rb_hash_clear(h);
|
|
510
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
511
|
+
rb_hash_aset(h, ID2SYM(rb_intern("new_name")), arg_new_name);
|
|
512
|
+
rb_hash_aset(h, ID2SYM(rb_intern("old_name")), arg_old_name);
|
|
513
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
514
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
515
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Declarations_ModuleAlias, 1, &h);
|
|
516
|
+
}
|
|
517
|
+
case RBS_AST_DECLARATIONS_TYPE_ALIAS: {
|
|
518
|
+
rbs_ast_declarations_type_alias_t *node = (rbs_ast_declarations_type_alias_t *) instance;
|
|
519
|
+
|
|
520
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
521
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
522
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
523
|
+
{
|
|
524
|
+
rbs_loc_legacy_alloc_children(loc, 4);
|
|
525
|
+
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 });
|
|
526
|
+
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 });
|
|
527
|
+
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 });
|
|
528
|
+
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 });
|
|
529
|
+
}
|
|
530
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_type_name
|
|
531
|
+
VALUE arg_type_params = rbs_node_list_to_ruby_array(ctx, node->type_params);
|
|
532
|
+
VALUE arg_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type); // rbs_node
|
|
533
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
534
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
535
|
+
|
|
536
|
+
rb_funcall(
|
|
537
|
+
RBS_AST_TypeParam,
|
|
538
|
+
rb_intern("resolve_variables"),
|
|
539
|
+
1,
|
|
540
|
+
arg_type_params
|
|
541
|
+
);
|
|
542
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
543
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
544
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
545
|
+
rb_hash_clear(h);
|
|
546
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
547
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
548
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_params")), arg_type_params);
|
|
549
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), arg_type);
|
|
550
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
551
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
552
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Declarations_TypeAlias, 1, &h);
|
|
553
|
+
}
|
|
554
|
+
case RBS_AST_DIRECTIVES_USE: {
|
|
555
|
+
rbs_ast_directives_use_t *node = (rbs_ast_directives_use_t *) instance;
|
|
556
|
+
|
|
557
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
558
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
559
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
560
|
+
{
|
|
561
|
+
rbs_loc_legacy_alloc_children(loc, 1);
|
|
562
|
+
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 });
|
|
563
|
+
}
|
|
564
|
+
VALUE arg_clauses = rbs_node_list_to_ruby_array(ctx, node->clauses);
|
|
565
|
+
|
|
566
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
567
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
568
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
569
|
+
rb_hash_clear(h);
|
|
570
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
571
|
+
rb_hash_aset(h, ID2SYM(rb_intern("clauses")), arg_clauses);
|
|
572
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Directives_Use, 1, &h);
|
|
573
|
+
}
|
|
574
|
+
case RBS_AST_DIRECTIVES_USE_SINGLE_CLAUSE: {
|
|
575
|
+
rbs_ast_directives_use_single_clause_t *node = (rbs_ast_directives_use_single_clause_t *) instance;
|
|
576
|
+
|
|
577
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
578
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
579
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
580
|
+
{
|
|
581
|
+
rbs_loc_legacy_alloc_children(loc, 3);
|
|
582
|
+
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 });
|
|
583
|
+
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 });
|
|
584
|
+
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 });
|
|
585
|
+
}
|
|
586
|
+
VALUE arg_type_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type_name); // rbs_type_name
|
|
587
|
+
VALUE arg_new_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->new_name); // rbs_ast_symbol
|
|
588
|
+
|
|
589
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
590
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
591
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
592
|
+
rb_hash_clear(h);
|
|
593
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
594
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_name")), arg_type_name);
|
|
595
|
+
rb_hash_aset(h, ID2SYM(rb_intern("new_name")), arg_new_name);
|
|
596
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Directives_Use_SingleClause, 1, &h);
|
|
597
|
+
}
|
|
598
|
+
case RBS_AST_DIRECTIVES_USE_WILDCARD_CLAUSE: {
|
|
599
|
+
rbs_ast_directives_use_wildcard_clause_t *node = (rbs_ast_directives_use_wildcard_clause_t *) instance;
|
|
600
|
+
|
|
601
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
602
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
603
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
604
|
+
{
|
|
605
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
606
|
+
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 });
|
|
607
|
+
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 });
|
|
608
|
+
}
|
|
609
|
+
VALUE arg_namespace = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->rbs_namespace); // rbs_namespace
|
|
610
|
+
|
|
611
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
612
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
613
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
614
|
+
rb_hash_clear(h);
|
|
615
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
616
|
+
rb_hash_aset(h, ID2SYM(rb_intern("namespace")), arg_namespace);
|
|
617
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Directives_Use_WildcardClause, 1, &h);
|
|
618
|
+
}
|
|
619
|
+
case RBS_AST_INTEGER: {
|
|
620
|
+
rbs_ast_integer_t *integer_node = (rbs_ast_integer_t *) instance;
|
|
621
|
+
rbs_string_t string_repr = integer_node->string_representation;
|
|
622
|
+
|
|
623
|
+
VALUE str = rb_enc_str_new(string_repr.start, rbs_string_len(string_repr), rb_utf8_encoding());
|
|
624
|
+
|
|
625
|
+
return rb_funcall(str, rb_intern("to_i"), 0);
|
|
626
|
+
}
|
|
627
|
+
case RBS_AST_MEMBERS_ALIAS: {
|
|
628
|
+
rbs_ast_members_alias_t *node = (rbs_ast_members_alias_t *) instance;
|
|
629
|
+
|
|
630
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
631
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
632
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
633
|
+
{
|
|
634
|
+
rbs_loc_legacy_alloc_children(loc, 5);
|
|
635
|
+
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 });
|
|
636
|
+
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 });
|
|
637
|
+
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 });
|
|
638
|
+
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 });
|
|
639
|
+
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 });
|
|
640
|
+
}
|
|
641
|
+
VALUE arg_new_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->new_name); // rbs_ast_symbol
|
|
642
|
+
VALUE arg_old_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->old_name); // rbs_ast_symbol
|
|
643
|
+
VALUE arg_kind = rbs_alias_kind_to_ruby(node->kind); // alias_kind
|
|
644
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
645
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
646
|
+
|
|
647
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
648
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
649
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
650
|
+
rb_hash_clear(h);
|
|
651
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
652
|
+
rb_hash_aset(h, ID2SYM(rb_intern("new_name")), arg_new_name);
|
|
653
|
+
rb_hash_aset(h, ID2SYM(rb_intern("old_name")), arg_old_name);
|
|
654
|
+
rb_hash_aset(h, ID2SYM(rb_intern("kind")), arg_kind);
|
|
655
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
656
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
657
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Members_Alias, 1, &h);
|
|
658
|
+
}
|
|
659
|
+
case RBS_AST_MEMBERS_ATTR_ACCESSOR: {
|
|
660
|
+
rbs_ast_members_attr_accessor_t *node = (rbs_ast_members_attr_accessor_t *) instance;
|
|
661
|
+
|
|
662
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
663
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
664
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
665
|
+
{
|
|
666
|
+
rbs_loc_legacy_alloc_children(loc, 7);
|
|
667
|
+
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 });
|
|
668
|
+
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 });
|
|
669
|
+
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 });
|
|
670
|
+
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 });
|
|
671
|
+
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 });
|
|
672
|
+
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 });
|
|
673
|
+
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 });
|
|
674
|
+
}
|
|
675
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_ast_symbol
|
|
676
|
+
VALUE arg_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type); // rbs_node
|
|
677
|
+
VALUE arg_ivar_name = rbs_attr_ivar_name_to_ruby(ctx, node->ivar_name); // rbs_attr_ivar_name_t
|
|
678
|
+
VALUE arg_kind = rbs_attribute_kind_to_ruby(node->kind); // attribute_kind
|
|
679
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
680
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
681
|
+
VALUE arg_visibility = rbs_attribute_visibility_to_ruby(node->visibility); // attribute_visibility
|
|
682
|
+
|
|
683
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
684
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
685
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
686
|
+
rb_hash_clear(h);
|
|
687
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
688
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
689
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), arg_type);
|
|
690
|
+
rb_hash_aset(h, ID2SYM(rb_intern("ivar_name")), arg_ivar_name);
|
|
691
|
+
rb_hash_aset(h, ID2SYM(rb_intern("kind")), arg_kind);
|
|
692
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
693
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
694
|
+
rb_hash_aset(h, ID2SYM(rb_intern("visibility")), arg_visibility);
|
|
695
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Members_AttrAccessor, 1, &h);
|
|
696
|
+
}
|
|
697
|
+
case RBS_AST_MEMBERS_ATTR_READER: {
|
|
698
|
+
rbs_ast_members_attr_reader_t *node = (rbs_ast_members_attr_reader_t *) instance;
|
|
699
|
+
|
|
700
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
701
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
702
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
703
|
+
{
|
|
704
|
+
rbs_loc_legacy_alloc_children(loc, 7);
|
|
705
|
+
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 });
|
|
706
|
+
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 });
|
|
707
|
+
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 });
|
|
708
|
+
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 });
|
|
709
|
+
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 });
|
|
710
|
+
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 });
|
|
711
|
+
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 });
|
|
712
|
+
}
|
|
713
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_ast_symbol
|
|
714
|
+
VALUE arg_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type); // rbs_node
|
|
715
|
+
VALUE arg_ivar_name = rbs_attr_ivar_name_to_ruby(ctx, node->ivar_name); // rbs_attr_ivar_name_t
|
|
716
|
+
VALUE arg_kind = rbs_attribute_kind_to_ruby(node->kind); // attribute_kind
|
|
717
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
718
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
719
|
+
VALUE arg_visibility = rbs_attribute_visibility_to_ruby(node->visibility); // attribute_visibility
|
|
720
|
+
|
|
721
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
722
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
723
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
724
|
+
rb_hash_clear(h);
|
|
725
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
726
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
727
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), arg_type);
|
|
728
|
+
rb_hash_aset(h, ID2SYM(rb_intern("ivar_name")), arg_ivar_name);
|
|
729
|
+
rb_hash_aset(h, ID2SYM(rb_intern("kind")), arg_kind);
|
|
730
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
731
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
732
|
+
rb_hash_aset(h, ID2SYM(rb_intern("visibility")), arg_visibility);
|
|
733
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Members_AttrReader, 1, &h);
|
|
734
|
+
}
|
|
735
|
+
case RBS_AST_MEMBERS_ATTR_WRITER: {
|
|
736
|
+
rbs_ast_members_attr_writer_t *node = (rbs_ast_members_attr_writer_t *) instance;
|
|
737
|
+
|
|
738
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
739
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
740
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
741
|
+
{
|
|
742
|
+
rbs_loc_legacy_alloc_children(loc, 7);
|
|
743
|
+
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 });
|
|
744
|
+
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 });
|
|
745
|
+
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 });
|
|
746
|
+
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 });
|
|
747
|
+
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 });
|
|
748
|
+
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 });
|
|
749
|
+
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 });
|
|
750
|
+
}
|
|
751
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_ast_symbol
|
|
752
|
+
VALUE arg_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type); // rbs_node
|
|
753
|
+
VALUE arg_ivar_name = rbs_attr_ivar_name_to_ruby(ctx, node->ivar_name); // rbs_attr_ivar_name_t
|
|
754
|
+
VALUE arg_kind = rbs_attribute_kind_to_ruby(node->kind); // attribute_kind
|
|
755
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
756
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
757
|
+
VALUE arg_visibility = rbs_attribute_visibility_to_ruby(node->visibility); // attribute_visibility
|
|
758
|
+
|
|
759
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
760
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
761
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
762
|
+
rb_hash_clear(h);
|
|
763
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
764
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
765
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), arg_type);
|
|
766
|
+
rb_hash_aset(h, ID2SYM(rb_intern("ivar_name")), arg_ivar_name);
|
|
767
|
+
rb_hash_aset(h, ID2SYM(rb_intern("kind")), arg_kind);
|
|
768
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
769
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
770
|
+
rb_hash_aset(h, ID2SYM(rb_intern("visibility")), arg_visibility);
|
|
771
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Members_AttrWriter, 1, &h);
|
|
772
|
+
}
|
|
773
|
+
case RBS_AST_MEMBERS_CLASS_INSTANCE_VARIABLE: {
|
|
774
|
+
rbs_ast_members_class_instance_variable_t *node = (rbs_ast_members_class_instance_variable_t *) instance;
|
|
775
|
+
|
|
776
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
777
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
778
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
779
|
+
{
|
|
780
|
+
rbs_loc_legacy_alloc_children(loc, 3);
|
|
781
|
+
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 });
|
|
782
|
+
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 });
|
|
783
|
+
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 });
|
|
784
|
+
}
|
|
785
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_ast_symbol
|
|
786
|
+
VALUE arg_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type); // rbs_node
|
|
787
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
788
|
+
|
|
789
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
790
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
791
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
792
|
+
rb_hash_clear(h);
|
|
793
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
794
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
795
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), arg_type);
|
|
796
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
797
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Members_ClassInstanceVariable, 1, &h);
|
|
798
|
+
}
|
|
799
|
+
case RBS_AST_MEMBERS_CLASS_VARIABLE: {
|
|
800
|
+
rbs_ast_members_class_variable_t *node = (rbs_ast_members_class_variable_t *) instance;
|
|
801
|
+
|
|
802
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
803
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
804
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
805
|
+
{
|
|
806
|
+
rbs_loc_legacy_alloc_children(loc, 3);
|
|
807
|
+
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 });
|
|
808
|
+
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 });
|
|
809
|
+
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 });
|
|
810
|
+
}
|
|
811
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_ast_symbol
|
|
812
|
+
VALUE arg_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type); // rbs_node
|
|
813
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
814
|
+
|
|
815
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
816
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
817
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
818
|
+
rb_hash_clear(h);
|
|
819
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
820
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
821
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), arg_type);
|
|
822
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
823
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Members_ClassVariable, 1, &h);
|
|
824
|
+
}
|
|
825
|
+
case RBS_AST_MEMBERS_EXTEND: {
|
|
826
|
+
rbs_ast_members_extend_t *node = (rbs_ast_members_extend_t *) instance;
|
|
827
|
+
|
|
828
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
829
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
830
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
831
|
+
{
|
|
832
|
+
rbs_loc_legacy_alloc_children(loc, 3);
|
|
833
|
+
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 });
|
|
834
|
+
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 });
|
|
835
|
+
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 });
|
|
836
|
+
}
|
|
837
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_type_name
|
|
838
|
+
VALUE arg_args = rbs_node_list_to_ruby_array(ctx, node->args);
|
|
839
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
840
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
841
|
+
|
|
842
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
843
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
844
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
845
|
+
rb_hash_clear(h);
|
|
846
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
847
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
848
|
+
rb_hash_aset(h, ID2SYM(rb_intern("args")), arg_args);
|
|
849
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
850
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
851
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Members_Extend, 1, &h);
|
|
852
|
+
}
|
|
853
|
+
case RBS_AST_MEMBERS_INCLUDE: {
|
|
854
|
+
rbs_ast_members_include_t *node = (rbs_ast_members_include_t *) instance;
|
|
855
|
+
|
|
856
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
857
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
858
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
859
|
+
{
|
|
860
|
+
rbs_loc_legacy_alloc_children(loc, 3);
|
|
861
|
+
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 });
|
|
862
|
+
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 });
|
|
863
|
+
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 });
|
|
864
|
+
}
|
|
865
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_type_name
|
|
866
|
+
VALUE arg_args = rbs_node_list_to_ruby_array(ctx, node->args);
|
|
867
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
868
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
869
|
+
|
|
870
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
871
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
872
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
873
|
+
rb_hash_clear(h);
|
|
874
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
875
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
876
|
+
rb_hash_aset(h, ID2SYM(rb_intern("args")), arg_args);
|
|
877
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
878
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
879
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Members_Include, 1, &h);
|
|
880
|
+
}
|
|
881
|
+
case RBS_AST_MEMBERS_INSTANCE_VARIABLE: {
|
|
882
|
+
rbs_ast_members_instance_variable_t *node = (rbs_ast_members_instance_variable_t *) instance;
|
|
883
|
+
|
|
884
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
885
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
886
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
887
|
+
{
|
|
888
|
+
rbs_loc_legacy_alloc_children(loc, 3);
|
|
889
|
+
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 });
|
|
890
|
+
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 });
|
|
891
|
+
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 });
|
|
892
|
+
}
|
|
893
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_ast_symbol
|
|
894
|
+
VALUE arg_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type); // rbs_node
|
|
895
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
896
|
+
|
|
897
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
898
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
899
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
900
|
+
rb_hash_clear(h);
|
|
901
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
902
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
903
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), arg_type);
|
|
904
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
905
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Members_InstanceVariable, 1, &h);
|
|
906
|
+
}
|
|
907
|
+
case RBS_AST_MEMBERS_METHOD_DEFINITION: {
|
|
908
|
+
rbs_ast_members_method_definition_t *node = (rbs_ast_members_method_definition_t *) instance;
|
|
909
|
+
|
|
910
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
911
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
912
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
913
|
+
{
|
|
914
|
+
rbs_loc_legacy_alloc_children(loc, 5);
|
|
915
|
+
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 });
|
|
916
|
+
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 });
|
|
917
|
+
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 });
|
|
918
|
+
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 });
|
|
919
|
+
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 });
|
|
920
|
+
}
|
|
921
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_ast_symbol
|
|
922
|
+
VALUE arg_kind = rbs_method_definition_kind_to_ruby(node->kind); // method_definition_kind
|
|
923
|
+
VALUE arg_overloads = rbs_node_list_to_ruby_array(ctx, node->overloads);
|
|
924
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
925
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
926
|
+
VALUE arg_overloading = node->overloading ? Qtrue : Qfalse;
|
|
927
|
+
VALUE arg_visibility = rbs_method_definition_visibility_to_ruby(node->visibility); // method_definition_visibility
|
|
928
|
+
|
|
929
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
930
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
931
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
932
|
+
rb_hash_clear(h);
|
|
933
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
934
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
935
|
+
rb_hash_aset(h, ID2SYM(rb_intern("kind")), arg_kind);
|
|
936
|
+
rb_hash_aset(h, ID2SYM(rb_intern("overloads")), arg_overloads);
|
|
937
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
938
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
939
|
+
rb_hash_aset(h, ID2SYM(rb_intern("overloading")), arg_overloading);
|
|
940
|
+
rb_hash_aset(h, ID2SYM(rb_intern("visibility")), arg_visibility);
|
|
941
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Members_MethodDefinition, 1, &h);
|
|
942
|
+
}
|
|
943
|
+
case RBS_AST_MEMBERS_METHOD_DEFINITION_OVERLOAD: {
|
|
944
|
+
rbs_ast_members_method_definition_overload_t *node = (rbs_ast_members_method_definition_overload_t *) instance;
|
|
945
|
+
|
|
946
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
947
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
948
|
+
VALUE arg_method_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->method_type); // rbs_node
|
|
949
|
+
|
|
950
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
951
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
952
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
953
|
+
rb_hash_clear(h);
|
|
954
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
955
|
+
rb_hash_aset(h, ID2SYM(rb_intern("method_type")), arg_method_type);
|
|
956
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Members_MethodDefinition_Overload, 1, &h);
|
|
957
|
+
}
|
|
958
|
+
case RBS_AST_MEMBERS_PREPEND: {
|
|
959
|
+
rbs_ast_members_prepend_t *node = (rbs_ast_members_prepend_t *) instance;
|
|
960
|
+
|
|
961
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
962
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
963
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
964
|
+
{
|
|
965
|
+
rbs_loc_legacy_alloc_children(loc, 3);
|
|
966
|
+
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 });
|
|
967
|
+
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 });
|
|
968
|
+
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 });
|
|
969
|
+
}
|
|
970
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_type_name
|
|
971
|
+
VALUE arg_args = rbs_node_list_to_ruby_array(ctx, node->args);
|
|
972
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
973
|
+
VALUE arg_comment = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->comment); // rbs_ast_comment
|
|
974
|
+
|
|
975
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
976
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
977
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
978
|
+
rb_hash_clear(h);
|
|
979
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
980
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
981
|
+
rb_hash_aset(h, ID2SYM(rb_intern("args")), arg_args);
|
|
982
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
983
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment")), arg_comment);
|
|
984
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Members_Prepend, 1, &h);
|
|
985
|
+
}
|
|
986
|
+
case RBS_AST_MEMBERS_PRIVATE: {
|
|
987
|
+
rbs_ast_members_private_t *node = (rbs_ast_members_private_t *) instance;
|
|
988
|
+
|
|
989
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
990
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
991
|
+
|
|
992
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
993
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
994
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
995
|
+
rb_hash_clear(h);
|
|
996
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
997
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Members_Private, 1, &h);
|
|
998
|
+
}
|
|
999
|
+
case RBS_AST_MEMBERS_PUBLIC: {
|
|
1000
|
+
rbs_ast_members_public_t *node = (rbs_ast_members_public_t *) instance;
|
|
1001
|
+
|
|
1002
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1003
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1004
|
+
|
|
1005
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1006
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1007
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1008
|
+
rb_hash_clear(h);
|
|
1009
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1010
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Members_Public, 1, &h);
|
|
1011
|
+
}
|
|
1012
|
+
case RBS_AST_RUBY_ANNOTATIONS_BLOCK_PARAM_TYPE_ANNOTATION: {
|
|
1013
|
+
rbs_ast_ruby_annotations_block_param_type_annotation_t *node = (rbs_ast_ruby_annotations_block_param_type_annotation_t *) instance;
|
|
1014
|
+
|
|
1015
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1016
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1017
|
+
VALUE arg_prefix_location = rbs_location_range_to_ruby_location(ctx, node->prefix_location);
|
|
1018
|
+
VALUE arg_ampersand_location = rbs_location_range_to_ruby_location(ctx, node->ampersand_location);
|
|
1019
|
+
VALUE arg_name_location = rbs_location_range_to_ruby_location(ctx, node->name_location); // optional
|
|
1020
|
+
VALUE arg_colon_location = rbs_location_range_to_ruby_location(ctx, node->colon_location);
|
|
1021
|
+
VALUE arg_question_location = rbs_location_range_to_ruby_location(ctx, node->question_location); // optional
|
|
1022
|
+
VALUE arg_type_location = rbs_location_range_to_ruby_location(ctx, node->type_location);
|
|
1023
|
+
VALUE arg_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type_); // rbs_node
|
|
1024
|
+
VALUE arg_comment_location = rbs_location_range_to_ruby_location(ctx, node->comment_location); // optional
|
|
1025
|
+
|
|
1026
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1027
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1028
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1029
|
+
rb_hash_clear(h);
|
|
1030
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1031
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), arg_prefix_location);
|
|
1032
|
+
rb_hash_aset(h, ID2SYM(rb_intern("ampersand_location")), arg_ampersand_location);
|
|
1033
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name_location")), arg_name_location);
|
|
1034
|
+
rb_hash_aset(h, ID2SYM(rb_intern("colon_location")), arg_colon_location);
|
|
1035
|
+
rb_hash_aset(h, ID2SYM(rb_intern("question_location")), arg_question_location);
|
|
1036
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_location")), arg_type_location);
|
|
1037
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), arg_type);
|
|
1038
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")), arg_comment_location);
|
|
1039
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Ruby_Annotations_BlockParamTypeAnnotation, 1, &h);
|
|
1040
|
+
}
|
|
1041
|
+
case RBS_AST_RUBY_ANNOTATIONS_CLASS_ALIAS_ANNOTATION: {
|
|
1042
|
+
rbs_ast_ruby_annotations_class_alias_annotation_t *node = (rbs_ast_ruby_annotations_class_alias_annotation_t *) instance;
|
|
1043
|
+
|
|
1044
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1045
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1046
|
+
VALUE arg_prefix_location = rbs_location_range_to_ruby_location(ctx, node->prefix_location);
|
|
1047
|
+
VALUE arg_keyword_location = rbs_location_range_to_ruby_location(ctx, node->keyword_location);
|
|
1048
|
+
VALUE arg_type_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type_name); // rbs_type_name
|
|
1049
|
+
VALUE arg_type_name_location = rbs_location_range_to_ruby_location(ctx, node->type_name_location); // optional
|
|
1050
|
+
|
|
1051
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1052
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1053
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1054
|
+
rb_hash_clear(h);
|
|
1055
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1056
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), arg_prefix_location);
|
|
1057
|
+
rb_hash_aset(h, ID2SYM(rb_intern("keyword_location")), arg_keyword_location);
|
|
1058
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_name")), arg_type_name);
|
|
1059
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_name_location")), arg_type_name_location);
|
|
1060
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Ruby_Annotations_ClassAliasAnnotation, 1, &h);
|
|
1061
|
+
}
|
|
1062
|
+
case RBS_AST_RUBY_ANNOTATIONS_COLON_METHOD_TYPE_ANNOTATION: {
|
|
1063
|
+
rbs_ast_ruby_annotations_colon_method_type_annotation_t *node = (rbs_ast_ruby_annotations_colon_method_type_annotation_t *) instance;
|
|
1064
|
+
|
|
1065
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1066
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1067
|
+
VALUE arg_prefix_location = rbs_location_range_to_ruby_location(ctx, node->prefix_location);
|
|
1068
|
+
VALUE arg_annotations = rbs_node_list_to_ruby_array(ctx, node->annotations);
|
|
1069
|
+
VALUE arg_method_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->method_type); // rbs_node
|
|
1070
|
+
|
|
1071
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1072
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1073
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1074
|
+
rb_hash_clear(h);
|
|
1075
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1076
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), arg_prefix_location);
|
|
1077
|
+
rb_hash_aset(h, ID2SYM(rb_intern("annotations")), arg_annotations);
|
|
1078
|
+
rb_hash_aset(h, ID2SYM(rb_intern("method_type")), arg_method_type);
|
|
1079
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Ruby_Annotations_ColonMethodTypeAnnotation, 1, &h);
|
|
1080
|
+
}
|
|
1081
|
+
case RBS_AST_RUBY_ANNOTATIONS_DOUBLE_SPLAT_PARAM_TYPE_ANNOTATION: {
|
|
1082
|
+
rbs_ast_ruby_annotations_double_splat_param_type_annotation_t *node = (rbs_ast_ruby_annotations_double_splat_param_type_annotation_t *) instance;
|
|
1083
|
+
|
|
1084
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1085
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1086
|
+
VALUE arg_prefix_location = rbs_location_range_to_ruby_location(ctx, node->prefix_location);
|
|
1087
|
+
VALUE arg_star2_location = rbs_location_range_to_ruby_location(ctx, node->star2_location);
|
|
1088
|
+
VALUE arg_name_location = rbs_location_range_to_ruby_location(ctx, node->name_location); // optional
|
|
1089
|
+
VALUE arg_colon_location = rbs_location_range_to_ruby_location(ctx, node->colon_location);
|
|
1090
|
+
VALUE arg_param_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->param_type); // rbs_node
|
|
1091
|
+
VALUE arg_comment_location = rbs_location_range_to_ruby_location(ctx, node->comment_location); // optional
|
|
1092
|
+
|
|
1093
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1094
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1095
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1096
|
+
rb_hash_clear(h);
|
|
1097
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1098
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), arg_prefix_location);
|
|
1099
|
+
rb_hash_aset(h, ID2SYM(rb_intern("star2_location")), arg_star2_location);
|
|
1100
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name_location")), arg_name_location);
|
|
1101
|
+
rb_hash_aset(h, ID2SYM(rb_intern("colon_location")), arg_colon_location);
|
|
1102
|
+
rb_hash_aset(h, ID2SYM(rb_intern("param_type")), arg_param_type);
|
|
1103
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")), arg_comment_location);
|
|
1104
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Ruby_Annotations_DoubleSplatParamTypeAnnotation, 1, &h);
|
|
1105
|
+
}
|
|
1106
|
+
case RBS_AST_RUBY_ANNOTATIONS_INSTANCE_VARIABLE_ANNOTATION: {
|
|
1107
|
+
rbs_ast_ruby_annotations_instance_variable_annotation_t *node = (rbs_ast_ruby_annotations_instance_variable_annotation_t *) instance;
|
|
1108
|
+
|
|
1109
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1110
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1111
|
+
VALUE arg_prefix_location = rbs_location_range_to_ruby_location(ctx, node->prefix_location);
|
|
1112
|
+
VALUE arg_ivar_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->ivar_name); // rbs_ast_symbol
|
|
1113
|
+
VALUE arg_ivar_name_location = rbs_location_range_to_ruby_location(ctx, node->ivar_name_location);
|
|
1114
|
+
VALUE arg_colon_location = rbs_location_range_to_ruby_location(ctx, node->colon_location);
|
|
1115
|
+
VALUE arg_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type); // rbs_node
|
|
1116
|
+
VALUE arg_comment_location = rbs_location_range_to_ruby_location(ctx, node->comment_location); // optional
|
|
1117
|
+
|
|
1118
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1119
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1120
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1121
|
+
rb_hash_clear(h);
|
|
1122
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1123
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), arg_prefix_location);
|
|
1124
|
+
rb_hash_aset(h, ID2SYM(rb_intern("ivar_name")), arg_ivar_name);
|
|
1125
|
+
rb_hash_aset(h, ID2SYM(rb_intern("ivar_name_location")), arg_ivar_name_location);
|
|
1126
|
+
rb_hash_aset(h, ID2SYM(rb_intern("colon_location")), arg_colon_location);
|
|
1127
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), arg_type);
|
|
1128
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")), arg_comment_location);
|
|
1129
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Ruby_Annotations_InstanceVariableAnnotation, 1, &h);
|
|
1130
|
+
}
|
|
1131
|
+
case RBS_AST_RUBY_ANNOTATIONS_METHOD_TYPES_ANNOTATION: {
|
|
1132
|
+
rbs_ast_ruby_annotations_method_types_annotation_t *node = (rbs_ast_ruby_annotations_method_types_annotation_t *) instance;
|
|
1133
|
+
|
|
1134
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1135
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1136
|
+
VALUE arg_prefix_location = rbs_location_range_to_ruby_location(ctx, node->prefix_location);
|
|
1137
|
+
VALUE arg_overloads = rbs_node_list_to_ruby_array(ctx, node->overloads);
|
|
1138
|
+
VALUE arg_vertical_bar_locations = rbs_location_range_list_to_ruby_array(ctx, node->vertical_bar_locations);
|
|
1139
|
+
VALUE arg_dot3_location = rbs_location_range_to_ruby_location(ctx, node->dot3_location); // optional
|
|
1140
|
+
|
|
1141
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1142
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1143
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1144
|
+
rb_hash_clear(h);
|
|
1145
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1146
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), arg_prefix_location);
|
|
1147
|
+
rb_hash_aset(h, ID2SYM(rb_intern("overloads")), arg_overloads);
|
|
1148
|
+
rb_hash_aset(h, ID2SYM(rb_intern("vertical_bar_locations")), arg_vertical_bar_locations);
|
|
1149
|
+
rb_hash_aset(h, ID2SYM(rb_intern("dot3_location")), arg_dot3_location);
|
|
1150
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Ruby_Annotations_MethodTypesAnnotation, 1, &h);
|
|
1151
|
+
}
|
|
1152
|
+
case RBS_AST_RUBY_ANNOTATIONS_MODULE_ALIAS_ANNOTATION: {
|
|
1153
|
+
rbs_ast_ruby_annotations_module_alias_annotation_t *node = (rbs_ast_ruby_annotations_module_alias_annotation_t *) instance;
|
|
1154
|
+
|
|
1155
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1156
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1157
|
+
VALUE arg_prefix_location = rbs_location_range_to_ruby_location(ctx, node->prefix_location);
|
|
1158
|
+
VALUE arg_keyword_location = rbs_location_range_to_ruby_location(ctx, node->keyword_location);
|
|
1159
|
+
VALUE arg_type_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type_name); // rbs_type_name
|
|
1160
|
+
VALUE arg_type_name_location = rbs_location_range_to_ruby_location(ctx, node->type_name_location); // optional
|
|
1161
|
+
|
|
1162
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1163
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1164
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1165
|
+
rb_hash_clear(h);
|
|
1166
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1167
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), arg_prefix_location);
|
|
1168
|
+
rb_hash_aset(h, ID2SYM(rb_intern("keyword_location")), arg_keyword_location);
|
|
1169
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_name")), arg_type_name);
|
|
1170
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_name_location")), arg_type_name_location);
|
|
1171
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Ruby_Annotations_ModuleAliasAnnotation, 1, &h);
|
|
1172
|
+
}
|
|
1173
|
+
case RBS_AST_RUBY_ANNOTATIONS_MODULE_SELF_ANNOTATION: {
|
|
1174
|
+
rbs_ast_ruby_annotations_module_self_annotation_t *node = (rbs_ast_ruby_annotations_module_self_annotation_t *) instance;
|
|
1175
|
+
|
|
1176
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1177
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1178
|
+
VALUE arg_prefix_location = rbs_location_range_to_ruby_location(ctx, node->prefix_location);
|
|
1179
|
+
VALUE arg_keyword_location = rbs_location_range_to_ruby_location(ctx, node->keyword_location);
|
|
1180
|
+
VALUE arg_colon_location = rbs_location_range_to_ruby_location(ctx, node->colon_location);
|
|
1181
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_type_name
|
|
1182
|
+
VALUE arg_args = rbs_node_list_to_ruby_array(ctx, node->args);
|
|
1183
|
+
VALUE arg_open_bracket_location = rbs_location_range_to_ruby_location(ctx, node->open_bracket_location); // optional
|
|
1184
|
+
VALUE arg_close_bracket_location = rbs_location_range_to_ruby_location(ctx, node->close_bracket_location); // optional
|
|
1185
|
+
VALUE arg_args_comma_locations = rbs_location_range_list_to_ruby_array(ctx, node->args_comma_locations);
|
|
1186
|
+
VALUE arg_comment_location = rbs_location_range_to_ruby_location(ctx, node->comment_location); // optional
|
|
1187
|
+
|
|
1188
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1189
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1190
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1191
|
+
rb_hash_clear(h);
|
|
1192
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1193
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), arg_prefix_location);
|
|
1194
|
+
rb_hash_aset(h, ID2SYM(rb_intern("keyword_location")), arg_keyword_location);
|
|
1195
|
+
rb_hash_aset(h, ID2SYM(rb_intern("colon_location")), arg_colon_location);
|
|
1196
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
1197
|
+
rb_hash_aset(h, ID2SYM(rb_intern("args")), arg_args);
|
|
1198
|
+
rb_hash_aset(h, ID2SYM(rb_intern("open_bracket_location")), arg_open_bracket_location);
|
|
1199
|
+
rb_hash_aset(h, ID2SYM(rb_intern("close_bracket_location")), arg_close_bracket_location);
|
|
1200
|
+
rb_hash_aset(h, ID2SYM(rb_intern("args_comma_locations")), arg_args_comma_locations);
|
|
1201
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")), arg_comment_location);
|
|
1202
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Ruby_Annotations_ModuleSelfAnnotation, 1, &h);
|
|
1203
|
+
}
|
|
1204
|
+
case RBS_AST_RUBY_ANNOTATIONS_NODE_TYPE_ASSERTION: {
|
|
1205
|
+
rbs_ast_ruby_annotations_node_type_assertion_t *node = (rbs_ast_ruby_annotations_node_type_assertion_t *) instance;
|
|
1206
|
+
|
|
1207
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1208
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1209
|
+
VALUE arg_prefix_location = rbs_location_range_to_ruby_location(ctx, node->prefix_location);
|
|
1210
|
+
VALUE arg_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type); // rbs_node
|
|
1211
|
+
|
|
1212
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1213
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1214
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1215
|
+
rb_hash_clear(h);
|
|
1216
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1217
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), arg_prefix_location);
|
|
1218
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), arg_type);
|
|
1219
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Ruby_Annotations_NodeTypeAssertion, 1, &h);
|
|
1220
|
+
}
|
|
1221
|
+
case RBS_AST_RUBY_ANNOTATIONS_PARAM_TYPE_ANNOTATION: {
|
|
1222
|
+
rbs_ast_ruby_annotations_param_type_annotation_t *node = (rbs_ast_ruby_annotations_param_type_annotation_t *) instance;
|
|
1223
|
+
|
|
1224
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1225
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1226
|
+
VALUE arg_prefix_location = rbs_location_range_to_ruby_location(ctx, node->prefix_location);
|
|
1227
|
+
VALUE arg_name_location = rbs_location_range_to_ruby_location(ctx, node->name_location);
|
|
1228
|
+
VALUE arg_colon_location = rbs_location_range_to_ruby_location(ctx, node->colon_location);
|
|
1229
|
+
VALUE arg_param_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->param_type); // rbs_node
|
|
1230
|
+
VALUE arg_comment_location = rbs_location_range_to_ruby_location(ctx, node->comment_location); // optional
|
|
1231
|
+
|
|
1232
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1233
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1234
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1235
|
+
rb_hash_clear(h);
|
|
1236
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1237
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), arg_prefix_location);
|
|
1238
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name_location")), arg_name_location);
|
|
1239
|
+
rb_hash_aset(h, ID2SYM(rb_intern("colon_location")), arg_colon_location);
|
|
1240
|
+
rb_hash_aset(h, ID2SYM(rb_intern("param_type")), arg_param_type);
|
|
1241
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")), arg_comment_location);
|
|
1242
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Ruby_Annotations_ParamTypeAnnotation, 1, &h);
|
|
1243
|
+
}
|
|
1244
|
+
case RBS_AST_RUBY_ANNOTATIONS_RETURN_TYPE_ANNOTATION: {
|
|
1245
|
+
rbs_ast_ruby_annotations_return_type_annotation_t *node = (rbs_ast_ruby_annotations_return_type_annotation_t *) instance;
|
|
1246
|
+
|
|
1247
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1248
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1249
|
+
VALUE arg_prefix_location = rbs_location_range_to_ruby_location(ctx, node->prefix_location);
|
|
1250
|
+
VALUE arg_return_location = rbs_location_range_to_ruby_location(ctx, node->return_location);
|
|
1251
|
+
VALUE arg_colon_location = rbs_location_range_to_ruby_location(ctx, node->colon_location);
|
|
1252
|
+
VALUE arg_return_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->return_type); // rbs_node
|
|
1253
|
+
VALUE arg_comment_location = rbs_location_range_to_ruby_location(ctx, node->comment_location); // optional
|
|
1254
|
+
|
|
1255
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1256
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1257
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1258
|
+
rb_hash_clear(h);
|
|
1259
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1260
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), arg_prefix_location);
|
|
1261
|
+
rb_hash_aset(h, ID2SYM(rb_intern("return_location")), arg_return_location);
|
|
1262
|
+
rb_hash_aset(h, ID2SYM(rb_intern("colon_location")), arg_colon_location);
|
|
1263
|
+
rb_hash_aset(h, ID2SYM(rb_intern("return_type")), arg_return_type);
|
|
1264
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")), arg_comment_location);
|
|
1265
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Ruby_Annotations_ReturnTypeAnnotation, 1, &h);
|
|
1266
|
+
}
|
|
1267
|
+
case RBS_AST_RUBY_ANNOTATIONS_SKIP_ANNOTATION: {
|
|
1268
|
+
rbs_ast_ruby_annotations_skip_annotation_t *node = (rbs_ast_ruby_annotations_skip_annotation_t *) instance;
|
|
1269
|
+
|
|
1270
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1271
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1272
|
+
VALUE arg_prefix_location = rbs_location_range_to_ruby_location(ctx, node->prefix_location);
|
|
1273
|
+
VALUE arg_skip_location = rbs_location_range_to_ruby_location(ctx, node->skip_location);
|
|
1274
|
+
VALUE arg_comment_location = rbs_location_range_to_ruby_location(ctx, node->comment_location); // optional
|
|
1275
|
+
|
|
1276
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1277
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1278
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1279
|
+
rb_hash_clear(h);
|
|
1280
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1281
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), arg_prefix_location);
|
|
1282
|
+
rb_hash_aset(h, ID2SYM(rb_intern("skip_location")), arg_skip_location);
|
|
1283
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")), arg_comment_location);
|
|
1284
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Ruby_Annotations_SkipAnnotation, 1, &h);
|
|
1285
|
+
}
|
|
1286
|
+
case RBS_AST_RUBY_ANNOTATIONS_SPLAT_PARAM_TYPE_ANNOTATION: {
|
|
1287
|
+
rbs_ast_ruby_annotations_splat_param_type_annotation_t *node = (rbs_ast_ruby_annotations_splat_param_type_annotation_t *) instance;
|
|
1288
|
+
|
|
1289
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1290
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1291
|
+
VALUE arg_prefix_location = rbs_location_range_to_ruby_location(ctx, node->prefix_location);
|
|
1292
|
+
VALUE arg_star_location = rbs_location_range_to_ruby_location(ctx, node->star_location);
|
|
1293
|
+
VALUE arg_name_location = rbs_location_range_to_ruby_location(ctx, node->name_location); // optional
|
|
1294
|
+
VALUE arg_colon_location = rbs_location_range_to_ruby_location(ctx, node->colon_location);
|
|
1295
|
+
VALUE arg_param_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->param_type); // rbs_node
|
|
1296
|
+
VALUE arg_comment_location = rbs_location_range_to_ruby_location(ctx, node->comment_location); // optional
|
|
1297
|
+
|
|
1298
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1299
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1300
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1301
|
+
rb_hash_clear(h);
|
|
1302
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1303
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), arg_prefix_location);
|
|
1304
|
+
rb_hash_aset(h, ID2SYM(rb_intern("star_location")), arg_star_location);
|
|
1305
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name_location")), arg_name_location);
|
|
1306
|
+
rb_hash_aset(h, ID2SYM(rb_intern("colon_location")), arg_colon_location);
|
|
1307
|
+
rb_hash_aset(h, ID2SYM(rb_intern("param_type")), arg_param_type);
|
|
1308
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")), arg_comment_location);
|
|
1309
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Ruby_Annotations_SplatParamTypeAnnotation, 1, &h);
|
|
1310
|
+
}
|
|
1311
|
+
case RBS_AST_RUBY_ANNOTATIONS_TYPE_APPLICATION_ANNOTATION: {
|
|
1312
|
+
rbs_ast_ruby_annotations_type_application_annotation_t *node = (rbs_ast_ruby_annotations_type_application_annotation_t *) instance;
|
|
1313
|
+
|
|
1314
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1315
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1316
|
+
VALUE arg_prefix_location = rbs_location_range_to_ruby_location(ctx, node->prefix_location);
|
|
1317
|
+
VALUE arg_type_args = rbs_node_list_to_ruby_array(ctx, node->type_args);
|
|
1318
|
+
VALUE arg_close_bracket_location = rbs_location_range_to_ruby_location(ctx, node->close_bracket_location);
|
|
1319
|
+
VALUE arg_comma_locations = rbs_location_range_list_to_ruby_array(ctx, node->comma_locations);
|
|
1320
|
+
|
|
1321
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1322
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1323
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1324
|
+
rb_hash_clear(h);
|
|
1325
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1326
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), arg_prefix_location);
|
|
1327
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_args")), arg_type_args);
|
|
1328
|
+
rb_hash_aset(h, ID2SYM(rb_intern("close_bracket_location")), arg_close_bracket_location);
|
|
1329
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comma_locations")), arg_comma_locations);
|
|
1330
|
+
return CLASS_NEW_INSTANCE(RBS_AST_Ruby_Annotations_TypeApplicationAnnotation, 1, &h);
|
|
1331
|
+
}
|
|
1332
|
+
case RBS_AST_STRING: {
|
|
1333
|
+
rbs_ast_string_t *string_node = (rbs_ast_string_t *) instance;
|
|
1334
|
+
rbs_string_t s = string_node->string;
|
|
1335
|
+
|
|
1336
|
+
return rb_enc_str_new(s.start, rbs_string_len(s), rb_utf8_encoding());
|
|
1337
|
+
}
|
|
1338
|
+
case RBS_AST_TYPE_PARAM: {
|
|
1339
|
+
rbs_ast_type_param_t *node = (rbs_ast_type_param_t *) instance;
|
|
1340
|
+
|
|
1341
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1342
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1343
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
1344
|
+
{
|
|
1345
|
+
rbs_loc_legacy_alloc_children(loc, 6);
|
|
1346
|
+
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 });
|
|
1347
|
+
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 });
|
|
1348
|
+
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 });
|
|
1349
|
+
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 });
|
|
1350
|
+
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 });
|
|
1351
|
+
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 });
|
|
1352
|
+
}
|
|
1353
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_ast_symbol
|
|
1354
|
+
VALUE arg_variance = rbs_type_param_variance_to_ruby(node->variance); // type_param_variance
|
|
1355
|
+
VALUE arg_upper_bound = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->upper_bound); // rbs_node
|
|
1356
|
+
VALUE arg_lower_bound = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->lower_bound); // rbs_node
|
|
1357
|
+
VALUE arg_default_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->default_type); // rbs_node
|
|
1358
|
+
VALUE arg_unchecked = node->unchecked ? Qtrue : Qfalse;
|
|
1359
|
+
|
|
1360
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1361
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1362
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1363
|
+
rb_hash_clear(h);
|
|
1364
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1365
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
1366
|
+
rb_hash_aset(h, ID2SYM(rb_intern("variance")), arg_variance);
|
|
1367
|
+
rb_hash_aset(h, ID2SYM(rb_intern("upper_bound")), arg_upper_bound);
|
|
1368
|
+
rb_hash_aset(h, ID2SYM(rb_intern("lower_bound")), arg_lower_bound);
|
|
1369
|
+
rb_hash_aset(h, ID2SYM(rb_intern("default_type")), arg_default_type);
|
|
1370
|
+
rb_hash_aset(h, ID2SYM(rb_intern("unchecked")), arg_unchecked);
|
|
1371
|
+
return CLASS_NEW_INSTANCE(RBS_AST_TypeParam, 1, &h);
|
|
1372
|
+
}
|
|
1373
|
+
case RBS_METHOD_TYPE: {
|
|
1374
|
+
rbs_method_type_t *node = (rbs_method_type_t *) instance;
|
|
1375
|
+
|
|
1376
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1377
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1378
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
1379
|
+
{
|
|
1380
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
1381
|
+
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 });
|
|
1382
|
+
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 });
|
|
1383
|
+
}
|
|
1384
|
+
VALUE arg_type_params = rbs_node_list_to_ruby_array(ctx, node->type_params);
|
|
1385
|
+
VALUE arg_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type); // rbs_node
|
|
1386
|
+
VALUE arg_block = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->block); // rbs_types_block
|
|
1387
|
+
|
|
1388
|
+
rb_funcall(
|
|
1389
|
+
RBS_AST_TypeParam,
|
|
1390
|
+
rb_intern("resolve_variables"),
|
|
1391
|
+
1,
|
|
1392
|
+
arg_type_params
|
|
1393
|
+
);
|
|
1394
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1395
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1396
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1397
|
+
rb_hash_clear(h);
|
|
1398
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1399
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type_params")), arg_type_params);
|
|
1400
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), arg_type);
|
|
1401
|
+
rb_hash_aset(h, ID2SYM(rb_intern("block")), arg_block);
|
|
1402
|
+
return CLASS_NEW_INSTANCE(RBS_MethodType, 1, &h);
|
|
1403
|
+
}
|
|
1404
|
+
case RBS_NAMESPACE: {
|
|
1405
|
+
return rbs_intern_namespace(ctx, (rbs_namespace_t *) instance);
|
|
1406
|
+
}
|
|
1407
|
+
case RBS_SIGNATURE: {
|
|
1408
|
+
rbs_signature_t *signature = (rbs_signature_t *) instance;
|
|
1409
|
+
|
|
1410
|
+
VALUE array = rb_ary_new();
|
|
1411
|
+
rb_ary_push(array, rbs_node_list_to_ruby_array(ctx, signature->directives));
|
|
1412
|
+
rb_ary_push(array, rbs_node_list_to_ruby_array(ctx, signature->declarations));
|
|
1413
|
+
return array;
|
|
1414
|
+
}
|
|
1415
|
+
case RBS_TYPE_NAME: {
|
|
1416
|
+
rbs_type_name_t *node = (rbs_type_name_t *) instance;
|
|
1417
|
+
VALUE ns = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->rbs_namespace);
|
|
1418
|
+
VALUE name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name);
|
|
1419
|
+
return rbs_intern_type_name(ns, name);
|
|
1420
|
+
}
|
|
1421
|
+
case RBS_TYPES_ALIAS: {
|
|
1422
|
+
rbs_types_alias_t *node = (rbs_types_alias_t *) instance;
|
|
1423
|
+
|
|
1424
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1425
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1426
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
1427
|
+
{
|
|
1428
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
1429
|
+
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 });
|
|
1430
|
+
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 });
|
|
1431
|
+
}
|
|
1432
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_type_name
|
|
1433
|
+
VALUE arg_args = rbs_node_list_to_ruby_array(ctx, node->args);
|
|
1434
|
+
|
|
1435
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1436
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1437
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1438
|
+
rb_hash_clear(h);
|
|
1439
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1440
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
1441
|
+
rb_hash_aset(h, ID2SYM(rb_intern("args")), arg_args);
|
|
1442
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Alias, 1, &h);
|
|
1443
|
+
}
|
|
1444
|
+
case RBS_TYPES_BASES_ANY: {
|
|
1445
|
+
rbs_types_bases_any_t *node = (rbs_types_bases_any_t *) instance;
|
|
1446
|
+
|
|
1447
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1448
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1449
|
+
VALUE arg_todo = node->todo ? Qtrue : Qfalse;
|
|
1450
|
+
|
|
1451
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1452
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1453
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1454
|
+
rb_hash_clear(h);
|
|
1455
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1456
|
+
rb_hash_aset(h, ID2SYM(rb_intern("todo")), arg_todo);
|
|
1457
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Bases_Any, 1, &h);
|
|
1458
|
+
}
|
|
1459
|
+
case RBS_TYPES_BASES_BOOL: {
|
|
1460
|
+
rbs_types_bases_bool_t *node = (rbs_types_bases_bool_t *) instance;
|
|
1461
|
+
|
|
1462
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1463
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1464
|
+
|
|
1465
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1466
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1467
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1468
|
+
rb_hash_clear(h);
|
|
1469
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1470
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Bases_Bool, 1, &h);
|
|
1471
|
+
}
|
|
1472
|
+
case RBS_TYPES_BASES_BOTTOM: {
|
|
1473
|
+
rbs_types_bases_bottom_t *node = (rbs_types_bases_bottom_t *) instance;
|
|
1474
|
+
|
|
1475
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1476
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1477
|
+
|
|
1478
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1479
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1480
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1481
|
+
rb_hash_clear(h);
|
|
1482
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1483
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Bases_Bottom, 1, &h);
|
|
1484
|
+
}
|
|
1485
|
+
case RBS_TYPES_BASES_CLASS: {
|
|
1486
|
+
rbs_types_bases_class_t *node = (rbs_types_bases_class_t *) instance;
|
|
1487
|
+
|
|
1488
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1489
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1490
|
+
|
|
1491
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1492
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1493
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1494
|
+
rb_hash_clear(h);
|
|
1495
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1496
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Bases_Class, 1, &h);
|
|
1497
|
+
}
|
|
1498
|
+
case RBS_TYPES_BASES_INSTANCE: {
|
|
1499
|
+
rbs_types_bases_instance_t *node = (rbs_types_bases_instance_t *) instance;
|
|
1500
|
+
|
|
1501
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1502
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1503
|
+
|
|
1504
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1505
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1506
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1507
|
+
rb_hash_clear(h);
|
|
1508
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1509
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Bases_Instance, 1, &h);
|
|
1510
|
+
}
|
|
1511
|
+
case RBS_TYPES_BASES_NIL: {
|
|
1512
|
+
rbs_types_bases_nil_t *node = (rbs_types_bases_nil_t *) instance;
|
|
1513
|
+
|
|
1514
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1515
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1516
|
+
|
|
1517
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1518
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1519
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1520
|
+
rb_hash_clear(h);
|
|
1521
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1522
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Bases_Nil, 1, &h);
|
|
1523
|
+
}
|
|
1524
|
+
case RBS_TYPES_BASES_SELF: {
|
|
1525
|
+
rbs_types_bases_self_t *node = (rbs_types_bases_self_t *) instance;
|
|
1526
|
+
|
|
1527
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1528
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1529
|
+
|
|
1530
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1531
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1532
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1533
|
+
rb_hash_clear(h);
|
|
1534
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1535
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Bases_Self, 1, &h);
|
|
1536
|
+
}
|
|
1537
|
+
case RBS_TYPES_BASES_TOP: {
|
|
1538
|
+
rbs_types_bases_top_t *node = (rbs_types_bases_top_t *) instance;
|
|
1539
|
+
|
|
1540
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1541
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1542
|
+
|
|
1543
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1544
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1545
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1546
|
+
rb_hash_clear(h);
|
|
1547
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1548
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Bases_Top, 1, &h);
|
|
1549
|
+
}
|
|
1550
|
+
case RBS_TYPES_BASES_VOID: {
|
|
1551
|
+
rbs_types_bases_void_t *node = (rbs_types_bases_void_t *) instance;
|
|
1552
|
+
|
|
1553
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1554
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1555
|
+
|
|
1556
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1557
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1558
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1559
|
+
rb_hash_clear(h);
|
|
1560
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1561
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Bases_Void, 1, &h);
|
|
1562
|
+
}
|
|
1563
|
+
case RBS_TYPES_BLOCK: {
|
|
1564
|
+
rbs_types_block_t *node = (rbs_types_block_t *) instance;
|
|
1565
|
+
|
|
1566
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1567
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1568
|
+
VALUE arg_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type); // rbs_node
|
|
1569
|
+
VALUE arg_required = node->required ? Qtrue : Qfalse;
|
|
1570
|
+
VALUE arg_self_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->self_type); // rbs_node
|
|
1571
|
+
|
|
1572
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1573
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1574
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1575
|
+
rb_hash_clear(h);
|
|
1576
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1577
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), arg_type);
|
|
1578
|
+
rb_hash_aset(h, ID2SYM(rb_intern("required")), arg_required);
|
|
1579
|
+
rb_hash_aset(h, ID2SYM(rb_intern("self_type")), arg_self_type);
|
|
1580
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Block, 1, &h);
|
|
1581
|
+
}
|
|
1582
|
+
case RBS_TYPES_CLASS_INSTANCE: {
|
|
1583
|
+
rbs_types_class_instance_t *node = (rbs_types_class_instance_t *) instance;
|
|
1584
|
+
|
|
1585
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1586
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1587
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
1588
|
+
{
|
|
1589
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
1590
|
+
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 });
|
|
1591
|
+
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 });
|
|
1592
|
+
}
|
|
1593
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_type_name
|
|
1594
|
+
VALUE arg_args = rbs_node_list_to_ruby_array(ctx, node->args);
|
|
1595
|
+
|
|
1596
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1597
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1598
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1599
|
+
rb_hash_clear(h);
|
|
1600
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1601
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
1602
|
+
rb_hash_aset(h, ID2SYM(rb_intern("args")), arg_args);
|
|
1603
|
+
return CLASS_NEW_INSTANCE(RBS_Types_ClassInstance, 1, &h);
|
|
1604
|
+
}
|
|
1605
|
+
case RBS_TYPES_CLASS_SINGLETON: {
|
|
1606
|
+
rbs_types_class_singleton_t *node = (rbs_types_class_singleton_t *) instance;
|
|
1607
|
+
|
|
1608
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1609
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1610
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
1611
|
+
{
|
|
1612
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
1613
|
+
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 });
|
|
1614
|
+
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 });
|
|
1615
|
+
}
|
|
1616
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_type_name
|
|
1617
|
+
VALUE arg_args = rbs_node_list_to_ruby_array(ctx, node->args);
|
|
1618
|
+
|
|
1619
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1620
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1621
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1622
|
+
rb_hash_clear(h);
|
|
1623
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1624
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
1625
|
+
rb_hash_aset(h, ID2SYM(rb_intern("args")), arg_args);
|
|
1626
|
+
return CLASS_NEW_INSTANCE(RBS_Types_ClassSingleton, 1, &h);
|
|
1627
|
+
}
|
|
1628
|
+
case RBS_TYPES_FUNCTION: {
|
|
1629
|
+
rbs_types_function_t *node = (rbs_types_function_t *) instance;
|
|
1630
|
+
|
|
1631
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1632
|
+
VALUE arg_required_positionals = rbs_node_list_to_ruby_array(ctx, node->required_positionals);
|
|
1633
|
+
VALUE arg_optional_positionals = rbs_node_list_to_ruby_array(ctx, node->optional_positionals);
|
|
1634
|
+
VALUE arg_rest_positionals = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->rest_positionals); // rbs_node
|
|
1635
|
+
VALUE arg_trailing_positionals = rbs_node_list_to_ruby_array(ctx, node->trailing_positionals);
|
|
1636
|
+
VALUE arg_required_keywords = rbs_hash_to_ruby_hash(ctx, node->required_keywords);
|
|
1637
|
+
VALUE arg_optional_keywords = rbs_hash_to_ruby_hash(ctx, node->optional_keywords);
|
|
1638
|
+
VALUE arg_rest_keywords = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->rest_keywords); // rbs_node
|
|
1639
|
+
VALUE arg_return_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->return_type); // rbs_node
|
|
1640
|
+
|
|
1641
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1642
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1643
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1644
|
+
rb_hash_clear(h);
|
|
1645
|
+
rb_hash_aset(h, ID2SYM(rb_intern("required_positionals")), arg_required_positionals);
|
|
1646
|
+
rb_hash_aset(h, ID2SYM(rb_intern("optional_positionals")), arg_optional_positionals);
|
|
1647
|
+
rb_hash_aset(h, ID2SYM(rb_intern("rest_positionals")), arg_rest_positionals);
|
|
1648
|
+
rb_hash_aset(h, ID2SYM(rb_intern("trailing_positionals")), arg_trailing_positionals);
|
|
1649
|
+
rb_hash_aset(h, ID2SYM(rb_intern("required_keywords")), arg_required_keywords);
|
|
1650
|
+
rb_hash_aset(h, ID2SYM(rb_intern("optional_keywords")), arg_optional_keywords);
|
|
1651
|
+
rb_hash_aset(h, ID2SYM(rb_intern("rest_keywords")), arg_rest_keywords);
|
|
1652
|
+
rb_hash_aset(h, ID2SYM(rb_intern("return_type")), arg_return_type);
|
|
1653
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Function, 1, &h);
|
|
1654
|
+
}
|
|
1655
|
+
case RBS_TYPES_FUNCTION_PARAM: {
|
|
1656
|
+
rbs_types_function_param_t *node = (rbs_types_function_param_t *) instance;
|
|
1657
|
+
|
|
1658
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1659
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1660
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
1661
|
+
{
|
|
1662
|
+
rbs_loc_legacy_alloc_children(loc, 1);
|
|
1663
|
+
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 });
|
|
1664
|
+
}
|
|
1665
|
+
VALUE arg_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type); // rbs_node
|
|
1666
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_ast_symbol
|
|
1667
|
+
|
|
1668
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1669
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1670
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1671
|
+
rb_hash_clear(h);
|
|
1672
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1673
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), arg_type);
|
|
1674
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
1675
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Function_Param, 1, &h);
|
|
1676
|
+
}
|
|
1677
|
+
case RBS_TYPES_INTERFACE: {
|
|
1678
|
+
rbs_types_interface_t *node = (rbs_types_interface_t *) instance;
|
|
1679
|
+
|
|
1680
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1681
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1682
|
+
rbs_loc *loc = rbs_check_location(arg_location);
|
|
1683
|
+
{
|
|
1684
|
+
rbs_loc_legacy_alloc_children(loc, 2);
|
|
1685
|
+
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 });
|
|
1686
|
+
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 });
|
|
1687
|
+
}
|
|
1688
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_type_name
|
|
1689
|
+
VALUE arg_args = rbs_node_list_to_ruby_array(ctx, node->args);
|
|
1690
|
+
|
|
1691
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1692
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1693
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1694
|
+
rb_hash_clear(h);
|
|
1695
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1696
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
1697
|
+
rb_hash_aset(h, ID2SYM(rb_intern("args")), arg_args);
|
|
1698
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Interface, 1, &h);
|
|
1699
|
+
}
|
|
1700
|
+
case RBS_TYPES_INTERSECTION: {
|
|
1701
|
+
rbs_types_intersection_t *node = (rbs_types_intersection_t *) instance;
|
|
1702
|
+
|
|
1703
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1704
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1705
|
+
VALUE arg_types = rbs_node_list_to_ruby_array(ctx, node->types);
|
|
1706
|
+
|
|
1707
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1708
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1709
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1710
|
+
rb_hash_clear(h);
|
|
1711
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1712
|
+
rb_hash_aset(h, ID2SYM(rb_intern("types")), arg_types);
|
|
1713
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Intersection, 1, &h);
|
|
1714
|
+
}
|
|
1715
|
+
case RBS_TYPES_LITERAL: {
|
|
1716
|
+
rbs_types_literal_t *node = (rbs_types_literal_t *) instance;
|
|
1717
|
+
|
|
1718
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1719
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1720
|
+
VALUE arg_literal = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->literal); // rbs_node
|
|
1721
|
+
|
|
1722
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1723
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1724
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1725
|
+
rb_hash_clear(h);
|
|
1726
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1727
|
+
rb_hash_aset(h, ID2SYM(rb_intern("literal")), arg_literal);
|
|
1728
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Literal, 1, &h);
|
|
1729
|
+
}
|
|
1730
|
+
case RBS_TYPES_OPTIONAL: {
|
|
1731
|
+
rbs_types_optional_t *node = (rbs_types_optional_t *) instance;
|
|
1732
|
+
|
|
1733
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1734
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1735
|
+
VALUE arg_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type); // rbs_node
|
|
1736
|
+
|
|
1737
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1738
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1739
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1740
|
+
rb_hash_clear(h);
|
|
1741
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1742
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), arg_type);
|
|
1743
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Optional, 1, &h);
|
|
1744
|
+
}
|
|
1745
|
+
case RBS_TYPES_PROC: {
|
|
1746
|
+
rbs_types_proc_t *node = (rbs_types_proc_t *) instance;
|
|
1747
|
+
|
|
1748
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1749
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1750
|
+
VALUE arg_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->type); // rbs_node
|
|
1751
|
+
VALUE arg_block = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->block); // rbs_types_block
|
|
1752
|
+
VALUE arg_self_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->self_type); // rbs_node
|
|
1753
|
+
|
|
1754
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1755
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1756
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1757
|
+
rb_hash_clear(h);
|
|
1758
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1759
|
+
rb_hash_aset(h, ID2SYM(rb_intern("type")), arg_type);
|
|
1760
|
+
rb_hash_aset(h, ID2SYM(rb_intern("block")), arg_block);
|
|
1761
|
+
rb_hash_aset(h, ID2SYM(rb_intern("self_type")), arg_self_type);
|
|
1762
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Proc, 1, &h);
|
|
1763
|
+
}
|
|
1764
|
+
case RBS_TYPES_RECORD: {
|
|
1765
|
+
rbs_types_record_t *node = (rbs_types_record_t *) instance;
|
|
1766
|
+
|
|
1767
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1768
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1769
|
+
VALUE arg_all_fields = rbs_hash_to_ruby_hash(ctx, node->all_fields);
|
|
1770
|
+
|
|
1771
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1772
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1773
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1774
|
+
rb_hash_clear(h);
|
|
1775
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1776
|
+
rb_hash_aset(h, ID2SYM(rb_intern("all_fields")), arg_all_fields);
|
|
1777
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Record, 1, &h);
|
|
1778
|
+
}
|
|
1779
|
+
case RBS_TYPES_RECORD_FIELD_TYPE: {
|
|
1780
|
+
rbs_types_record_field_type_t *record_fieldtype = (rbs_types_record_field_type_t *) instance;
|
|
1781
|
+
|
|
1782
|
+
VALUE array = rb_ary_new();
|
|
1783
|
+
rb_ary_push(array, rbs_struct_to_ruby_value(ctx, record_fieldtype->type));
|
|
1784
|
+
rb_ary_push(array, record_fieldtype->required ? Qtrue : Qfalse);
|
|
1785
|
+
return array;
|
|
1786
|
+
}
|
|
1787
|
+
case RBS_TYPES_TUPLE: {
|
|
1788
|
+
rbs_types_tuple_t *node = (rbs_types_tuple_t *) instance;
|
|
1789
|
+
|
|
1790
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1791
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1792
|
+
VALUE arg_types = rbs_node_list_to_ruby_array(ctx, node->types);
|
|
1793
|
+
|
|
1794
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1795
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1796
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1797
|
+
rb_hash_clear(h);
|
|
1798
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1799
|
+
rb_hash_aset(h, ID2SYM(rb_intern("types")), arg_types);
|
|
1800
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Tuple, 1, &h);
|
|
1801
|
+
}
|
|
1802
|
+
case RBS_TYPES_UNION: {
|
|
1803
|
+
rbs_types_union_t *node = (rbs_types_union_t *) instance;
|
|
1804
|
+
|
|
1805
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1806
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1807
|
+
VALUE arg_types = rbs_node_list_to_ruby_array(ctx, node->types);
|
|
1808
|
+
|
|
1809
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1810
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1811
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1812
|
+
rb_hash_clear(h);
|
|
1813
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1814
|
+
rb_hash_aset(h, ID2SYM(rb_intern("types")), arg_types);
|
|
1815
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Union, 1, &h);
|
|
1816
|
+
}
|
|
1817
|
+
case RBS_TYPES_UNTYPED_FUNCTION: {
|
|
1818
|
+
rbs_types_untyped_function_t *node = (rbs_types_untyped_function_t *) instance;
|
|
1819
|
+
|
|
1820
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1821
|
+
VALUE arg_return_type = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->return_type); // rbs_node
|
|
1822
|
+
|
|
1823
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1824
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1825
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1826
|
+
rb_hash_clear(h);
|
|
1827
|
+
rb_hash_aset(h, ID2SYM(rb_intern("return_type")), arg_return_type);
|
|
1828
|
+
return CLASS_NEW_INSTANCE(RBS_Types_UntypedFunction, 1, &h);
|
|
1829
|
+
}
|
|
1830
|
+
case RBS_TYPES_VARIABLE: {
|
|
1831
|
+
rbs_types_variable_t *node = (rbs_types_variable_t *) instance;
|
|
1832
|
+
|
|
1833
|
+
// Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`.
|
|
1834
|
+
VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location);
|
|
1835
|
+
VALUE arg_name = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name); // rbs_ast_symbol
|
|
1836
|
+
|
|
1837
|
+
// Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`.
|
|
1838
|
+
// Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`.
|
|
1839
|
+
VALUE h = ctx.reusable_kwargs_hash;
|
|
1840
|
+
rb_hash_clear(h);
|
|
1841
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location);
|
|
1842
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), arg_name);
|
|
1843
|
+
return CLASS_NEW_INSTANCE(RBS_Types_Variable, 1, &h);
|
|
1844
|
+
}
|
|
1845
|
+
case RBS_AST_SYMBOL: {
|
|
1846
|
+
rbs_constant_t *constant = rbs_constant_pool_id_to_constant(ctx.constant_pool, ((rbs_ast_symbol_t *) instance)->constant_id);
|
|
1847
|
+
assert(constant != NULL && "constant is NULL");
|
|
1848
|
+
assert(constant->start != NULL && "constant->start is NULL");
|
|
1849
|
+
|
|
1850
|
+
return ID2SYM(rb_intern3((const char *) constant->start, constant->length, ctx.encoding));
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
rb_raise(rb_eRuntimeError, "Unknown node type: %d", instance->type);
|
|
1855
|
+
}
|