rbs 3.9.5 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.clang-format +74 -0
- data/.clangd +2 -0
- data/.github/dependabot.yml +14 -14
- data/.github/workflows/bundle-update.yml +60 -0
- data/.github/workflows/c-check.yml +58 -0
- data/.github/workflows/comments.yml +5 -3
- data/.github/workflows/dependabot.yml +2 -2
- data/.github/workflows/ruby.yml +40 -32
- data/.github/workflows/rust.yml +95 -0
- data/.github/workflows/typecheck.yml +2 -2
- data/.github/workflows/windows.yml +3 -3
- data/.gitignore +4 -0
- data/.rubocop.yml +2 -2
- data/.vscode/extensions.json +5 -0
- data/.vscode/settings.json +19 -0
- data/CHANGELOG.md +284 -0
- data/README.md +38 -1
- data/Rakefile +144 -29
- data/Steepfile +2 -0
- data/config.yml +634 -62
- data/core/array.rbs +307 -227
- data/core/basic_object.rbs +9 -8
- data/core/binding.rbs +0 -2
- data/core/builtin.rbs +2 -2
- data/core/class.rbs +6 -5
- data/core/comparable.rbs +55 -34
- data/core/complex.rbs +104 -78
- data/core/dir.rbs +61 -49
- data/core/encoding.rbs +12 -15
- data/core/enumerable.rbs +188 -87
- data/core/enumerator/arithmetic_sequence.rbs +70 -0
- data/core/enumerator.rbs +65 -2
- data/core/errno.rbs +11 -2
- data/core/errors.rbs +58 -29
- data/core/exception.rbs +13 -13
- data/core/fiber.rbs +74 -54
- data/core/file.rbs +280 -177
- data/core/file_test.rbs +3 -3
- data/core/float.rbs +257 -92
- data/core/gc.rbs +425 -281
- data/core/hash.rbs +1045 -739
- data/core/integer.rbs +135 -137
- data/core/io/buffer.rbs +53 -42
- data/core/io/wait.rbs +13 -35
- data/core/io.rbs +196 -148
- data/core/kernel.rbs +216 -155
- data/core/marshal.rbs +4 -4
- data/core/match_data.rbs +15 -13
- data/core/math.rbs +107 -66
- data/core/method.rbs +69 -33
- data/core/module.rbs +244 -106
- data/core/nil_class.rbs +7 -6
- data/core/numeric.rbs +74 -63
- data/core/object.rbs +9 -11
- data/core/object_space.rbs +30 -23
- data/core/pathname.rbs +1322 -0
- data/core/proc.rbs +95 -58
- data/core/process.rbs +222 -202
- data/core/ractor.rbs +371 -515
- data/core/random.rbs +21 -3
- data/core/range.rbs +159 -57
- data/core/rational.rbs +60 -89
- data/core/rbs/unnamed/argf.rbs +60 -53
- data/core/rbs/unnamed/env_class.rbs +19 -14
- data/core/rbs/unnamed/main_class.rbs +123 -0
- data/core/rbs/unnamed/random.rbs +11 -118
- data/core/regexp.rbs +258 -214
- data/core/ruby.rbs +53 -0
- data/core/ruby_vm.rbs +38 -34
- data/core/rubygems/config_file.rbs +5 -5
- data/core/rubygems/errors.rbs +4 -71
- data/core/rubygems/requirement.rbs +5 -5
- data/core/rubygems/rubygems.rbs +16 -82
- data/core/rubygems/version.rbs +2 -3
- data/core/set.rbs +490 -360
- data/core/signal.rbs +26 -16
- data/core/string.rbs +3303 -1365
- data/core/struct.rbs +27 -26
- data/core/symbol.rbs +41 -34
- data/core/thread.rbs +135 -74
- data/core/time.rbs +81 -50
- data/core/trace_point.rbs +41 -35
- data/core/true_class.rbs +2 -2
- data/core/unbound_method.rbs +24 -16
- data/core/warning.rbs +7 -7
- data/docs/aliases.md +79 -0
- data/docs/collection.md +3 -3
- data/docs/config.md +171 -0
- data/docs/encoding.md +56 -0
- data/docs/gem.md +0 -1
- data/docs/inline.md +576 -0
- data/docs/sigs.md +3 -3
- data/docs/syntax.md +46 -16
- data/docs/type_fingerprint.md +21 -0
- data/exe/rbs +1 -1
- data/ext/rbs_extension/ast_translation.c +1513 -0
- data/ext/rbs_extension/ast_translation.h +37 -0
- data/ext/rbs_extension/class_constants.c +185 -0
- data/{include/rbs/constants.h → ext/rbs_extension/class_constants.h} +22 -1
- data/ext/rbs_extension/compat.h +10 -0
- data/ext/rbs_extension/extconf.rb +25 -1
- data/ext/rbs_extension/legacy_location.c +294 -0
- data/ext/rbs_extension/legacy_location.h +82 -0
- data/ext/rbs_extension/main.c +468 -24
- data/ext/rbs_extension/rbs_extension.h +6 -21
- data/ext/rbs_extension/rbs_string_bridging.c +9 -0
- data/ext/rbs_extension/rbs_string_bridging.h +24 -0
- data/include/rbs/ast.h +1022 -0
- data/include/rbs/defines.h +86 -0
- data/include/rbs/lexer.h +206 -0
- data/include/rbs/location.h +40 -0
- data/include/rbs/parser.h +153 -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 +6 -70
- data/include/rbs/util/rbs_encoding.h +282 -0
- data/include/rbs/util/rbs_unescape.h +24 -0
- data/include/rbs.h +9 -2
- data/lib/rbs/annotate/formatter.rb +3 -13
- data/lib/rbs/annotate/rdoc_annotator.rb +3 -1
- data/lib/rbs/annotate/rdoc_source.rb +1 -1
- data/lib/rbs/ast/annotation.rb +1 -1
- data/lib/rbs/ast/comment.rb +1 -1
- data/lib/rbs/ast/declarations.rb +10 -10
- data/lib/rbs/ast/members.rb +14 -14
- data/lib/rbs/ast/ruby/annotations.rb +409 -0
- data/lib/rbs/ast/ruby/comment_block.rb +245 -0
- data/lib/rbs/ast/ruby/declarations.rb +281 -0
- data/lib/rbs/ast/ruby/helpers/constant_helper.rb +28 -0
- data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
- data/lib/rbs/ast/ruby/members.rb +723 -0
- data/lib/rbs/ast/type_param.rb +24 -4
- data/lib/rbs/buffer.rb +105 -20
- data/lib/rbs/cli/diff.rb +16 -15
- data/lib/rbs/cli/validate.rb +63 -126
- data/lib/rbs/cli.rb +56 -24
- data/lib/rbs/collection/config/lockfile_generator.rb +14 -2
- data/lib/rbs/collection/sources/git.rb +1 -0
- data/lib/rbs/collection.rb +0 -1
- data/lib/rbs/definition.rb +6 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +121 -65
- data/lib/rbs/definition_builder/method_builder.rb +65 -30
- data/lib/rbs/definition_builder.rb +177 -20
- data/lib/rbs/diff.rb +7 -1
- data/lib/rbs/environment/class_entry.rb +69 -0
- data/lib/rbs/environment/module_entry.rb +66 -0
- data/lib/rbs/environment.rb +402 -214
- data/lib/rbs/environment_loader.rb +2 -8
- data/lib/rbs/errors.rb +31 -21
- data/lib/rbs/inline_parser/comment_association.rb +117 -0
- data/lib/rbs/inline_parser.rb +542 -0
- data/lib/rbs/location_aux.rb +36 -4
- data/lib/rbs/locator.rb +5 -1
- data/lib/rbs/method_type.rb +5 -3
- data/lib/rbs/namespace.rb +0 -7
- data/lib/rbs/parser_aux.rb +35 -7
- data/lib/rbs/prototype/helpers.rb +57 -0
- data/lib/rbs/prototype/rb.rb +3 -28
- data/lib/rbs/prototype/rbi.rb +3 -20
- data/lib/rbs/prototype/runtime.rb +10 -2
- data/lib/rbs/resolver/constant_resolver.rb +2 -2
- data/lib/rbs/resolver/type_name_resolver.rb +116 -38
- data/lib/rbs/source.rb +99 -0
- data/lib/rbs/subtractor.rb +7 -4
- data/lib/rbs/test/type_check.rb +19 -2
- data/lib/rbs/type_name.rb +1 -8
- data/lib/rbs/types.rb +91 -79
- data/lib/rbs/unit_test/convertibles.rb +1 -0
- data/lib/rbs/unit_test/type_assertions.rb +35 -8
- data/lib/rbs/validator.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +13 -2
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +3 -3
- data/rbs.gemspec +4 -2
- data/rust/.gitignore +1 -0
- data/rust/Cargo.lock +378 -0
- data/rust/Cargo.toml +7 -0
- data/rust/ruby-rbs/Cargo.toml +22 -0
- data/rust/ruby-rbs/build.rs +764 -0
- data/rust/ruby-rbs/examples/locations.rs +60 -0
- data/rust/ruby-rbs/src/lib.rs +1 -0
- data/rust/ruby-rbs/src/node/mod.rs +742 -0
- data/rust/ruby-rbs/tests/sanity.rs +47 -0
- data/rust/ruby-rbs/vendor/rbs/config.yml +1 -0
- data/rust/ruby-rbs-sys/Cargo.toml +23 -0
- data/rust/ruby-rbs-sys/build.rs +204 -0
- data/rust/ruby-rbs-sys/src/lib.rs +50 -0
- data/rust/ruby-rbs-sys/vendor/rbs/include +1 -0
- data/rust/ruby-rbs-sys/vendor/rbs/src +1 -0
- data/rust/ruby-rbs-sys/wrapper.h +1 -0
- data/schema/typeParam.json +17 -1
- data/sig/ancestor_builder.rbs +1 -1
- data/sig/annotate/formatter.rbs +2 -2
- data/sig/annotate/rdoc_annotater.rbs +1 -1
- data/sig/ast/ruby/annotations.rbs +421 -0
- data/sig/ast/ruby/comment_block.rbs +127 -0
- data/sig/ast/ruby/declarations.rbs +158 -0
- data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
- data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
- data/sig/ast/ruby/members.rbs +178 -0
- data/sig/buffer.rbs +63 -5
- data/sig/cli/diff.rbs +5 -11
- data/sig/cli/validate.rbs +12 -8
- data/sig/cli.rbs +18 -18
- data/sig/definition.rbs +6 -0
- data/sig/definition_builder.rbs +3 -1
- data/sig/environment/class_entry.rbs +50 -0
- data/sig/environment/module_entry.rbs +50 -0
- data/sig/environment.rbs +94 -87
- data/sig/errors.rbs +26 -20
- data/sig/inline_parser/comment_association.rbs +71 -0
- data/sig/inline_parser.rbs +124 -0
- data/sig/location.rbs +32 -7
- data/sig/locator.rbs +0 -2
- data/sig/manifest.yaml +0 -1
- data/sig/method_builder.rbs +9 -4
- data/sig/namespace.rbs +0 -5
- data/sig/parser.rbs +67 -13
- data/sig/prototype/helpers.rbs +2 -0
- data/sig/resolver/type_name_resolver.rbs +35 -7
- data/sig/source.rbs +48 -0
- data/sig/type_param.rbs +13 -8
- data/sig/typename.rbs +0 -5
- data/sig/types.rbs +10 -8
- data/sig/unit_test/spy.rbs +0 -8
- data/sig/unit_test/type_assertions.rbs +11 -0
- data/src/ast.c +1604 -0
- data/src/lexer.c +3194 -0
- data/src/lexer.re +154 -0
- data/src/lexstate.c +212 -0
- data/src/location.c +31 -0
- data/src/parser.c +4205 -0
- data/src/string.c +41 -0
- data/src/util/rbs_allocator.c +165 -0
- data/src/util/rbs_assert.c +19 -0
- data/src/util/rbs_buffer.c +54 -0
- data/src/util/rbs_constant_pool.c +18 -92
- data/src/util/rbs_encoding.c +21308 -0
- data/src/util/rbs_unescape.c +167 -0
- data/stdlib/bigdecimal/0/big_decimal.rbs +116 -98
- data/stdlib/bigdecimal-math/0/big_math.rbs +169 -8
- data/stdlib/cgi/0/core.rbs +9 -393
- data/stdlib/cgi/0/manifest.yaml +1 -0
- data/stdlib/cgi-escape/0/escape.rbs +171 -0
- data/stdlib/coverage/0/coverage.rbs +7 -4
- data/stdlib/date/0/date.rbs +92 -79
- data/stdlib/date/0/date_time.rbs +25 -24
- data/stdlib/delegate/0/delegator.rbs +10 -7
- data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
- data/stdlib/digest/0/digest.rbs +110 -0
- data/stdlib/erb/0/erb.rbs +748 -347
- data/stdlib/etc/0/etc.rbs +55 -50
- data/stdlib/fileutils/0/fileutils.rbs +158 -139
- data/stdlib/forwardable/0/forwardable.rbs +13 -10
- data/stdlib/io-console/0/io-console.rbs +2 -2
- data/stdlib/json/0/json.rbs +226 -179
- data/stdlib/monitor/0/monitor.rbs +3 -3
- data/stdlib/net-http/0/net-http.rbs +162 -134
- data/stdlib/objspace/0/objspace.rbs +17 -34
- data/stdlib/open-uri/0/open-uri.rbs +48 -8
- data/stdlib/open3/0/open3.rbs +469 -10
- data/stdlib/openssl/0/openssl.rbs +475 -357
- data/stdlib/optparse/0/optparse.rbs +26 -17
- data/stdlib/pathname/0/pathname.rbs +11 -1381
- data/stdlib/pp/0/pp.rbs +9 -8
- data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
- data/stdlib/pstore/0/pstore.rbs +35 -30
- data/stdlib/psych/0/psych.rbs +65 -12
- data/stdlib/psych/0/store.rbs +2 -4
- data/stdlib/pty/0/pty.rbs +9 -6
- data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
- data/stdlib/rdoc/0/code_object.rbs +4 -3
- data/stdlib/rdoc/0/comment.rbs +2 -0
- data/stdlib/rdoc/0/options.rbs +76 -0
- data/stdlib/rdoc/0/parser.rbs +1 -1
- data/stdlib/rdoc/0/rdoc.rbs +7 -5
- data/stdlib/rdoc/0/store.rbs +2 -2
- data/stdlib/resolv/0/resolv.rbs +25 -68
- data/stdlib/ripper/0/ripper.rbs +25 -19
- data/stdlib/securerandom/0/manifest.yaml +2 -0
- data/stdlib/securerandom/0/securerandom.rbs +7 -20
- data/stdlib/shellwords/0/shellwords.rbs +2 -2
- data/stdlib/singleton/0/singleton.rbs +3 -0
- data/stdlib/socket/0/addrinfo.rbs +9 -9
- data/stdlib/socket/0/basic_socket.rbs +3 -3
- data/stdlib/socket/0/ip_socket.rbs +10 -8
- data/stdlib/socket/0/socket.rbs +23 -10
- data/stdlib/socket/0/tcp_server.rbs +1 -1
- data/stdlib/socket/0/tcp_socket.rbs +11 -3
- data/stdlib/socket/0/udp_socket.rbs +1 -1
- data/stdlib/socket/0/unix_server.rbs +1 -1
- data/stdlib/stringio/0/stringio.rbs +1177 -85
- data/stdlib/strscan/0/string_scanner.rbs +27 -25
- data/stdlib/tempfile/0/tempfile.rbs +25 -21
- data/stdlib/time/0/time.rbs +8 -6
- data/stdlib/timeout/0/timeout.rbs +63 -7
- data/stdlib/tsort/0/cyclic.rbs +3 -0
- data/stdlib/tsort/0/tsort.rbs +7 -6
- data/stdlib/uri/0/common.rbs +42 -20
- data/stdlib/uri/0/file.rbs +3 -3
- data/stdlib/uri/0/generic.rbs +26 -18
- data/stdlib/uri/0/http.rbs +2 -2
- data/stdlib/uri/0/ldap.rbs +2 -2
- data/stdlib/uri/0/mailto.rbs +3 -3
- data/stdlib/uri/0/rfc2396_parser.rbs +12 -12
- data/stdlib/zlib/0/deflate.rbs +4 -3
- data/stdlib/zlib/0/gzip_reader.rbs +6 -6
- data/stdlib/zlib/0/gzip_writer.rbs +14 -12
- data/stdlib/zlib/0/inflate.rbs +1 -1
- data/stdlib/zlib/0/need_dict.rbs +1 -1
- data/stdlib/zlib/0/zstream.rbs +1 -0
- metadata +121 -18
- data/ext/rbs_extension/lexer.c +0 -2728
- data/ext/rbs_extension/lexer.h +0 -179
- data/ext/rbs_extension/lexer.re +0 -147
- data/ext/rbs_extension/lexstate.c +0 -175
- data/ext/rbs_extension/location.c +0 -325
- data/ext/rbs_extension/location.h +0 -85
- data/ext/rbs_extension/parser.c +0 -2982
- data/ext/rbs_extension/parser.h +0 -18
- data/ext/rbs_extension/parserstate.c +0 -411
- data/ext/rbs_extension/parserstate.h +0 -163
- data/ext/rbs_extension/unescape.c +0 -32
- data/include/rbs/ruby_objs.h +0 -72
- data/src/constants.c +0 -153
- data/src/ruby_objs.c +0 -799
data/src/ast.c
ADDED
|
@@ -0,0 +1,1604 @@
|
|
|
1
|
+
/*----------------------------------------------------------------------------*/
|
|
2
|
+
/* This file is generated by the templates/template.rb script and should not */
|
|
3
|
+
/* be modified manually. */
|
|
4
|
+
/* To change the template see */
|
|
5
|
+
/* templates/src/ast.c.erb */
|
|
6
|
+
/*----------------------------------------------------------------------------*/
|
|
7
|
+
|
|
8
|
+
#line 2 "prism/templates/src/ast.c.erb"
|
|
9
|
+
#include "rbs/ast.h"
|
|
10
|
+
|
|
11
|
+
#include <stdio.h>
|
|
12
|
+
#include <stdlib.h>
|
|
13
|
+
|
|
14
|
+
const char *rbs_node_type_name(rbs_node_t *node) {
|
|
15
|
+
switch (node->type) {
|
|
16
|
+
case RBS_AST_ANNOTATION:
|
|
17
|
+
return "RBS::AST::Annotation";
|
|
18
|
+
case RBS_AST_BOOL:
|
|
19
|
+
return "RBS::AST::Bool";
|
|
20
|
+
case RBS_AST_COMMENT:
|
|
21
|
+
return "RBS::AST::Comment";
|
|
22
|
+
case RBS_AST_DECLARATIONS_CLASS:
|
|
23
|
+
return "RBS::AST::Declarations::Class";
|
|
24
|
+
case RBS_AST_DECLARATIONS_CLASS_SUPER:
|
|
25
|
+
return "RBS::AST::Declarations::Class::Super";
|
|
26
|
+
case RBS_AST_DECLARATIONS_CLASS_ALIAS:
|
|
27
|
+
return "RBS::AST::Declarations::ClassAlias";
|
|
28
|
+
case RBS_AST_DECLARATIONS_CONSTANT:
|
|
29
|
+
return "RBS::AST::Declarations::Constant";
|
|
30
|
+
case RBS_AST_DECLARATIONS_GLOBAL:
|
|
31
|
+
return "RBS::AST::Declarations::Global";
|
|
32
|
+
case RBS_AST_DECLARATIONS_INTERFACE:
|
|
33
|
+
return "RBS::AST::Declarations::Interface";
|
|
34
|
+
case RBS_AST_DECLARATIONS_MODULE:
|
|
35
|
+
return "RBS::AST::Declarations::Module";
|
|
36
|
+
case RBS_AST_DECLARATIONS_MODULE_SELF:
|
|
37
|
+
return "RBS::AST::Declarations::Module::Self";
|
|
38
|
+
case RBS_AST_DECLARATIONS_MODULE_ALIAS:
|
|
39
|
+
return "RBS::AST::Declarations::ModuleAlias";
|
|
40
|
+
case RBS_AST_DECLARATIONS_TYPE_ALIAS:
|
|
41
|
+
return "RBS::AST::Declarations::TypeAlias";
|
|
42
|
+
case RBS_AST_DIRECTIVES_USE:
|
|
43
|
+
return "RBS::AST::Directives::Use";
|
|
44
|
+
case RBS_AST_DIRECTIVES_USE_SINGLE_CLAUSE:
|
|
45
|
+
return "RBS::AST::Directives::Use::SingleClause";
|
|
46
|
+
case RBS_AST_DIRECTIVES_USE_WILDCARD_CLAUSE:
|
|
47
|
+
return "RBS::AST::Directives::Use::WildcardClause";
|
|
48
|
+
case RBS_AST_INTEGER:
|
|
49
|
+
return "RBS::AST::Integer";
|
|
50
|
+
case RBS_AST_MEMBERS_ALIAS:
|
|
51
|
+
return "RBS::AST::Members::Alias";
|
|
52
|
+
case RBS_AST_MEMBERS_ATTR_ACCESSOR:
|
|
53
|
+
return "RBS::AST::Members::AttrAccessor";
|
|
54
|
+
case RBS_AST_MEMBERS_ATTR_READER:
|
|
55
|
+
return "RBS::AST::Members::AttrReader";
|
|
56
|
+
case RBS_AST_MEMBERS_ATTR_WRITER:
|
|
57
|
+
return "RBS::AST::Members::AttrWriter";
|
|
58
|
+
case RBS_AST_MEMBERS_CLASS_INSTANCE_VARIABLE:
|
|
59
|
+
return "RBS::AST::Members::ClassInstanceVariable";
|
|
60
|
+
case RBS_AST_MEMBERS_CLASS_VARIABLE:
|
|
61
|
+
return "RBS::AST::Members::ClassVariable";
|
|
62
|
+
case RBS_AST_MEMBERS_EXTEND:
|
|
63
|
+
return "RBS::AST::Members::Extend";
|
|
64
|
+
case RBS_AST_MEMBERS_INCLUDE:
|
|
65
|
+
return "RBS::AST::Members::Include";
|
|
66
|
+
case RBS_AST_MEMBERS_INSTANCE_VARIABLE:
|
|
67
|
+
return "RBS::AST::Members::InstanceVariable";
|
|
68
|
+
case RBS_AST_MEMBERS_METHOD_DEFINITION:
|
|
69
|
+
return "RBS::AST::Members::MethodDefinition";
|
|
70
|
+
case RBS_AST_MEMBERS_METHOD_DEFINITION_OVERLOAD:
|
|
71
|
+
return "RBS::AST::Members::MethodDefinition::Overload";
|
|
72
|
+
case RBS_AST_MEMBERS_PREPEND:
|
|
73
|
+
return "RBS::AST::Members::Prepend";
|
|
74
|
+
case RBS_AST_MEMBERS_PRIVATE:
|
|
75
|
+
return "RBS::AST::Members::Private";
|
|
76
|
+
case RBS_AST_MEMBERS_PUBLIC:
|
|
77
|
+
return "RBS::AST::Members::Public";
|
|
78
|
+
case RBS_AST_RUBY_ANNOTATIONS_BLOCK_PARAM_TYPE_ANNOTATION:
|
|
79
|
+
return "RBS::AST::Ruby::Annotations::BlockParamTypeAnnotation";
|
|
80
|
+
case RBS_AST_RUBY_ANNOTATIONS_CLASS_ALIAS_ANNOTATION:
|
|
81
|
+
return "RBS::AST::Ruby::Annotations::ClassAliasAnnotation";
|
|
82
|
+
case RBS_AST_RUBY_ANNOTATIONS_COLON_METHOD_TYPE_ANNOTATION:
|
|
83
|
+
return "RBS::AST::Ruby::Annotations::ColonMethodTypeAnnotation";
|
|
84
|
+
case RBS_AST_RUBY_ANNOTATIONS_DOUBLE_SPLAT_PARAM_TYPE_ANNOTATION:
|
|
85
|
+
return "RBS::AST::Ruby::Annotations::DoubleSplatParamTypeAnnotation";
|
|
86
|
+
case RBS_AST_RUBY_ANNOTATIONS_INSTANCE_VARIABLE_ANNOTATION:
|
|
87
|
+
return "RBS::AST::Ruby::Annotations::InstanceVariableAnnotation";
|
|
88
|
+
case RBS_AST_RUBY_ANNOTATIONS_METHOD_TYPES_ANNOTATION:
|
|
89
|
+
return "RBS::AST::Ruby::Annotations::MethodTypesAnnotation";
|
|
90
|
+
case RBS_AST_RUBY_ANNOTATIONS_MODULE_ALIAS_ANNOTATION:
|
|
91
|
+
return "RBS::AST::Ruby::Annotations::ModuleAliasAnnotation";
|
|
92
|
+
case RBS_AST_RUBY_ANNOTATIONS_NODE_TYPE_ASSERTION:
|
|
93
|
+
return "RBS::AST::Ruby::Annotations::NodeTypeAssertion";
|
|
94
|
+
case RBS_AST_RUBY_ANNOTATIONS_PARAM_TYPE_ANNOTATION:
|
|
95
|
+
return "RBS::AST::Ruby::Annotations::ParamTypeAnnotation";
|
|
96
|
+
case RBS_AST_RUBY_ANNOTATIONS_RETURN_TYPE_ANNOTATION:
|
|
97
|
+
return "RBS::AST::Ruby::Annotations::ReturnTypeAnnotation";
|
|
98
|
+
case RBS_AST_RUBY_ANNOTATIONS_SKIP_ANNOTATION:
|
|
99
|
+
return "RBS::AST::Ruby::Annotations::SkipAnnotation";
|
|
100
|
+
case RBS_AST_RUBY_ANNOTATIONS_SPLAT_PARAM_TYPE_ANNOTATION:
|
|
101
|
+
return "RBS::AST::Ruby::Annotations::SplatParamTypeAnnotation";
|
|
102
|
+
case RBS_AST_RUBY_ANNOTATIONS_TYPE_APPLICATION_ANNOTATION:
|
|
103
|
+
return "RBS::AST::Ruby::Annotations::TypeApplicationAnnotation";
|
|
104
|
+
case RBS_AST_STRING:
|
|
105
|
+
return "RBS::AST::String";
|
|
106
|
+
case RBS_AST_TYPE_PARAM:
|
|
107
|
+
return "RBS::AST::TypeParam";
|
|
108
|
+
case RBS_METHOD_TYPE:
|
|
109
|
+
return "RBS::MethodType";
|
|
110
|
+
case RBS_NAMESPACE:
|
|
111
|
+
return "RBS::Namespace";
|
|
112
|
+
case RBS_SIGNATURE:
|
|
113
|
+
return "RBS::Signature";
|
|
114
|
+
case RBS_TYPE_NAME:
|
|
115
|
+
return "RBS::TypeName";
|
|
116
|
+
case RBS_TYPES_ALIAS:
|
|
117
|
+
return "RBS::Types::Alias";
|
|
118
|
+
case RBS_TYPES_BASES_ANY:
|
|
119
|
+
return "RBS::Types::Bases::Any";
|
|
120
|
+
case RBS_TYPES_BASES_BOOL:
|
|
121
|
+
return "RBS::Types::Bases::Bool";
|
|
122
|
+
case RBS_TYPES_BASES_BOTTOM:
|
|
123
|
+
return "RBS::Types::Bases::Bottom";
|
|
124
|
+
case RBS_TYPES_BASES_CLASS:
|
|
125
|
+
return "RBS::Types::Bases::Class";
|
|
126
|
+
case RBS_TYPES_BASES_INSTANCE:
|
|
127
|
+
return "RBS::Types::Bases::Instance";
|
|
128
|
+
case RBS_TYPES_BASES_NIL:
|
|
129
|
+
return "RBS::Types::Bases::Nil";
|
|
130
|
+
case RBS_TYPES_BASES_SELF:
|
|
131
|
+
return "RBS::Types::Bases::Self";
|
|
132
|
+
case RBS_TYPES_BASES_TOP:
|
|
133
|
+
return "RBS::Types::Bases::Top";
|
|
134
|
+
case RBS_TYPES_BASES_VOID:
|
|
135
|
+
return "RBS::Types::Bases::Void";
|
|
136
|
+
case RBS_TYPES_BLOCK:
|
|
137
|
+
return "RBS::Types::Block";
|
|
138
|
+
case RBS_TYPES_CLASS_INSTANCE:
|
|
139
|
+
return "RBS::Types::ClassInstance";
|
|
140
|
+
case RBS_TYPES_CLASS_SINGLETON:
|
|
141
|
+
return "RBS::Types::ClassSingleton";
|
|
142
|
+
case RBS_TYPES_FUNCTION:
|
|
143
|
+
return "RBS::Types::Function";
|
|
144
|
+
case RBS_TYPES_FUNCTION_PARAM:
|
|
145
|
+
return "RBS::Types::Function::Param";
|
|
146
|
+
case RBS_TYPES_INTERFACE:
|
|
147
|
+
return "RBS::Types::Interface";
|
|
148
|
+
case RBS_TYPES_INTERSECTION:
|
|
149
|
+
return "RBS::Types::Intersection";
|
|
150
|
+
case RBS_TYPES_LITERAL:
|
|
151
|
+
return "RBS::Types::Literal";
|
|
152
|
+
case RBS_TYPES_OPTIONAL:
|
|
153
|
+
return "RBS::Types::Optional";
|
|
154
|
+
case RBS_TYPES_PROC:
|
|
155
|
+
return "RBS::Types::Proc";
|
|
156
|
+
case RBS_TYPES_RECORD:
|
|
157
|
+
return "RBS::Types::Record";
|
|
158
|
+
case RBS_TYPES_RECORD_FIELD_TYPE:
|
|
159
|
+
return "RBS::Types::Record::FieldType";
|
|
160
|
+
case RBS_TYPES_TUPLE:
|
|
161
|
+
return "RBS::Types::Tuple";
|
|
162
|
+
case RBS_TYPES_UNION:
|
|
163
|
+
return "RBS::Types::Union";
|
|
164
|
+
case RBS_TYPES_UNTYPED_FUNCTION:
|
|
165
|
+
return "RBS::Types::UntypedFunction";
|
|
166
|
+
case RBS_TYPES_VARIABLE:
|
|
167
|
+
return "RBS::Types::Variable";
|
|
168
|
+
case RBS_AST_SYMBOL:
|
|
169
|
+
return "Symbol";
|
|
170
|
+
default:
|
|
171
|
+
return "Unknown";
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/* rbs_node_list */
|
|
176
|
+
|
|
177
|
+
rbs_node_list_t *rbs_node_list_new(rbs_allocator_t *allocator) {
|
|
178
|
+
rbs_node_list_t *list = rbs_allocator_alloc(allocator, rbs_node_list_t);
|
|
179
|
+
*list = (rbs_node_list_t) {
|
|
180
|
+
.allocator = allocator,
|
|
181
|
+
.head = NULL,
|
|
182
|
+
.tail = NULL,
|
|
183
|
+
.length = 0,
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
return list;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
void rbs_node_list_append(rbs_node_list_t *list, rbs_node_t *node) {
|
|
190
|
+
rbs_node_list_node_t *new_node = rbs_allocator_alloc(list->allocator, rbs_node_list_node_t);
|
|
191
|
+
*new_node = (rbs_node_list_node_t) {
|
|
192
|
+
.node = node,
|
|
193
|
+
.next = NULL,
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
if (list->tail == NULL) {
|
|
197
|
+
list->head = new_node;
|
|
198
|
+
list->tail = new_node;
|
|
199
|
+
} else {
|
|
200
|
+
list->tail->next = new_node;
|
|
201
|
+
list->tail = new_node;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
list->length++;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* rbs_hash */
|
|
208
|
+
|
|
209
|
+
rbs_hash_t *rbs_hash_new(rbs_allocator_t *allocator) {
|
|
210
|
+
rbs_hash_t *hash = rbs_allocator_alloc(allocator, rbs_hash_t);
|
|
211
|
+
*hash = (rbs_hash_t) {
|
|
212
|
+
.allocator = allocator,
|
|
213
|
+
.head = NULL,
|
|
214
|
+
.tail = NULL,
|
|
215
|
+
.length = 0,
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
return hash;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
bool rbs_node_equal(rbs_node_t *lhs, rbs_node_t *rhs) {
|
|
222
|
+
if (lhs == rhs) return true;
|
|
223
|
+
if (lhs->type != rhs->type) return false;
|
|
224
|
+
|
|
225
|
+
switch (lhs->type) {
|
|
226
|
+
case RBS_AST_SYMBOL:
|
|
227
|
+
return ((rbs_ast_symbol_t *) lhs)->constant_id == ((rbs_ast_symbol_t *) rhs)->constant_id;
|
|
228
|
+
case RBS_AST_BOOL:
|
|
229
|
+
return ((rbs_ast_bool_t *) lhs)->value == ((rbs_ast_bool_t *) rhs)->value;
|
|
230
|
+
case RBS_AST_INTEGER:
|
|
231
|
+
return rbs_string_equal(((rbs_ast_integer_t *) lhs)->string_representation, ((rbs_ast_integer_t *) rhs)->string_representation);
|
|
232
|
+
case RBS_AST_STRING:
|
|
233
|
+
return rbs_string_equal(((rbs_ast_string_t *) lhs)->string, ((rbs_ast_string_t *) rhs)->string);
|
|
234
|
+
default:
|
|
235
|
+
printf("Unhandled node type: %d\n", lhs->type);
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
rbs_hash_node_t *rbs_hash_find(rbs_hash_t *hash, rbs_node_t *key) {
|
|
241
|
+
rbs_hash_node_t *current = hash->head;
|
|
242
|
+
|
|
243
|
+
while (current != NULL) {
|
|
244
|
+
if (rbs_node_equal(key, current->key)) {
|
|
245
|
+
return current;
|
|
246
|
+
}
|
|
247
|
+
current = current->next;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return NULL;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
void rbs_hash_set(rbs_hash_t *hash, rbs_node_t *key, rbs_node_t *value) {
|
|
254
|
+
rbs_hash_node_t *existing_node = rbs_hash_find(hash, key);
|
|
255
|
+
if (existing_node != NULL) {
|
|
256
|
+
existing_node->value = value;
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
rbs_hash_node_t *new_node = rbs_allocator_alloc(hash->allocator, rbs_hash_node_t);
|
|
261
|
+
new_node->key = key;
|
|
262
|
+
new_node->value = value;
|
|
263
|
+
new_node->next = NULL;
|
|
264
|
+
|
|
265
|
+
if (hash->tail == NULL) {
|
|
266
|
+
hash->head = new_node;
|
|
267
|
+
hash->tail = new_node;
|
|
268
|
+
} else {
|
|
269
|
+
hash->tail->next = new_node;
|
|
270
|
+
hash->tail = new_node;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
rbs_node_t *rbs_hash_get(rbs_hash_t *hash, rbs_node_t *key) {
|
|
275
|
+
rbs_hash_node_t *node = rbs_hash_find(hash, key);
|
|
276
|
+
return node ? node->value : NULL;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
rbs_ast_symbol_t *rbs_ast_symbol_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_constant_pool_t *constant_pool, rbs_constant_id_t constant_id) {
|
|
280
|
+
rbs_ast_symbol_t *instance = rbs_allocator_alloc(allocator, rbs_ast_symbol_t);
|
|
281
|
+
|
|
282
|
+
*instance = (rbs_ast_symbol_t) {
|
|
283
|
+
.base = (rbs_node_t) {
|
|
284
|
+
.type = RBS_AST_SYMBOL,
|
|
285
|
+
.location = location,
|
|
286
|
+
},
|
|
287
|
+
.constant_id = constant_id,
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
return instance;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
294
|
+
rbs_ast_annotation_t *rbs_ast_annotation_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_string_t string) {
|
|
295
|
+
rbs_ast_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_annotation_t);
|
|
296
|
+
|
|
297
|
+
*instance = (rbs_ast_annotation_t) {
|
|
298
|
+
.base = (rbs_node_t) {
|
|
299
|
+
.type = RBS_AST_ANNOTATION,
|
|
300
|
+
.location = location,
|
|
301
|
+
},
|
|
302
|
+
.string = string,
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
return instance;
|
|
306
|
+
}
|
|
307
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
308
|
+
rbs_ast_bool_t *rbs_ast_bool_new(rbs_allocator_t *allocator, rbs_location_range location, bool value) {
|
|
309
|
+
rbs_ast_bool_t *instance = rbs_allocator_alloc(allocator, rbs_ast_bool_t);
|
|
310
|
+
|
|
311
|
+
*instance = (rbs_ast_bool_t) {
|
|
312
|
+
.base = (rbs_node_t) {
|
|
313
|
+
.type = RBS_AST_BOOL,
|
|
314
|
+
.location = location,
|
|
315
|
+
},
|
|
316
|
+
.value = value,
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
return instance;
|
|
320
|
+
}
|
|
321
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
322
|
+
rbs_ast_comment_t *rbs_ast_comment_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_string_t string) {
|
|
323
|
+
rbs_ast_comment_t *instance = rbs_allocator_alloc(allocator, rbs_ast_comment_t);
|
|
324
|
+
|
|
325
|
+
*instance = (rbs_ast_comment_t) {
|
|
326
|
+
.base = (rbs_node_t) {
|
|
327
|
+
.type = RBS_AST_COMMENT,
|
|
328
|
+
.location = location,
|
|
329
|
+
},
|
|
330
|
+
.string = string,
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
return instance;
|
|
334
|
+
}
|
|
335
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
336
|
+
rbs_ast_declarations_class_t *rbs_ast_declarations_class_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_type_name_t *name, rbs_node_list_t *type_params, rbs_ast_declarations_class_super_t *super_class, rbs_node_list_t *members, rbs_node_list_t *annotations, rbs_ast_comment_t *comment, rbs_location_range keyword_range, rbs_location_range name_range, rbs_location_range end_range) {
|
|
337
|
+
rbs_ast_declarations_class_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_class_t);
|
|
338
|
+
|
|
339
|
+
*instance = (rbs_ast_declarations_class_t) {
|
|
340
|
+
.base = (rbs_node_t) {
|
|
341
|
+
.type = RBS_AST_DECLARATIONS_CLASS,
|
|
342
|
+
.location = location,
|
|
343
|
+
},
|
|
344
|
+
.name = name,
|
|
345
|
+
.type_params = type_params,
|
|
346
|
+
.super_class = super_class,
|
|
347
|
+
.members = members,
|
|
348
|
+
.annotations = annotations,
|
|
349
|
+
.comment = comment,
|
|
350
|
+
.keyword_range = keyword_range,
|
|
351
|
+
.name_range = name_range,
|
|
352
|
+
.end_range = end_range,
|
|
353
|
+
.type_params_range = RBS_LOCATION_NULL_RANGE,
|
|
354
|
+
.lt_range = RBS_LOCATION_NULL_RANGE,
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
return instance;
|
|
358
|
+
}
|
|
359
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
360
|
+
rbs_ast_declarations_class_super_t *rbs_ast_declarations_class_super_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_type_name_t *name, rbs_node_list_t *args, rbs_location_range name_range) {
|
|
361
|
+
rbs_ast_declarations_class_super_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_class_super_t);
|
|
362
|
+
|
|
363
|
+
*instance = (rbs_ast_declarations_class_super_t) {
|
|
364
|
+
.base = (rbs_node_t) {
|
|
365
|
+
.type = RBS_AST_DECLARATIONS_CLASS_SUPER,
|
|
366
|
+
.location = location,
|
|
367
|
+
},
|
|
368
|
+
.name = name,
|
|
369
|
+
.args = args,
|
|
370
|
+
.name_range = name_range,
|
|
371
|
+
.args_range = RBS_LOCATION_NULL_RANGE,
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
return instance;
|
|
375
|
+
}
|
|
376
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
377
|
+
rbs_ast_declarations_class_alias_t *rbs_ast_declarations_class_alias_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_type_name_t *new_name, rbs_type_name_t *old_name, rbs_ast_comment_t *comment, rbs_node_list_t *annotations, rbs_location_range keyword_range, rbs_location_range new_name_range, rbs_location_range eq_range, rbs_location_range old_name_range) {
|
|
378
|
+
rbs_ast_declarations_class_alias_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_class_alias_t);
|
|
379
|
+
|
|
380
|
+
*instance = (rbs_ast_declarations_class_alias_t) {
|
|
381
|
+
.base = (rbs_node_t) {
|
|
382
|
+
.type = RBS_AST_DECLARATIONS_CLASS_ALIAS,
|
|
383
|
+
.location = location,
|
|
384
|
+
},
|
|
385
|
+
.new_name = new_name,
|
|
386
|
+
.old_name = old_name,
|
|
387
|
+
.comment = comment,
|
|
388
|
+
.annotations = annotations,
|
|
389
|
+
.keyword_range = keyword_range,
|
|
390
|
+
.new_name_range = new_name_range,
|
|
391
|
+
.eq_range = eq_range,
|
|
392
|
+
.old_name_range = old_name_range,
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
return instance;
|
|
396
|
+
}
|
|
397
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
398
|
+
rbs_ast_declarations_constant_t *rbs_ast_declarations_constant_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_type_name_t *name, rbs_node_t *type, rbs_ast_comment_t *comment, rbs_node_list_t *annotations, rbs_location_range name_range, rbs_location_range colon_range) {
|
|
399
|
+
rbs_ast_declarations_constant_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_constant_t);
|
|
400
|
+
|
|
401
|
+
*instance = (rbs_ast_declarations_constant_t) {
|
|
402
|
+
.base = (rbs_node_t) {
|
|
403
|
+
.type = RBS_AST_DECLARATIONS_CONSTANT,
|
|
404
|
+
.location = location,
|
|
405
|
+
},
|
|
406
|
+
.name = name,
|
|
407
|
+
.type = type,
|
|
408
|
+
.comment = comment,
|
|
409
|
+
.annotations = annotations,
|
|
410
|
+
.name_range = name_range,
|
|
411
|
+
.colon_range = colon_range,
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
return instance;
|
|
415
|
+
}
|
|
416
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
417
|
+
rbs_ast_declarations_global_t *rbs_ast_declarations_global_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_ast_symbol_t *name, rbs_node_t *type, rbs_ast_comment_t *comment, rbs_node_list_t *annotations, rbs_location_range name_range, rbs_location_range colon_range) {
|
|
418
|
+
rbs_ast_declarations_global_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_global_t);
|
|
419
|
+
|
|
420
|
+
*instance = (rbs_ast_declarations_global_t) {
|
|
421
|
+
.base = (rbs_node_t) {
|
|
422
|
+
.type = RBS_AST_DECLARATIONS_GLOBAL,
|
|
423
|
+
.location = location,
|
|
424
|
+
},
|
|
425
|
+
.name = name,
|
|
426
|
+
.type = type,
|
|
427
|
+
.comment = comment,
|
|
428
|
+
.annotations = annotations,
|
|
429
|
+
.name_range = name_range,
|
|
430
|
+
.colon_range = colon_range,
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
return instance;
|
|
434
|
+
}
|
|
435
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
436
|
+
rbs_ast_declarations_interface_t *rbs_ast_declarations_interface_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_type_name_t *name, rbs_node_list_t *type_params, rbs_node_list_t *members, rbs_node_list_t *annotations, rbs_ast_comment_t *comment, rbs_location_range keyword_range, rbs_location_range name_range, rbs_location_range end_range) {
|
|
437
|
+
rbs_ast_declarations_interface_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_interface_t);
|
|
438
|
+
|
|
439
|
+
*instance = (rbs_ast_declarations_interface_t) {
|
|
440
|
+
.base = (rbs_node_t) {
|
|
441
|
+
.type = RBS_AST_DECLARATIONS_INTERFACE,
|
|
442
|
+
.location = location,
|
|
443
|
+
},
|
|
444
|
+
.name = name,
|
|
445
|
+
.type_params = type_params,
|
|
446
|
+
.members = members,
|
|
447
|
+
.annotations = annotations,
|
|
448
|
+
.comment = comment,
|
|
449
|
+
.keyword_range = keyword_range,
|
|
450
|
+
.name_range = name_range,
|
|
451
|
+
.end_range = end_range,
|
|
452
|
+
.type_params_range = RBS_LOCATION_NULL_RANGE,
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
return instance;
|
|
456
|
+
}
|
|
457
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
458
|
+
rbs_ast_declarations_module_t *rbs_ast_declarations_module_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_type_name_t *name, rbs_node_list_t *type_params, rbs_node_list_t *self_types, rbs_node_list_t *members, rbs_node_list_t *annotations, rbs_ast_comment_t *comment, rbs_location_range keyword_range, rbs_location_range name_range, rbs_location_range end_range) {
|
|
459
|
+
rbs_ast_declarations_module_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_module_t);
|
|
460
|
+
|
|
461
|
+
*instance = (rbs_ast_declarations_module_t) {
|
|
462
|
+
.base = (rbs_node_t) {
|
|
463
|
+
.type = RBS_AST_DECLARATIONS_MODULE,
|
|
464
|
+
.location = location,
|
|
465
|
+
},
|
|
466
|
+
.name = name,
|
|
467
|
+
.type_params = type_params,
|
|
468
|
+
.self_types = self_types,
|
|
469
|
+
.members = members,
|
|
470
|
+
.annotations = annotations,
|
|
471
|
+
.comment = comment,
|
|
472
|
+
.keyword_range = keyword_range,
|
|
473
|
+
.name_range = name_range,
|
|
474
|
+
.end_range = end_range,
|
|
475
|
+
.type_params_range = RBS_LOCATION_NULL_RANGE,
|
|
476
|
+
.colon_range = RBS_LOCATION_NULL_RANGE,
|
|
477
|
+
.self_types_range = RBS_LOCATION_NULL_RANGE,
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
return instance;
|
|
481
|
+
}
|
|
482
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
483
|
+
rbs_ast_declarations_module_self_t *rbs_ast_declarations_module_self_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_type_name_t *name, rbs_node_list_t *args, rbs_location_range name_range) {
|
|
484
|
+
rbs_ast_declarations_module_self_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_module_self_t);
|
|
485
|
+
|
|
486
|
+
*instance = (rbs_ast_declarations_module_self_t) {
|
|
487
|
+
.base = (rbs_node_t) {
|
|
488
|
+
.type = RBS_AST_DECLARATIONS_MODULE_SELF,
|
|
489
|
+
.location = location,
|
|
490
|
+
},
|
|
491
|
+
.name = name,
|
|
492
|
+
.args = args,
|
|
493
|
+
.name_range = name_range,
|
|
494
|
+
.args_range = RBS_LOCATION_NULL_RANGE,
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
return instance;
|
|
498
|
+
}
|
|
499
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
500
|
+
rbs_ast_declarations_module_alias_t *rbs_ast_declarations_module_alias_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_type_name_t *new_name, rbs_type_name_t *old_name, rbs_ast_comment_t *comment, rbs_node_list_t *annotations, rbs_location_range keyword_range, rbs_location_range new_name_range, rbs_location_range eq_range, rbs_location_range old_name_range) {
|
|
501
|
+
rbs_ast_declarations_module_alias_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_module_alias_t);
|
|
502
|
+
|
|
503
|
+
*instance = (rbs_ast_declarations_module_alias_t) {
|
|
504
|
+
.base = (rbs_node_t) {
|
|
505
|
+
.type = RBS_AST_DECLARATIONS_MODULE_ALIAS,
|
|
506
|
+
.location = location,
|
|
507
|
+
},
|
|
508
|
+
.new_name = new_name,
|
|
509
|
+
.old_name = old_name,
|
|
510
|
+
.comment = comment,
|
|
511
|
+
.annotations = annotations,
|
|
512
|
+
.keyword_range = keyword_range,
|
|
513
|
+
.new_name_range = new_name_range,
|
|
514
|
+
.eq_range = eq_range,
|
|
515
|
+
.old_name_range = old_name_range,
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
return instance;
|
|
519
|
+
}
|
|
520
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
521
|
+
rbs_ast_declarations_type_alias_t *rbs_ast_declarations_type_alias_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_type_name_t *name, rbs_node_list_t *type_params, rbs_node_t *type, rbs_node_list_t *annotations, rbs_ast_comment_t *comment, rbs_location_range keyword_range, rbs_location_range name_range, rbs_location_range eq_range) {
|
|
522
|
+
rbs_ast_declarations_type_alias_t *instance = rbs_allocator_alloc(allocator, rbs_ast_declarations_type_alias_t);
|
|
523
|
+
|
|
524
|
+
*instance = (rbs_ast_declarations_type_alias_t) {
|
|
525
|
+
.base = (rbs_node_t) {
|
|
526
|
+
.type = RBS_AST_DECLARATIONS_TYPE_ALIAS,
|
|
527
|
+
.location = location,
|
|
528
|
+
},
|
|
529
|
+
.name = name,
|
|
530
|
+
.type_params = type_params,
|
|
531
|
+
.type = type,
|
|
532
|
+
.annotations = annotations,
|
|
533
|
+
.comment = comment,
|
|
534
|
+
.keyword_range = keyword_range,
|
|
535
|
+
.name_range = name_range,
|
|
536
|
+
.eq_range = eq_range,
|
|
537
|
+
.type_params_range = RBS_LOCATION_NULL_RANGE,
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
return instance;
|
|
541
|
+
}
|
|
542
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
543
|
+
rbs_ast_directives_use_t *rbs_ast_directives_use_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_node_list_t *clauses, rbs_location_range keyword_range) {
|
|
544
|
+
rbs_ast_directives_use_t *instance = rbs_allocator_alloc(allocator, rbs_ast_directives_use_t);
|
|
545
|
+
|
|
546
|
+
*instance = (rbs_ast_directives_use_t) {
|
|
547
|
+
.base = (rbs_node_t) {
|
|
548
|
+
.type = RBS_AST_DIRECTIVES_USE,
|
|
549
|
+
.location = location,
|
|
550
|
+
},
|
|
551
|
+
.clauses = clauses,
|
|
552
|
+
.keyword_range = keyword_range,
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
return instance;
|
|
556
|
+
}
|
|
557
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
558
|
+
rbs_ast_directives_use_single_clause_t *rbs_ast_directives_use_single_clause_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_type_name_t *type_name, rbs_ast_symbol_t *new_name, rbs_location_range type_name_range) {
|
|
559
|
+
rbs_ast_directives_use_single_clause_t *instance = rbs_allocator_alloc(allocator, rbs_ast_directives_use_single_clause_t);
|
|
560
|
+
|
|
561
|
+
*instance = (rbs_ast_directives_use_single_clause_t) {
|
|
562
|
+
.base = (rbs_node_t) {
|
|
563
|
+
.type = RBS_AST_DIRECTIVES_USE_SINGLE_CLAUSE,
|
|
564
|
+
.location = location,
|
|
565
|
+
},
|
|
566
|
+
.type_name = type_name,
|
|
567
|
+
.new_name = new_name,
|
|
568
|
+
.type_name_range = type_name_range,
|
|
569
|
+
.keyword_range = RBS_LOCATION_NULL_RANGE,
|
|
570
|
+
.new_name_range = RBS_LOCATION_NULL_RANGE,
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
return instance;
|
|
574
|
+
}
|
|
575
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
576
|
+
rbs_ast_directives_use_wildcard_clause_t *rbs_ast_directives_use_wildcard_clause_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_namespace_t *rbs_namespace, rbs_location_range namespace_range, rbs_location_range star_range) {
|
|
577
|
+
rbs_ast_directives_use_wildcard_clause_t *instance = rbs_allocator_alloc(allocator, rbs_ast_directives_use_wildcard_clause_t);
|
|
578
|
+
|
|
579
|
+
*instance = (rbs_ast_directives_use_wildcard_clause_t) {
|
|
580
|
+
.base = (rbs_node_t) {
|
|
581
|
+
.type = RBS_AST_DIRECTIVES_USE_WILDCARD_CLAUSE,
|
|
582
|
+
.location = location,
|
|
583
|
+
},
|
|
584
|
+
.rbs_namespace = rbs_namespace,
|
|
585
|
+
.namespace_range = namespace_range,
|
|
586
|
+
.star_range = star_range,
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
return instance;
|
|
590
|
+
}
|
|
591
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
592
|
+
rbs_ast_integer_t *rbs_ast_integer_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_string_t string_representation) {
|
|
593
|
+
rbs_ast_integer_t *instance = rbs_allocator_alloc(allocator, rbs_ast_integer_t);
|
|
594
|
+
|
|
595
|
+
*instance = (rbs_ast_integer_t) {
|
|
596
|
+
.base = (rbs_node_t) {
|
|
597
|
+
.type = RBS_AST_INTEGER,
|
|
598
|
+
.location = location,
|
|
599
|
+
},
|
|
600
|
+
.string_representation = string_representation,
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
return instance;
|
|
604
|
+
}
|
|
605
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
606
|
+
rbs_ast_members_alias_t *rbs_ast_members_alias_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_ast_symbol_t *new_name, rbs_ast_symbol_t *old_name, enum rbs_alias_kind kind, rbs_node_list_t *annotations, rbs_ast_comment_t *comment, rbs_location_range keyword_range, rbs_location_range new_name_range, rbs_location_range old_name_range) {
|
|
607
|
+
rbs_ast_members_alias_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_alias_t);
|
|
608
|
+
|
|
609
|
+
*instance = (rbs_ast_members_alias_t) {
|
|
610
|
+
.base = (rbs_node_t) {
|
|
611
|
+
.type = RBS_AST_MEMBERS_ALIAS,
|
|
612
|
+
.location = location,
|
|
613
|
+
},
|
|
614
|
+
.new_name = new_name,
|
|
615
|
+
.old_name = old_name,
|
|
616
|
+
.kind = kind,
|
|
617
|
+
.annotations = annotations,
|
|
618
|
+
.comment = comment,
|
|
619
|
+
.keyword_range = keyword_range,
|
|
620
|
+
.new_name_range = new_name_range,
|
|
621
|
+
.old_name_range = old_name_range,
|
|
622
|
+
.new_kind_range = RBS_LOCATION_NULL_RANGE,
|
|
623
|
+
.old_kind_range = RBS_LOCATION_NULL_RANGE,
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
return instance;
|
|
627
|
+
}
|
|
628
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
629
|
+
rbs_ast_members_attr_accessor_t *rbs_ast_members_attr_accessor_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_ast_symbol_t *name, rbs_node_t *type, rbs_attr_ivar_name_t ivar_name, enum rbs_attribute_kind kind, rbs_node_list_t *annotations, rbs_ast_comment_t *comment, enum rbs_attribute_visibility visibility, rbs_location_range keyword_range, rbs_location_range name_range, rbs_location_range colon_range) {
|
|
630
|
+
rbs_ast_members_attr_accessor_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_attr_accessor_t);
|
|
631
|
+
|
|
632
|
+
*instance = (rbs_ast_members_attr_accessor_t) {
|
|
633
|
+
.base = (rbs_node_t) {
|
|
634
|
+
.type = RBS_AST_MEMBERS_ATTR_ACCESSOR,
|
|
635
|
+
.location = location,
|
|
636
|
+
},
|
|
637
|
+
.name = name,
|
|
638
|
+
.type = type,
|
|
639
|
+
.ivar_name = ivar_name,
|
|
640
|
+
.kind = kind,
|
|
641
|
+
.annotations = annotations,
|
|
642
|
+
.comment = comment,
|
|
643
|
+
.visibility = visibility,
|
|
644
|
+
.keyword_range = keyword_range,
|
|
645
|
+
.name_range = name_range,
|
|
646
|
+
.colon_range = colon_range,
|
|
647
|
+
.kind_range = RBS_LOCATION_NULL_RANGE,
|
|
648
|
+
.ivar_range = RBS_LOCATION_NULL_RANGE,
|
|
649
|
+
.ivar_name_range = RBS_LOCATION_NULL_RANGE,
|
|
650
|
+
.visibility_range = RBS_LOCATION_NULL_RANGE,
|
|
651
|
+
};
|
|
652
|
+
|
|
653
|
+
return instance;
|
|
654
|
+
}
|
|
655
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
656
|
+
rbs_ast_members_attr_reader_t *rbs_ast_members_attr_reader_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_ast_symbol_t *name, rbs_node_t *type, rbs_attr_ivar_name_t ivar_name, enum rbs_attribute_kind kind, rbs_node_list_t *annotations, rbs_ast_comment_t *comment, enum rbs_attribute_visibility visibility, rbs_location_range keyword_range, rbs_location_range name_range, rbs_location_range colon_range) {
|
|
657
|
+
rbs_ast_members_attr_reader_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_attr_reader_t);
|
|
658
|
+
|
|
659
|
+
*instance = (rbs_ast_members_attr_reader_t) {
|
|
660
|
+
.base = (rbs_node_t) {
|
|
661
|
+
.type = RBS_AST_MEMBERS_ATTR_READER,
|
|
662
|
+
.location = location,
|
|
663
|
+
},
|
|
664
|
+
.name = name,
|
|
665
|
+
.type = type,
|
|
666
|
+
.ivar_name = ivar_name,
|
|
667
|
+
.kind = kind,
|
|
668
|
+
.annotations = annotations,
|
|
669
|
+
.comment = comment,
|
|
670
|
+
.visibility = visibility,
|
|
671
|
+
.keyword_range = keyword_range,
|
|
672
|
+
.name_range = name_range,
|
|
673
|
+
.colon_range = colon_range,
|
|
674
|
+
.kind_range = RBS_LOCATION_NULL_RANGE,
|
|
675
|
+
.ivar_range = RBS_LOCATION_NULL_RANGE,
|
|
676
|
+
.ivar_name_range = RBS_LOCATION_NULL_RANGE,
|
|
677
|
+
.visibility_range = RBS_LOCATION_NULL_RANGE,
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
return instance;
|
|
681
|
+
}
|
|
682
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
683
|
+
rbs_ast_members_attr_writer_t *rbs_ast_members_attr_writer_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_ast_symbol_t *name, rbs_node_t *type, rbs_attr_ivar_name_t ivar_name, enum rbs_attribute_kind kind, rbs_node_list_t *annotations, rbs_ast_comment_t *comment, enum rbs_attribute_visibility visibility, rbs_location_range keyword_range, rbs_location_range name_range, rbs_location_range colon_range) {
|
|
684
|
+
rbs_ast_members_attr_writer_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_attr_writer_t);
|
|
685
|
+
|
|
686
|
+
*instance = (rbs_ast_members_attr_writer_t) {
|
|
687
|
+
.base = (rbs_node_t) {
|
|
688
|
+
.type = RBS_AST_MEMBERS_ATTR_WRITER,
|
|
689
|
+
.location = location,
|
|
690
|
+
},
|
|
691
|
+
.name = name,
|
|
692
|
+
.type = type,
|
|
693
|
+
.ivar_name = ivar_name,
|
|
694
|
+
.kind = kind,
|
|
695
|
+
.annotations = annotations,
|
|
696
|
+
.comment = comment,
|
|
697
|
+
.visibility = visibility,
|
|
698
|
+
.keyword_range = keyword_range,
|
|
699
|
+
.name_range = name_range,
|
|
700
|
+
.colon_range = colon_range,
|
|
701
|
+
.kind_range = RBS_LOCATION_NULL_RANGE,
|
|
702
|
+
.ivar_range = RBS_LOCATION_NULL_RANGE,
|
|
703
|
+
.ivar_name_range = RBS_LOCATION_NULL_RANGE,
|
|
704
|
+
.visibility_range = RBS_LOCATION_NULL_RANGE,
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
return instance;
|
|
708
|
+
}
|
|
709
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
710
|
+
rbs_ast_members_class_instance_variable_t *rbs_ast_members_class_instance_variable_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_ast_symbol_t *name, rbs_node_t *type, rbs_ast_comment_t *comment, rbs_location_range name_range, rbs_location_range colon_range) {
|
|
711
|
+
rbs_ast_members_class_instance_variable_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_class_instance_variable_t);
|
|
712
|
+
|
|
713
|
+
*instance = (rbs_ast_members_class_instance_variable_t) {
|
|
714
|
+
.base = (rbs_node_t) {
|
|
715
|
+
.type = RBS_AST_MEMBERS_CLASS_INSTANCE_VARIABLE,
|
|
716
|
+
.location = location,
|
|
717
|
+
},
|
|
718
|
+
.name = name,
|
|
719
|
+
.type = type,
|
|
720
|
+
.comment = comment,
|
|
721
|
+
.name_range = name_range,
|
|
722
|
+
.colon_range = colon_range,
|
|
723
|
+
.kind_range = RBS_LOCATION_NULL_RANGE,
|
|
724
|
+
};
|
|
725
|
+
|
|
726
|
+
return instance;
|
|
727
|
+
}
|
|
728
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
729
|
+
rbs_ast_members_class_variable_t *rbs_ast_members_class_variable_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_ast_symbol_t *name, rbs_node_t *type, rbs_ast_comment_t *comment, rbs_location_range name_range, rbs_location_range colon_range) {
|
|
730
|
+
rbs_ast_members_class_variable_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_class_variable_t);
|
|
731
|
+
|
|
732
|
+
*instance = (rbs_ast_members_class_variable_t) {
|
|
733
|
+
.base = (rbs_node_t) {
|
|
734
|
+
.type = RBS_AST_MEMBERS_CLASS_VARIABLE,
|
|
735
|
+
.location = location,
|
|
736
|
+
},
|
|
737
|
+
.name = name,
|
|
738
|
+
.type = type,
|
|
739
|
+
.comment = comment,
|
|
740
|
+
.name_range = name_range,
|
|
741
|
+
.colon_range = colon_range,
|
|
742
|
+
.kind_range = RBS_LOCATION_NULL_RANGE,
|
|
743
|
+
};
|
|
744
|
+
|
|
745
|
+
return instance;
|
|
746
|
+
}
|
|
747
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
748
|
+
rbs_ast_members_extend_t *rbs_ast_members_extend_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_type_name_t *name, rbs_node_list_t *args, rbs_node_list_t *annotations, rbs_ast_comment_t *comment, rbs_location_range name_range, rbs_location_range keyword_range) {
|
|
749
|
+
rbs_ast_members_extend_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_extend_t);
|
|
750
|
+
|
|
751
|
+
*instance = (rbs_ast_members_extend_t) {
|
|
752
|
+
.base = (rbs_node_t) {
|
|
753
|
+
.type = RBS_AST_MEMBERS_EXTEND,
|
|
754
|
+
.location = location,
|
|
755
|
+
},
|
|
756
|
+
.name = name,
|
|
757
|
+
.args = args,
|
|
758
|
+
.annotations = annotations,
|
|
759
|
+
.comment = comment,
|
|
760
|
+
.name_range = name_range,
|
|
761
|
+
.keyword_range = keyword_range,
|
|
762
|
+
.args_range = RBS_LOCATION_NULL_RANGE,
|
|
763
|
+
};
|
|
764
|
+
|
|
765
|
+
return instance;
|
|
766
|
+
}
|
|
767
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
768
|
+
rbs_ast_members_include_t *rbs_ast_members_include_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_type_name_t *name, rbs_node_list_t *args, rbs_node_list_t *annotations, rbs_ast_comment_t *comment, rbs_location_range name_range, rbs_location_range keyword_range) {
|
|
769
|
+
rbs_ast_members_include_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_include_t);
|
|
770
|
+
|
|
771
|
+
*instance = (rbs_ast_members_include_t) {
|
|
772
|
+
.base = (rbs_node_t) {
|
|
773
|
+
.type = RBS_AST_MEMBERS_INCLUDE,
|
|
774
|
+
.location = location,
|
|
775
|
+
},
|
|
776
|
+
.name = name,
|
|
777
|
+
.args = args,
|
|
778
|
+
.annotations = annotations,
|
|
779
|
+
.comment = comment,
|
|
780
|
+
.name_range = name_range,
|
|
781
|
+
.keyword_range = keyword_range,
|
|
782
|
+
.args_range = RBS_LOCATION_NULL_RANGE,
|
|
783
|
+
};
|
|
784
|
+
|
|
785
|
+
return instance;
|
|
786
|
+
}
|
|
787
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
788
|
+
rbs_ast_members_instance_variable_t *rbs_ast_members_instance_variable_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_ast_symbol_t *name, rbs_node_t *type, rbs_ast_comment_t *comment, rbs_location_range name_range, rbs_location_range colon_range) {
|
|
789
|
+
rbs_ast_members_instance_variable_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_instance_variable_t);
|
|
790
|
+
|
|
791
|
+
*instance = (rbs_ast_members_instance_variable_t) {
|
|
792
|
+
.base = (rbs_node_t) {
|
|
793
|
+
.type = RBS_AST_MEMBERS_INSTANCE_VARIABLE,
|
|
794
|
+
.location = location,
|
|
795
|
+
},
|
|
796
|
+
.name = name,
|
|
797
|
+
.type = type,
|
|
798
|
+
.comment = comment,
|
|
799
|
+
.name_range = name_range,
|
|
800
|
+
.colon_range = colon_range,
|
|
801
|
+
.kind_range = RBS_LOCATION_NULL_RANGE,
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
return instance;
|
|
805
|
+
}
|
|
806
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
807
|
+
rbs_ast_members_method_definition_t *rbs_ast_members_method_definition_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_ast_symbol_t *name, enum rbs_method_definition_kind kind, rbs_node_list_t *overloads, rbs_node_list_t *annotations, rbs_ast_comment_t *comment, bool overloading, enum rbs_method_definition_visibility visibility, rbs_location_range keyword_range, rbs_location_range name_range) {
|
|
808
|
+
rbs_ast_members_method_definition_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_method_definition_t);
|
|
809
|
+
|
|
810
|
+
*instance = (rbs_ast_members_method_definition_t) {
|
|
811
|
+
.base = (rbs_node_t) {
|
|
812
|
+
.type = RBS_AST_MEMBERS_METHOD_DEFINITION,
|
|
813
|
+
.location = location,
|
|
814
|
+
},
|
|
815
|
+
.name = name,
|
|
816
|
+
.kind = kind,
|
|
817
|
+
.overloads = overloads,
|
|
818
|
+
.annotations = annotations,
|
|
819
|
+
.comment = comment,
|
|
820
|
+
.overloading = overloading,
|
|
821
|
+
.visibility = visibility,
|
|
822
|
+
.keyword_range = keyword_range,
|
|
823
|
+
.name_range = name_range,
|
|
824
|
+
.kind_range = RBS_LOCATION_NULL_RANGE,
|
|
825
|
+
.overloading_range = RBS_LOCATION_NULL_RANGE,
|
|
826
|
+
.visibility_range = RBS_LOCATION_NULL_RANGE,
|
|
827
|
+
};
|
|
828
|
+
|
|
829
|
+
return instance;
|
|
830
|
+
}
|
|
831
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
832
|
+
rbs_ast_members_method_definition_overload_t *rbs_ast_members_method_definition_overload_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_node_list_t *annotations, rbs_node_t *method_type) {
|
|
833
|
+
rbs_ast_members_method_definition_overload_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_method_definition_overload_t);
|
|
834
|
+
|
|
835
|
+
*instance = (rbs_ast_members_method_definition_overload_t) {
|
|
836
|
+
.base = (rbs_node_t) {
|
|
837
|
+
.type = RBS_AST_MEMBERS_METHOD_DEFINITION_OVERLOAD,
|
|
838
|
+
.location = location,
|
|
839
|
+
},
|
|
840
|
+
.annotations = annotations,
|
|
841
|
+
.method_type = method_type,
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
return instance;
|
|
845
|
+
}
|
|
846
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
847
|
+
rbs_ast_members_prepend_t *rbs_ast_members_prepend_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_type_name_t *name, rbs_node_list_t *args, rbs_node_list_t *annotations, rbs_ast_comment_t *comment, rbs_location_range name_range, rbs_location_range keyword_range) {
|
|
848
|
+
rbs_ast_members_prepend_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_prepend_t);
|
|
849
|
+
|
|
850
|
+
*instance = (rbs_ast_members_prepend_t) {
|
|
851
|
+
.base = (rbs_node_t) {
|
|
852
|
+
.type = RBS_AST_MEMBERS_PREPEND,
|
|
853
|
+
.location = location,
|
|
854
|
+
},
|
|
855
|
+
.name = name,
|
|
856
|
+
.args = args,
|
|
857
|
+
.annotations = annotations,
|
|
858
|
+
.comment = comment,
|
|
859
|
+
.name_range = name_range,
|
|
860
|
+
.keyword_range = keyword_range,
|
|
861
|
+
.args_range = RBS_LOCATION_NULL_RANGE,
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
return instance;
|
|
865
|
+
}
|
|
866
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
867
|
+
rbs_ast_members_private_t *rbs_ast_members_private_new(rbs_allocator_t *allocator, rbs_location_range location) {
|
|
868
|
+
rbs_ast_members_private_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_private_t);
|
|
869
|
+
|
|
870
|
+
*instance = (rbs_ast_members_private_t) {
|
|
871
|
+
.base = (rbs_node_t) {
|
|
872
|
+
.type = RBS_AST_MEMBERS_PRIVATE,
|
|
873
|
+
.location = location,
|
|
874
|
+
},
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
return instance;
|
|
878
|
+
}
|
|
879
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
880
|
+
rbs_ast_members_public_t *rbs_ast_members_public_new(rbs_allocator_t *allocator, rbs_location_range location) {
|
|
881
|
+
rbs_ast_members_public_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_public_t);
|
|
882
|
+
|
|
883
|
+
*instance = (rbs_ast_members_public_t) {
|
|
884
|
+
.base = (rbs_node_t) {
|
|
885
|
+
.type = RBS_AST_MEMBERS_PUBLIC,
|
|
886
|
+
.location = location,
|
|
887
|
+
},
|
|
888
|
+
};
|
|
889
|
+
|
|
890
|
+
return instance;
|
|
891
|
+
}
|
|
892
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
893
|
+
rbs_ast_ruby_annotations_block_param_type_annotation_t *rbs_ast_ruby_annotations_block_param_type_annotation_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_location_range prefix_location, rbs_location_range ampersand_location, rbs_location_range name_location, rbs_location_range colon_location, rbs_location_range question_location, rbs_location_range type_location, rbs_node_t *type_, rbs_location_range comment_location) {
|
|
894
|
+
rbs_ast_ruby_annotations_block_param_type_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_block_param_type_annotation_t);
|
|
895
|
+
|
|
896
|
+
*instance = (rbs_ast_ruby_annotations_block_param_type_annotation_t) {
|
|
897
|
+
.base = (rbs_node_t) {
|
|
898
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_BLOCK_PARAM_TYPE_ANNOTATION,
|
|
899
|
+
.location = location,
|
|
900
|
+
},
|
|
901
|
+
.prefix_location = prefix_location,
|
|
902
|
+
.ampersand_location = ampersand_location,
|
|
903
|
+
.name_location = name_location,
|
|
904
|
+
.colon_location = colon_location,
|
|
905
|
+
.question_location = question_location,
|
|
906
|
+
.type_location = type_location,
|
|
907
|
+
.type_ = type_,
|
|
908
|
+
.comment_location = comment_location,
|
|
909
|
+
};
|
|
910
|
+
|
|
911
|
+
return instance;
|
|
912
|
+
}
|
|
913
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
914
|
+
rbs_ast_ruby_annotations_class_alias_annotation_t *rbs_ast_ruby_annotations_class_alias_annotation_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_location_range prefix_location, rbs_location_range keyword_location, rbs_type_name_t *type_name, rbs_location_range type_name_location) {
|
|
915
|
+
rbs_ast_ruby_annotations_class_alias_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_class_alias_annotation_t);
|
|
916
|
+
|
|
917
|
+
*instance = (rbs_ast_ruby_annotations_class_alias_annotation_t) {
|
|
918
|
+
.base = (rbs_node_t) {
|
|
919
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_CLASS_ALIAS_ANNOTATION,
|
|
920
|
+
.location = location,
|
|
921
|
+
},
|
|
922
|
+
.prefix_location = prefix_location,
|
|
923
|
+
.keyword_location = keyword_location,
|
|
924
|
+
.type_name = type_name,
|
|
925
|
+
.type_name_location = type_name_location,
|
|
926
|
+
};
|
|
927
|
+
|
|
928
|
+
return instance;
|
|
929
|
+
}
|
|
930
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
931
|
+
rbs_ast_ruby_annotations_colon_method_type_annotation_t *rbs_ast_ruby_annotations_colon_method_type_annotation_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_location_range prefix_location, rbs_node_list_t *annotations, rbs_node_t *method_type) {
|
|
932
|
+
rbs_ast_ruby_annotations_colon_method_type_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_colon_method_type_annotation_t);
|
|
933
|
+
|
|
934
|
+
*instance = (rbs_ast_ruby_annotations_colon_method_type_annotation_t) {
|
|
935
|
+
.base = (rbs_node_t) {
|
|
936
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_COLON_METHOD_TYPE_ANNOTATION,
|
|
937
|
+
.location = location,
|
|
938
|
+
},
|
|
939
|
+
.prefix_location = prefix_location,
|
|
940
|
+
.annotations = annotations,
|
|
941
|
+
.method_type = method_type,
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
return instance;
|
|
945
|
+
}
|
|
946
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
947
|
+
rbs_ast_ruby_annotations_double_splat_param_type_annotation_t *rbs_ast_ruby_annotations_double_splat_param_type_annotation_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_location_range prefix_location, rbs_location_range star2_location, rbs_location_range name_location, rbs_location_range colon_location, rbs_node_t *param_type, rbs_location_range comment_location) {
|
|
948
|
+
rbs_ast_ruby_annotations_double_splat_param_type_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_double_splat_param_type_annotation_t);
|
|
949
|
+
|
|
950
|
+
*instance = (rbs_ast_ruby_annotations_double_splat_param_type_annotation_t) {
|
|
951
|
+
.base = (rbs_node_t) {
|
|
952
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_DOUBLE_SPLAT_PARAM_TYPE_ANNOTATION,
|
|
953
|
+
.location = location,
|
|
954
|
+
},
|
|
955
|
+
.prefix_location = prefix_location,
|
|
956
|
+
.star2_location = star2_location,
|
|
957
|
+
.name_location = name_location,
|
|
958
|
+
.colon_location = colon_location,
|
|
959
|
+
.param_type = param_type,
|
|
960
|
+
.comment_location = comment_location,
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
return instance;
|
|
964
|
+
}
|
|
965
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
966
|
+
rbs_ast_ruby_annotations_instance_variable_annotation_t *rbs_ast_ruby_annotations_instance_variable_annotation_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_location_range prefix_location, rbs_ast_symbol_t *ivar_name, rbs_location_range ivar_name_location, rbs_location_range colon_location, rbs_node_t *type, rbs_location_range comment_location) {
|
|
967
|
+
rbs_ast_ruby_annotations_instance_variable_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_instance_variable_annotation_t);
|
|
968
|
+
|
|
969
|
+
*instance = (rbs_ast_ruby_annotations_instance_variable_annotation_t) {
|
|
970
|
+
.base = (rbs_node_t) {
|
|
971
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_INSTANCE_VARIABLE_ANNOTATION,
|
|
972
|
+
.location = location,
|
|
973
|
+
},
|
|
974
|
+
.prefix_location = prefix_location,
|
|
975
|
+
.ivar_name = ivar_name,
|
|
976
|
+
.ivar_name_location = ivar_name_location,
|
|
977
|
+
.colon_location = colon_location,
|
|
978
|
+
.type = type,
|
|
979
|
+
.comment_location = comment_location,
|
|
980
|
+
};
|
|
981
|
+
|
|
982
|
+
return instance;
|
|
983
|
+
}
|
|
984
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
985
|
+
rbs_ast_ruby_annotations_method_types_annotation_t *rbs_ast_ruby_annotations_method_types_annotation_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_location_range prefix_location, rbs_node_list_t *overloads, rbs_location_range_list_t *vertical_bar_locations, rbs_location_range dot3_location) {
|
|
986
|
+
rbs_ast_ruby_annotations_method_types_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_method_types_annotation_t);
|
|
987
|
+
|
|
988
|
+
*instance = (rbs_ast_ruby_annotations_method_types_annotation_t) {
|
|
989
|
+
.base = (rbs_node_t) {
|
|
990
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_METHOD_TYPES_ANNOTATION,
|
|
991
|
+
.location = location,
|
|
992
|
+
},
|
|
993
|
+
.prefix_location = prefix_location,
|
|
994
|
+
.overloads = overloads,
|
|
995
|
+
.vertical_bar_locations = vertical_bar_locations,
|
|
996
|
+
.dot3_location = dot3_location,
|
|
997
|
+
};
|
|
998
|
+
|
|
999
|
+
return instance;
|
|
1000
|
+
}
|
|
1001
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1002
|
+
rbs_ast_ruby_annotations_module_alias_annotation_t *rbs_ast_ruby_annotations_module_alias_annotation_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_location_range prefix_location, rbs_location_range keyword_location, rbs_type_name_t *type_name, rbs_location_range type_name_location) {
|
|
1003
|
+
rbs_ast_ruby_annotations_module_alias_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_module_alias_annotation_t);
|
|
1004
|
+
|
|
1005
|
+
*instance = (rbs_ast_ruby_annotations_module_alias_annotation_t) {
|
|
1006
|
+
.base = (rbs_node_t) {
|
|
1007
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_MODULE_ALIAS_ANNOTATION,
|
|
1008
|
+
.location = location,
|
|
1009
|
+
},
|
|
1010
|
+
.prefix_location = prefix_location,
|
|
1011
|
+
.keyword_location = keyword_location,
|
|
1012
|
+
.type_name = type_name,
|
|
1013
|
+
.type_name_location = type_name_location,
|
|
1014
|
+
};
|
|
1015
|
+
|
|
1016
|
+
return instance;
|
|
1017
|
+
}
|
|
1018
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1019
|
+
rbs_ast_ruby_annotations_node_type_assertion_t *rbs_ast_ruby_annotations_node_type_assertion_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_location_range prefix_location, rbs_node_t *type) {
|
|
1020
|
+
rbs_ast_ruby_annotations_node_type_assertion_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_node_type_assertion_t);
|
|
1021
|
+
|
|
1022
|
+
*instance = (rbs_ast_ruby_annotations_node_type_assertion_t) {
|
|
1023
|
+
.base = (rbs_node_t) {
|
|
1024
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_NODE_TYPE_ASSERTION,
|
|
1025
|
+
.location = location,
|
|
1026
|
+
},
|
|
1027
|
+
.prefix_location = prefix_location,
|
|
1028
|
+
.type = type,
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
return instance;
|
|
1032
|
+
}
|
|
1033
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1034
|
+
rbs_ast_ruby_annotations_param_type_annotation_t *rbs_ast_ruby_annotations_param_type_annotation_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_location_range prefix_location, rbs_location_range name_location, rbs_location_range colon_location, rbs_node_t *param_type, rbs_location_range comment_location) {
|
|
1035
|
+
rbs_ast_ruby_annotations_param_type_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_param_type_annotation_t);
|
|
1036
|
+
|
|
1037
|
+
*instance = (rbs_ast_ruby_annotations_param_type_annotation_t) {
|
|
1038
|
+
.base = (rbs_node_t) {
|
|
1039
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_PARAM_TYPE_ANNOTATION,
|
|
1040
|
+
.location = location,
|
|
1041
|
+
},
|
|
1042
|
+
.prefix_location = prefix_location,
|
|
1043
|
+
.name_location = name_location,
|
|
1044
|
+
.colon_location = colon_location,
|
|
1045
|
+
.param_type = param_type,
|
|
1046
|
+
.comment_location = comment_location,
|
|
1047
|
+
};
|
|
1048
|
+
|
|
1049
|
+
return instance;
|
|
1050
|
+
}
|
|
1051
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1052
|
+
rbs_ast_ruby_annotations_return_type_annotation_t *rbs_ast_ruby_annotations_return_type_annotation_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_location_range prefix_location, rbs_location_range return_location, rbs_location_range colon_location, rbs_node_t *return_type, rbs_location_range comment_location) {
|
|
1053
|
+
rbs_ast_ruby_annotations_return_type_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_return_type_annotation_t);
|
|
1054
|
+
|
|
1055
|
+
*instance = (rbs_ast_ruby_annotations_return_type_annotation_t) {
|
|
1056
|
+
.base = (rbs_node_t) {
|
|
1057
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_RETURN_TYPE_ANNOTATION,
|
|
1058
|
+
.location = location,
|
|
1059
|
+
},
|
|
1060
|
+
.prefix_location = prefix_location,
|
|
1061
|
+
.return_location = return_location,
|
|
1062
|
+
.colon_location = colon_location,
|
|
1063
|
+
.return_type = return_type,
|
|
1064
|
+
.comment_location = comment_location,
|
|
1065
|
+
};
|
|
1066
|
+
|
|
1067
|
+
return instance;
|
|
1068
|
+
}
|
|
1069
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1070
|
+
rbs_ast_ruby_annotations_skip_annotation_t *rbs_ast_ruby_annotations_skip_annotation_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_location_range prefix_location, rbs_location_range skip_location, rbs_location_range comment_location) {
|
|
1071
|
+
rbs_ast_ruby_annotations_skip_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_skip_annotation_t);
|
|
1072
|
+
|
|
1073
|
+
*instance = (rbs_ast_ruby_annotations_skip_annotation_t) {
|
|
1074
|
+
.base = (rbs_node_t) {
|
|
1075
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_SKIP_ANNOTATION,
|
|
1076
|
+
.location = location,
|
|
1077
|
+
},
|
|
1078
|
+
.prefix_location = prefix_location,
|
|
1079
|
+
.skip_location = skip_location,
|
|
1080
|
+
.comment_location = comment_location,
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
return instance;
|
|
1084
|
+
}
|
|
1085
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1086
|
+
rbs_ast_ruby_annotations_splat_param_type_annotation_t *rbs_ast_ruby_annotations_splat_param_type_annotation_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_location_range prefix_location, rbs_location_range star_location, rbs_location_range name_location, rbs_location_range colon_location, rbs_node_t *param_type, rbs_location_range comment_location) {
|
|
1087
|
+
rbs_ast_ruby_annotations_splat_param_type_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_splat_param_type_annotation_t);
|
|
1088
|
+
|
|
1089
|
+
*instance = (rbs_ast_ruby_annotations_splat_param_type_annotation_t) {
|
|
1090
|
+
.base = (rbs_node_t) {
|
|
1091
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_SPLAT_PARAM_TYPE_ANNOTATION,
|
|
1092
|
+
.location = location,
|
|
1093
|
+
},
|
|
1094
|
+
.prefix_location = prefix_location,
|
|
1095
|
+
.star_location = star_location,
|
|
1096
|
+
.name_location = name_location,
|
|
1097
|
+
.colon_location = colon_location,
|
|
1098
|
+
.param_type = param_type,
|
|
1099
|
+
.comment_location = comment_location,
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1102
|
+
return instance;
|
|
1103
|
+
}
|
|
1104
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1105
|
+
rbs_ast_ruby_annotations_type_application_annotation_t *rbs_ast_ruby_annotations_type_application_annotation_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_location_range prefix_location, rbs_node_list_t *type_args, rbs_location_range close_bracket_location, rbs_location_range_list_t *comma_locations) {
|
|
1106
|
+
rbs_ast_ruby_annotations_type_application_annotation_t *instance = rbs_allocator_alloc(allocator, rbs_ast_ruby_annotations_type_application_annotation_t);
|
|
1107
|
+
|
|
1108
|
+
*instance = (rbs_ast_ruby_annotations_type_application_annotation_t) {
|
|
1109
|
+
.base = (rbs_node_t) {
|
|
1110
|
+
.type = RBS_AST_RUBY_ANNOTATIONS_TYPE_APPLICATION_ANNOTATION,
|
|
1111
|
+
.location = location,
|
|
1112
|
+
},
|
|
1113
|
+
.prefix_location = prefix_location,
|
|
1114
|
+
.type_args = type_args,
|
|
1115
|
+
.close_bracket_location = close_bracket_location,
|
|
1116
|
+
.comma_locations = comma_locations,
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
return instance;
|
|
1120
|
+
}
|
|
1121
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1122
|
+
rbs_ast_string_t *rbs_ast_string_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_string_t string) {
|
|
1123
|
+
rbs_ast_string_t *instance = rbs_allocator_alloc(allocator, rbs_ast_string_t);
|
|
1124
|
+
|
|
1125
|
+
*instance = (rbs_ast_string_t) {
|
|
1126
|
+
.base = (rbs_node_t) {
|
|
1127
|
+
.type = RBS_AST_STRING,
|
|
1128
|
+
.location = location,
|
|
1129
|
+
},
|
|
1130
|
+
.string = string,
|
|
1131
|
+
};
|
|
1132
|
+
|
|
1133
|
+
return instance;
|
|
1134
|
+
}
|
|
1135
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1136
|
+
rbs_ast_type_param_t *rbs_ast_type_param_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_ast_symbol_t *name, enum rbs_type_param_variance variance, rbs_node_t *upper_bound, rbs_node_t *lower_bound, rbs_node_t *default_type, bool unchecked, rbs_location_range name_range) {
|
|
1137
|
+
rbs_ast_type_param_t *instance = rbs_allocator_alloc(allocator, rbs_ast_type_param_t);
|
|
1138
|
+
|
|
1139
|
+
*instance = (rbs_ast_type_param_t) {
|
|
1140
|
+
.base = (rbs_node_t) {
|
|
1141
|
+
.type = RBS_AST_TYPE_PARAM,
|
|
1142
|
+
.location = location,
|
|
1143
|
+
},
|
|
1144
|
+
.name = name,
|
|
1145
|
+
.variance = variance,
|
|
1146
|
+
.upper_bound = upper_bound,
|
|
1147
|
+
.lower_bound = lower_bound,
|
|
1148
|
+
.default_type = default_type,
|
|
1149
|
+
.unchecked = unchecked,
|
|
1150
|
+
.name_range = name_range,
|
|
1151
|
+
.variance_range = RBS_LOCATION_NULL_RANGE,
|
|
1152
|
+
.unchecked_range = RBS_LOCATION_NULL_RANGE,
|
|
1153
|
+
.upper_bound_range = RBS_LOCATION_NULL_RANGE,
|
|
1154
|
+
.lower_bound_range = RBS_LOCATION_NULL_RANGE,
|
|
1155
|
+
.default_range = RBS_LOCATION_NULL_RANGE,
|
|
1156
|
+
};
|
|
1157
|
+
|
|
1158
|
+
return instance;
|
|
1159
|
+
}
|
|
1160
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1161
|
+
rbs_method_type_t *rbs_method_type_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_node_list_t *type_params, rbs_node_t *type, rbs_types_block_t *block, rbs_location_range type_range) {
|
|
1162
|
+
rbs_method_type_t *instance = rbs_allocator_alloc(allocator, rbs_method_type_t);
|
|
1163
|
+
|
|
1164
|
+
*instance = (rbs_method_type_t) {
|
|
1165
|
+
.base = (rbs_node_t) {
|
|
1166
|
+
.type = RBS_METHOD_TYPE,
|
|
1167
|
+
.location = location,
|
|
1168
|
+
},
|
|
1169
|
+
.type_params = type_params,
|
|
1170
|
+
.type = type,
|
|
1171
|
+
.block = block,
|
|
1172
|
+
.type_range = type_range,
|
|
1173
|
+
.type_params_range = RBS_LOCATION_NULL_RANGE,
|
|
1174
|
+
};
|
|
1175
|
+
|
|
1176
|
+
return instance;
|
|
1177
|
+
}
|
|
1178
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1179
|
+
rbs_namespace_t *rbs_namespace_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_node_list_t *path, bool absolute) {
|
|
1180
|
+
rbs_namespace_t *instance = rbs_allocator_alloc(allocator, rbs_namespace_t);
|
|
1181
|
+
|
|
1182
|
+
*instance = (rbs_namespace_t) {
|
|
1183
|
+
.base = (rbs_node_t) {
|
|
1184
|
+
.type = RBS_NAMESPACE,
|
|
1185
|
+
.location = location,
|
|
1186
|
+
},
|
|
1187
|
+
.path = path,
|
|
1188
|
+
.absolute = absolute,
|
|
1189
|
+
};
|
|
1190
|
+
|
|
1191
|
+
return instance;
|
|
1192
|
+
}
|
|
1193
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1194
|
+
rbs_signature_t *rbs_signature_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_node_list_t *directives, rbs_node_list_t *declarations) {
|
|
1195
|
+
rbs_signature_t *instance = rbs_allocator_alloc(allocator, rbs_signature_t);
|
|
1196
|
+
|
|
1197
|
+
*instance = (rbs_signature_t) {
|
|
1198
|
+
.base = (rbs_node_t) {
|
|
1199
|
+
.type = RBS_SIGNATURE,
|
|
1200
|
+
.location = location,
|
|
1201
|
+
},
|
|
1202
|
+
.directives = directives,
|
|
1203
|
+
.declarations = declarations,
|
|
1204
|
+
};
|
|
1205
|
+
|
|
1206
|
+
return instance;
|
|
1207
|
+
}
|
|
1208
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1209
|
+
rbs_type_name_t *rbs_type_name_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_namespace_t *rbs_namespace, rbs_ast_symbol_t *name) {
|
|
1210
|
+
rbs_type_name_t *instance = rbs_allocator_alloc(allocator, rbs_type_name_t);
|
|
1211
|
+
|
|
1212
|
+
*instance = (rbs_type_name_t) {
|
|
1213
|
+
.base = (rbs_node_t) {
|
|
1214
|
+
.type = RBS_TYPE_NAME,
|
|
1215
|
+
.location = location,
|
|
1216
|
+
},
|
|
1217
|
+
.rbs_namespace = rbs_namespace,
|
|
1218
|
+
.name = name,
|
|
1219
|
+
};
|
|
1220
|
+
|
|
1221
|
+
return instance;
|
|
1222
|
+
}
|
|
1223
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1224
|
+
rbs_types_alias_t *rbs_types_alias_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_type_name_t *name, rbs_node_list_t *args, rbs_location_range name_range) {
|
|
1225
|
+
rbs_types_alias_t *instance = rbs_allocator_alloc(allocator, rbs_types_alias_t);
|
|
1226
|
+
|
|
1227
|
+
*instance = (rbs_types_alias_t) {
|
|
1228
|
+
.base = (rbs_node_t) {
|
|
1229
|
+
.type = RBS_TYPES_ALIAS,
|
|
1230
|
+
.location = location,
|
|
1231
|
+
},
|
|
1232
|
+
.name = name,
|
|
1233
|
+
.args = args,
|
|
1234
|
+
.name_range = name_range,
|
|
1235
|
+
.args_range = RBS_LOCATION_NULL_RANGE,
|
|
1236
|
+
};
|
|
1237
|
+
|
|
1238
|
+
return instance;
|
|
1239
|
+
}
|
|
1240
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1241
|
+
rbs_types_bases_any_t *rbs_types_bases_any_new(rbs_allocator_t *allocator, rbs_location_range location, bool todo) {
|
|
1242
|
+
rbs_types_bases_any_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_any_t);
|
|
1243
|
+
|
|
1244
|
+
*instance = (rbs_types_bases_any_t) {
|
|
1245
|
+
.base = (rbs_node_t) {
|
|
1246
|
+
.type = RBS_TYPES_BASES_ANY,
|
|
1247
|
+
.location = location,
|
|
1248
|
+
},
|
|
1249
|
+
.todo = todo,
|
|
1250
|
+
};
|
|
1251
|
+
|
|
1252
|
+
return instance;
|
|
1253
|
+
}
|
|
1254
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1255
|
+
rbs_types_bases_bool_t *rbs_types_bases_bool_new(rbs_allocator_t *allocator, rbs_location_range location) {
|
|
1256
|
+
rbs_types_bases_bool_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_bool_t);
|
|
1257
|
+
|
|
1258
|
+
*instance = (rbs_types_bases_bool_t) {
|
|
1259
|
+
.base = (rbs_node_t) {
|
|
1260
|
+
.type = RBS_TYPES_BASES_BOOL,
|
|
1261
|
+
.location = location,
|
|
1262
|
+
},
|
|
1263
|
+
};
|
|
1264
|
+
|
|
1265
|
+
return instance;
|
|
1266
|
+
}
|
|
1267
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1268
|
+
rbs_types_bases_bottom_t *rbs_types_bases_bottom_new(rbs_allocator_t *allocator, rbs_location_range location) {
|
|
1269
|
+
rbs_types_bases_bottom_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_bottom_t);
|
|
1270
|
+
|
|
1271
|
+
*instance = (rbs_types_bases_bottom_t) {
|
|
1272
|
+
.base = (rbs_node_t) {
|
|
1273
|
+
.type = RBS_TYPES_BASES_BOTTOM,
|
|
1274
|
+
.location = location,
|
|
1275
|
+
},
|
|
1276
|
+
};
|
|
1277
|
+
|
|
1278
|
+
return instance;
|
|
1279
|
+
}
|
|
1280
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1281
|
+
rbs_types_bases_class_t *rbs_types_bases_class_new(rbs_allocator_t *allocator, rbs_location_range location) {
|
|
1282
|
+
rbs_types_bases_class_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_class_t);
|
|
1283
|
+
|
|
1284
|
+
*instance = (rbs_types_bases_class_t) {
|
|
1285
|
+
.base = (rbs_node_t) {
|
|
1286
|
+
.type = RBS_TYPES_BASES_CLASS,
|
|
1287
|
+
.location = location,
|
|
1288
|
+
},
|
|
1289
|
+
};
|
|
1290
|
+
|
|
1291
|
+
return instance;
|
|
1292
|
+
}
|
|
1293
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1294
|
+
rbs_types_bases_instance_t *rbs_types_bases_instance_new(rbs_allocator_t *allocator, rbs_location_range location) {
|
|
1295
|
+
rbs_types_bases_instance_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_instance_t);
|
|
1296
|
+
|
|
1297
|
+
*instance = (rbs_types_bases_instance_t) {
|
|
1298
|
+
.base = (rbs_node_t) {
|
|
1299
|
+
.type = RBS_TYPES_BASES_INSTANCE,
|
|
1300
|
+
.location = location,
|
|
1301
|
+
},
|
|
1302
|
+
};
|
|
1303
|
+
|
|
1304
|
+
return instance;
|
|
1305
|
+
}
|
|
1306
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1307
|
+
rbs_types_bases_nil_t *rbs_types_bases_nil_new(rbs_allocator_t *allocator, rbs_location_range location) {
|
|
1308
|
+
rbs_types_bases_nil_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_nil_t);
|
|
1309
|
+
|
|
1310
|
+
*instance = (rbs_types_bases_nil_t) {
|
|
1311
|
+
.base = (rbs_node_t) {
|
|
1312
|
+
.type = RBS_TYPES_BASES_NIL,
|
|
1313
|
+
.location = location,
|
|
1314
|
+
},
|
|
1315
|
+
};
|
|
1316
|
+
|
|
1317
|
+
return instance;
|
|
1318
|
+
}
|
|
1319
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1320
|
+
rbs_types_bases_self_t *rbs_types_bases_self_new(rbs_allocator_t *allocator, rbs_location_range location) {
|
|
1321
|
+
rbs_types_bases_self_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_self_t);
|
|
1322
|
+
|
|
1323
|
+
*instance = (rbs_types_bases_self_t) {
|
|
1324
|
+
.base = (rbs_node_t) {
|
|
1325
|
+
.type = RBS_TYPES_BASES_SELF,
|
|
1326
|
+
.location = location,
|
|
1327
|
+
},
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1330
|
+
return instance;
|
|
1331
|
+
}
|
|
1332
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1333
|
+
rbs_types_bases_top_t *rbs_types_bases_top_new(rbs_allocator_t *allocator, rbs_location_range location) {
|
|
1334
|
+
rbs_types_bases_top_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_top_t);
|
|
1335
|
+
|
|
1336
|
+
*instance = (rbs_types_bases_top_t) {
|
|
1337
|
+
.base = (rbs_node_t) {
|
|
1338
|
+
.type = RBS_TYPES_BASES_TOP,
|
|
1339
|
+
.location = location,
|
|
1340
|
+
},
|
|
1341
|
+
};
|
|
1342
|
+
|
|
1343
|
+
return instance;
|
|
1344
|
+
}
|
|
1345
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1346
|
+
rbs_types_bases_void_t *rbs_types_bases_void_new(rbs_allocator_t *allocator, rbs_location_range location) {
|
|
1347
|
+
rbs_types_bases_void_t *instance = rbs_allocator_alloc(allocator, rbs_types_bases_void_t);
|
|
1348
|
+
|
|
1349
|
+
*instance = (rbs_types_bases_void_t) {
|
|
1350
|
+
.base = (rbs_node_t) {
|
|
1351
|
+
.type = RBS_TYPES_BASES_VOID,
|
|
1352
|
+
.location = location,
|
|
1353
|
+
},
|
|
1354
|
+
};
|
|
1355
|
+
|
|
1356
|
+
return instance;
|
|
1357
|
+
}
|
|
1358
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1359
|
+
rbs_types_block_t *rbs_types_block_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_node_t *type, bool required, rbs_node_t *self_type) {
|
|
1360
|
+
rbs_types_block_t *instance = rbs_allocator_alloc(allocator, rbs_types_block_t);
|
|
1361
|
+
|
|
1362
|
+
*instance = (rbs_types_block_t) {
|
|
1363
|
+
.base = (rbs_node_t) {
|
|
1364
|
+
.type = RBS_TYPES_BLOCK,
|
|
1365
|
+
.location = location,
|
|
1366
|
+
},
|
|
1367
|
+
.type = type,
|
|
1368
|
+
.required = required,
|
|
1369
|
+
.self_type = self_type,
|
|
1370
|
+
};
|
|
1371
|
+
|
|
1372
|
+
return instance;
|
|
1373
|
+
}
|
|
1374
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1375
|
+
rbs_types_class_instance_t *rbs_types_class_instance_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_type_name_t *name, rbs_node_list_t *args, rbs_location_range name_range) {
|
|
1376
|
+
rbs_types_class_instance_t *instance = rbs_allocator_alloc(allocator, rbs_types_class_instance_t);
|
|
1377
|
+
|
|
1378
|
+
*instance = (rbs_types_class_instance_t) {
|
|
1379
|
+
.base = (rbs_node_t) {
|
|
1380
|
+
.type = RBS_TYPES_CLASS_INSTANCE,
|
|
1381
|
+
.location = location,
|
|
1382
|
+
},
|
|
1383
|
+
.name = name,
|
|
1384
|
+
.args = args,
|
|
1385
|
+
.name_range = name_range,
|
|
1386
|
+
.args_range = RBS_LOCATION_NULL_RANGE,
|
|
1387
|
+
};
|
|
1388
|
+
|
|
1389
|
+
return instance;
|
|
1390
|
+
}
|
|
1391
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1392
|
+
rbs_types_class_singleton_t *rbs_types_class_singleton_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_type_name_t *name, rbs_node_list_t *args, rbs_location_range name_range) {
|
|
1393
|
+
rbs_types_class_singleton_t *instance = rbs_allocator_alloc(allocator, rbs_types_class_singleton_t);
|
|
1394
|
+
|
|
1395
|
+
*instance = (rbs_types_class_singleton_t) {
|
|
1396
|
+
.base = (rbs_node_t) {
|
|
1397
|
+
.type = RBS_TYPES_CLASS_SINGLETON,
|
|
1398
|
+
.location = location,
|
|
1399
|
+
},
|
|
1400
|
+
.name = name,
|
|
1401
|
+
.args = args,
|
|
1402
|
+
.name_range = name_range,
|
|
1403
|
+
.args_range = RBS_LOCATION_NULL_RANGE,
|
|
1404
|
+
};
|
|
1405
|
+
|
|
1406
|
+
return instance;
|
|
1407
|
+
}
|
|
1408
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1409
|
+
rbs_types_function_t *rbs_types_function_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_node_list_t *required_positionals, rbs_node_list_t *optional_positionals, rbs_node_t *rest_positionals, rbs_node_list_t *trailing_positionals, rbs_hash_t *required_keywords, rbs_hash_t *optional_keywords, rbs_node_t *rest_keywords, rbs_node_t *return_type) {
|
|
1410
|
+
rbs_types_function_t *instance = rbs_allocator_alloc(allocator, rbs_types_function_t);
|
|
1411
|
+
|
|
1412
|
+
*instance = (rbs_types_function_t) {
|
|
1413
|
+
.base = (rbs_node_t) {
|
|
1414
|
+
.type = RBS_TYPES_FUNCTION,
|
|
1415
|
+
.location = location,
|
|
1416
|
+
},
|
|
1417
|
+
.required_positionals = required_positionals,
|
|
1418
|
+
.optional_positionals = optional_positionals,
|
|
1419
|
+
.rest_positionals = rest_positionals,
|
|
1420
|
+
.trailing_positionals = trailing_positionals,
|
|
1421
|
+
.required_keywords = required_keywords,
|
|
1422
|
+
.optional_keywords = optional_keywords,
|
|
1423
|
+
.rest_keywords = rest_keywords,
|
|
1424
|
+
.return_type = return_type,
|
|
1425
|
+
};
|
|
1426
|
+
|
|
1427
|
+
return instance;
|
|
1428
|
+
}
|
|
1429
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1430
|
+
rbs_types_function_param_t *rbs_types_function_param_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_node_t *type, rbs_ast_symbol_t *name) {
|
|
1431
|
+
rbs_types_function_param_t *instance = rbs_allocator_alloc(allocator, rbs_types_function_param_t);
|
|
1432
|
+
|
|
1433
|
+
*instance = (rbs_types_function_param_t) {
|
|
1434
|
+
.base = (rbs_node_t) {
|
|
1435
|
+
.type = RBS_TYPES_FUNCTION_PARAM,
|
|
1436
|
+
.location = location,
|
|
1437
|
+
},
|
|
1438
|
+
.type = type,
|
|
1439
|
+
.name = name,
|
|
1440
|
+
.name_range = RBS_LOCATION_NULL_RANGE,
|
|
1441
|
+
};
|
|
1442
|
+
|
|
1443
|
+
return instance;
|
|
1444
|
+
}
|
|
1445
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1446
|
+
rbs_types_interface_t *rbs_types_interface_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_type_name_t *name, rbs_node_list_t *args, rbs_location_range name_range) {
|
|
1447
|
+
rbs_types_interface_t *instance = rbs_allocator_alloc(allocator, rbs_types_interface_t);
|
|
1448
|
+
|
|
1449
|
+
*instance = (rbs_types_interface_t) {
|
|
1450
|
+
.base = (rbs_node_t) {
|
|
1451
|
+
.type = RBS_TYPES_INTERFACE,
|
|
1452
|
+
.location = location,
|
|
1453
|
+
},
|
|
1454
|
+
.name = name,
|
|
1455
|
+
.args = args,
|
|
1456
|
+
.name_range = name_range,
|
|
1457
|
+
.args_range = RBS_LOCATION_NULL_RANGE,
|
|
1458
|
+
};
|
|
1459
|
+
|
|
1460
|
+
return instance;
|
|
1461
|
+
}
|
|
1462
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1463
|
+
rbs_types_intersection_t *rbs_types_intersection_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_node_list_t *types) {
|
|
1464
|
+
rbs_types_intersection_t *instance = rbs_allocator_alloc(allocator, rbs_types_intersection_t);
|
|
1465
|
+
|
|
1466
|
+
*instance = (rbs_types_intersection_t) {
|
|
1467
|
+
.base = (rbs_node_t) {
|
|
1468
|
+
.type = RBS_TYPES_INTERSECTION,
|
|
1469
|
+
.location = location,
|
|
1470
|
+
},
|
|
1471
|
+
.types = types,
|
|
1472
|
+
};
|
|
1473
|
+
|
|
1474
|
+
return instance;
|
|
1475
|
+
}
|
|
1476
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1477
|
+
rbs_types_literal_t *rbs_types_literal_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_node_t *literal) {
|
|
1478
|
+
rbs_types_literal_t *instance = rbs_allocator_alloc(allocator, rbs_types_literal_t);
|
|
1479
|
+
|
|
1480
|
+
*instance = (rbs_types_literal_t) {
|
|
1481
|
+
.base = (rbs_node_t) {
|
|
1482
|
+
.type = RBS_TYPES_LITERAL,
|
|
1483
|
+
.location = location,
|
|
1484
|
+
},
|
|
1485
|
+
.literal = literal,
|
|
1486
|
+
};
|
|
1487
|
+
|
|
1488
|
+
return instance;
|
|
1489
|
+
}
|
|
1490
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1491
|
+
rbs_types_optional_t *rbs_types_optional_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_node_t *type) {
|
|
1492
|
+
rbs_types_optional_t *instance = rbs_allocator_alloc(allocator, rbs_types_optional_t);
|
|
1493
|
+
|
|
1494
|
+
*instance = (rbs_types_optional_t) {
|
|
1495
|
+
.base = (rbs_node_t) {
|
|
1496
|
+
.type = RBS_TYPES_OPTIONAL,
|
|
1497
|
+
.location = location,
|
|
1498
|
+
},
|
|
1499
|
+
.type = type,
|
|
1500
|
+
};
|
|
1501
|
+
|
|
1502
|
+
return instance;
|
|
1503
|
+
}
|
|
1504
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1505
|
+
rbs_types_proc_t *rbs_types_proc_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_node_t *type, rbs_types_block_t *block, rbs_node_t *self_type) {
|
|
1506
|
+
rbs_types_proc_t *instance = rbs_allocator_alloc(allocator, rbs_types_proc_t);
|
|
1507
|
+
|
|
1508
|
+
*instance = (rbs_types_proc_t) {
|
|
1509
|
+
.base = (rbs_node_t) {
|
|
1510
|
+
.type = RBS_TYPES_PROC,
|
|
1511
|
+
.location = location,
|
|
1512
|
+
},
|
|
1513
|
+
.type = type,
|
|
1514
|
+
.block = block,
|
|
1515
|
+
.self_type = self_type,
|
|
1516
|
+
};
|
|
1517
|
+
|
|
1518
|
+
return instance;
|
|
1519
|
+
}
|
|
1520
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1521
|
+
rbs_types_record_t *rbs_types_record_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_hash_t *all_fields) {
|
|
1522
|
+
rbs_types_record_t *instance = rbs_allocator_alloc(allocator, rbs_types_record_t);
|
|
1523
|
+
|
|
1524
|
+
*instance = (rbs_types_record_t) {
|
|
1525
|
+
.base = (rbs_node_t) {
|
|
1526
|
+
.type = RBS_TYPES_RECORD,
|
|
1527
|
+
.location = location,
|
|
1528
|
+
},
|
|
1529
|
+
.all_fields = all_fields,
|
|
1530
|
+
};
|
|
1531
|
+
|
|
1532
|
+
return instance;
|
|
1533
|
+
}
|
|
1534
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1535
|
+
rbs_types_record_field_type_t *rbs_types_record_field_type_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_node_t *type, bool required) {
|
|
1536
|
+
rbs_types_record_field_type_t *instance = rbs_allocator_alloc(allocator, rbs_types_record_field_type_t);
|
|
1537
|
+
|
|
1538
|
+
*instance = (rbs_types_record_field_type_t) {
|
|
1539
|
+
.base = (rbs_node_t) {
|
|
1540
|
+
.type = RBS_TYPES_RECORD_FIELD_TYPE,
|
|
1541
|
+
.location = location,
|
|
1542
|
+
},
|
|
1543
|
+
.type = type,
|
|
1544
|
+
.required = required,
|
|
1545
|
+
};
|
|
1546
|
+
|
|
1547
|
+
return instance;
|
|
1548
|
+
}
|
|
1549
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1550
|
+
rbs_types_tuple_t *rbs_types_tuple_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_node_list_t *types) {
|
|
1551
|
+
rbs_types_tuple_t *instance = rbs_allocator_alloc(allocator, rbs_types_tuple_t);
|
|
1552
|
+
|
|
1553
|
+
*instance = (rbs_types_tuple_t) {
|
|
1554
|
+
.base = (rbs_node_t) {
|
|
1555
|
+
.type = RBS_TYPES_TUPLE,
|
|
1556
|
+
.location = location,
|
|
1557
|
+
},
|
|
1558
|
+
.types = types,
|
|
1559
|
+
};
|
|
1560
|
+
|
|
1561
|
+
return instance;
|
|
1562
|
+
}
|
|
1563
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1564
|
+
rbs_types_union_t *rbs_types_union_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_node_list_t *types) {
|
|
1565
|
+
rbs_types_union_t *instance = rbs_allocator_alloc(allocator, rbs_types_union_t);
|
|
1566
|
+
|
|
1567
|
+
*instance = (rbs_types_union_t) {
|
|
1568
|
+
.base = (rbs_node_t) {
|
|
1569
|
+
.type = RBS_TYPES_UNION,
|
|
1570
|
+
.location = location,
|
|
1571
|
+
},
|
|
1572
|
+
.types = types,
|
|
1573
|
+
};
|
|
1574
|
+
|
|
1575
|
+
return instance;
|
|
1576
|
+
}
|
|
1577
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1578
|
+
rbs_types_untyped_function_t *rbs_types_untyped_function_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_node_t *return_type) {
|
|
1579
|
+
rbs_types_untyped_function_t *instance = rbs_allocator_alloc(allocator, rbs_types_untyped_function_t);
|
|
1580
|
+
|
|
1581
|
+
*instance = (rbs_types_untyped_function_t) {
|
|
1582
|
+
.base = (rbs_node_t) {
|
|
1583
|
+
.type = RBS_TYPES_UNTYPED_FUNCTION,
|
|
1584
|
+
.location = location,
|
|
1585
|
+
},
|
|
1586
|
+
.return_type = return_type,
|
|
1587
|
+
};
|
|
1588
|
+
|
|
1589
|
+
return instance;
|
|
1590
|
+
}
|
|
1591
|
+
#line 140 "prism/templates/src/ast.c.erb"
|
|
1592
|
+
rbs_types_variable_t *rbs_types_variable_new(rbs_allocator_t *allocator, rbs_location_range location, rbs_ast_symbol_t *name) {
|
|
1593
|
+
rbs_types_variable_t *instance = rbs_allocator_alloc(allocator, rbs_types_variable_t);
|
|
1594
|
+
|
|
1595
|
+
*instance = (rbs_types_variable_t) {
|
|
1596
|
+
.base = (rbs_node_t) {
|
|
1597
|
+
.type = RBS_TYPES_VARIABLE,
|
|
1598
|
+
.location = location,
|
|
1599
|
+
},
|
|
1600
|
+
.name = name,
|
|
1601
|
+
};
|
|
1602
|
+
|
|
1603
|
+
return instance;
|
|
1604
|
+
}
|