rbs 4.0.3 → 4.1.0.pre.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +34 -6
- data/.github/workflows/rust.yml +0 -2
- data/.github/workflows/windows.yml +0 -3
- data/CHANGELOG.md +0 -8
- data/Rakefile +2 -2
- data/config.yml +24 -0
- data/core/builtin.rbs +1 -0
- data/core/class.rbs +5 -3
- data/core/kernel.rbs +26 -11
- data/core/ruby_vm.rbs +40 -0
- data/docs/inline.md +29 -1
- data/ext/rbs_extension/ast_translation.c +21 -0
- data/ext/rbs_extension/class_constants.c +2 -0
- data/ext/rbs_extension/class_constants.h +1 -0
- data/ext/rbs_extension/extconf.rb +1 -0
- data/include/rbs/ast.h +314 -297
- data/include/rbs/defines.h +13 -0
- data/include/rbs/lexer.h +1 -0
- data/lib/rbs/annotate/rdoc_annotator.rb +27 -31
- data/lib/rbs/ast/ruby/annotations.rb +42 -0
- data/lib/rbs/ast/ruby/declarations.rb +11 -1
- data/lib/rbs/ast/ruby/members.rb +28 -0
- data/lib/rbs/cli.rb +3 -5
- data/lib/rbs/collection/config/lockfile_generator.rb +14 -1
- data/lib/rbs/environment.rb +6 -0
- data/lib/rbs/inline_parser.rb +49 -25
- data/lib/rbs/rewriter.rb +70 -0
- data/lib/rbs/test/type_check.rb +6 -1
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +1 -0
- data/sig/annotate/rdoc_annotater.rbs +12 -9
- data/sig/ast/ruby/annotations.rbs +49 -0
- data/sig/ast/ruby/members.rbs +15 -0
- data/sig/collection/config/lockfile_generator.rbs +2 -0
- data/sig/inline_parser.rbs +2 -0
- data/sig/manifest.yaml +0 -1
- data/sig/rewriter.rbs +45 -0
- data/src/ast.c +109 -85
- data/src/lexer.c +137 -114
- data/src/lexer.re +1 -0
- data/src/lexstate.c +1 -0
- data/src/parser.c +55 -5
- data/stdlib/openssl/0/openssl.rbs +2 -2
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ef0d5eb6481b99be0816dbcef78f1cc40371104f4ef3e82b40ffcbbc3e78dccc
|
|
4
|
+
data.tar.gz: a728bc39e8ef49146542b121956fc5555d8eecb066febe271bb04b0beaf56ea3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d0a018f3245ae90e747f649b1e306edf8084147a3db4138b929a74736b86fe8f404b3e0d4aef35b212bf8da149e4d7b0088d22b5c1bd27a006aed253dec82d88
|
|
7
|
+
data.tar.gz: 65a1efb7bc0484e7744c7df1ef70c193918f5a5d5690c00bdadcb5b29bbf8b5b18719643e31b6ea93b2a4ae56874965b5116f43de1569deb5ff24b96e221a7c7
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -63,9 +63,6 @@ jobs:
|
|
|
63
63
|
if: ${{ contains(matrix.ruby, 'head') }}
|
|
64
64
|
run: |
|
|
65
65
|
bundle config set force_ruby_platform true
|
|
66
|
-
- name: Ignore Gemfile.lock's BUNDLED WITH on ruby-head
|
|
67
|
-
if: ${{ contains(matrix.ruby, 'head') }}
|
|
68
|
-
run: bundle config set --local version system
|
|
69
66
|
- name: Skip installing type checkers
|
|
70
67
|
if: ${{ ! contains(matrix.job, 'typecheck_test') }}
|
|
71
68
|
run: |
|
|
@@ -109,10 +106,41 @@ jobs:
|
|
|
109
106
|
if: ${{ contains(matrix.ruby, 'head') }}
|
|
110
107
|
run: |
|
|
111
108
|
bundle config set force_ruby_platform true
|
|
112
|
-
- name: Ignore Gemfile.lock's BUNDLED WITH on ruby-head
|
|
113
|
-
if: ${{ contains(matrix.ruby, 'head') }}
|
|
114
|
-
run: bundle config set --local version system
|
|
115
109
|
- name: bin/setup
|
|
116
110
|
run: |
|
|
117
111
|
bin/setup
|
|
118
112
|
- run: bundle exec rake clean compile_c99
|
|
113
|
+
|
|
114
|
+
clang_compile:
|
|
115
|
+
runs-on: macos-latest
|
|
116
|
+
strategy:
|
|
117
|
+
fail-fast: false
|
|
118
|
+
matrix:
|
|
119
|
+
ruby: ['4.0', head]
|
|
120
|
+
steps:
|
|
121
|
+
- uses: actions/checkout@v6
|
|
122
|
+
- name: Install dependencies
|
|
123
|
+
run: |
|
|
124
|
+
brew install ruby-build
|
|
125
|
+
- uses: ruby/setup-ruby@v1
|
|
126
|
+
with:
|
|
127
|
+
ruby-version: ${{ matrix.ruby }}
|
|
128
|
+
bundler: none
|
|
129
|
+
- name: Set working directory as safe
|
|
130
|
+
run: git config --global --add safe.directory $(pwd)
|
|
131
|
+
- name: Update rubygems & bundler
|
|
132
|
+
run: |
|
|
133
|
+
ruby -v
|
|
134
|
+
gem update --system
|
|
135
|
+
- name: install erb
|
|
136
|
+
run: gem install erb
|
|
137
|
+
- name: clang version
|
|
138
|
+
run: clang --version
|
|
139
|
+
- name: bundle config set force_ruby_platform true if head
|
|
140
|
+
if: ${{ contains(matrix.ruby, 'head') }}
|
|
141
|
+
run: |
|
|
142
|
+
bundle config set force_ruby_platform true
|
|
143
|
+
- name: bin/setup
|
|
144
|
+
run: |
|
|
145
|
+
bin/setup
|
|
146
|
+
- run: bundle exec rake clean compile
|
data/.github/workflows/rust.yml
CHANGED
|
@@ -35,9 +35,6 @@ jobs:
|
|
|
35
35
|
bundled_gems = JSON.parse(res)["gems"].map{_1["gem"]}
|
|
36
36
|
system "gem uninstall #{bundled_gems.join(" ")} --force", exception: true
|
|
37
37
|
'
|
|
38
|
-
- name: Ignore Gemfile.lock's BUNDLED WITH on dev Ruby
|
|
39
|
-
if: ${{ matrix.ruby == 'ucrt' || matrix.ruby == 'mswin' }}
|
|
40
|
-
run: bundle config set --local version system
|
|
41
38
|
- name: bundle install
|
|
42
39
|
run: |
|
|
43
40
|
bundle config set without profilers libs
|
data/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
-
## 4.0.3 (2026-06-18)
|
|
4
|
-
|
|
5
|
-
### Miscellaneous
|
|
6
|
-
|
|
7
|
-
* Fix Ruby CI failure with compressed `Zlib::GzipReader` test fixtures. ([#3005](https://github.com/ruby/rbs/pull/3005))
|
|
8
|
-
* Fix flaky `DirSingletonTest#test_fchdir` and `DirSingletonTest#test_for_fd` under aggressive GC. ([#3005](https://github.com/ruby/rbs/pull/3005))
|
|
9
|
-
* Fix Ruby head CI failure caused by the lockfile-pinned Bundler version. ([#3005](https://github.com/ruby/rbs/pull/3005))
|
|
10
|
-
|
|
11
3
|
## 4.0.2 (2026-03-25)
|
|
12
4
|
|
|
13
5
|
### Library changes
|
data/Rakefile
CHANGED
data/config.yml
CHANGED
|
@@ -784,6 +784,30 @@ nodes:
|
|
|
784
784
|
- name: type_name_location
|
|
785
785
|
c_type: rbs_location_range
|
|
786
786
|
optional: true
|
|
787
|
+
- name: RBS::AST::Ruby::Annotations::ModuleSelfAnnotation
|
|
788
|
+
rust_name: ModuleSelfAnnotationNode
|
|
789
|
+
fields:
|
|
790
|
+
- name: prefix_location
|
|
791
|
+
c_type: rbs_location_range
|
|
792
|
+
- name: keyword_location
|
|
793
|
+
c_type: rbs_location_range
|
|
794
|
+
- name: colon_location
|
|
795
|
+
c_type: rbs_location_range
|
|
796
|
+
- name: name
|
|
797
|
+
c_type: rbs_type_name
|
|
798
|
+
- name: args
|
|
799
|
+
c_type: rbs_node_list
|
|
800
|
+
- name: open_bracket_location
|
|
801
|
+
c_type: rbs_location_range
|
|
802
|
+
optional: true
|
|
803
|
+
- name: close_bracket_location
|
|
804
|
+
c_type: rbs_location_range
|
|
805
|
+
optional: true
|
|
806
|
+
- name: args_comma_locations
|
|
807
|
+
c_type: rbs_location_range_list
|
|
808
|
+
- name: comment_location
|
|
809
|
+
c_type: rbs_location_range
|
|
810
|
+
optional: true
|
|
787
811
|
- name: RBS::AST::Ruby::Annotations::ParamTypeAnnotation
|
|
788
812
|
rust_name: ParamTypeAnnotationNode
|
|
789
813
|
fields:
|
data/core/builtin.rbs
CHANGED
|
@@ -225,6 +225,7 @@ type int = Integer | _ToInt
|
|
|
225
225
|
|
|
226
226
|
# Represents a `Float`, or a type convertible to it (via `.to_f`).
|
|
227
227
|
#
|
|
228
|
+
%a{deprecated: Use `_ToF` directly}
|
|
228
229
|
type float = Float | _ToF
|
|
229
230
|
|
|
230
231
|
# Represents a `Range[T]`, or a type that acts like it (via `.begin`, `.end`, and `.exclude_end?`).
|
data/core/class.rbs
CHANGED
|
@@ -83,7 +83,7 @@ class Class < Module
|
|
|
83
83
|
# Assign the class to a constant (name starting uppercase) if you want to treat
|
|
84
84
|
# it like a regular class.
|
|
85
85
|
#
|
|
86
|
-
def initialize: (?Class superclass) ?{ (Class newclass) -> void } -> void
|
|
86
|
+
def initialize: (?Class superclass) ?{ (Class newclass) [self: Class] -> void } -> void
|
|
87
87
|
|
|
88
88
|
# <!--
|
|
89
89
|
# rdoc-file=object.c
|
|
@@ -107,6 +107,8 @@ class Class < Module
|
|
|
107
107
|
#
|
|
108
108
|
def allocate: () -> untyped
|
|
109
109
|
|
|
110
|
+
def self.allocate: () -> untyped
|
|
111
|
+
|
|
110
112
|
# <!--
|
|
111
113
|
# rdoc-file=object.c
|
|
112
114
|
# - attached_object -> object
|
|
@@ -150,7 +152,7 @@ class Class < Module
|
|
|
150
152
|
# New subclass: Bar
|
|
151
153
|
# New subclass: Baz
|
|
152
154
|
#
|
|
153
|
-
def inherited: (Class
|
|
155
|
+
private def inherited: (Class subclass) -> void
|
|
154
156
|
|
|
155
157
|
# <!--
|
|
156
158
|
# rdoc-file=object.c
|
|
@@ -160,7 +162,7 @@ class Class < Module
|
|
|
160
162
|
# object's #initialize method, passing it *args*. This is the method that ends
|
|
161
163
|
# up getting called whenever an object is constructed using <code>.new</code>.
|
|
162
164
|
#
|
|
163
|
-
def new: () -> untyped
|
|
165
|
+
def new: (*untyped, **untyped) ?{ (?) -> untyped } -> untyped
|
|
164
166
|
|
|
165
167
|
# <!--
|
|
166
168
|
# rdoc-file=object.c
|
data/core/kernel.rbs
CHANGED
|
@@ -182,9 +182,9 @@ module Kernel : BasicObject
|
|
|
182
182
|
# c(4) #=> []
|
|
183
183
|
# c(5) #=> nil
|
|
184
184
|
#
|
|
185
|
-
def self?.caller: (
|
|
186
|
-
| (
|
|
187
|
-
| () ->
|
|
185
|
+
def self?.caller: () -> Array[String]
|
|
186
|
+
| (int start, ?int? length) -> Array[String]?
|
|
187
|
+
| (range[int] range) -> Array[String]?
|
|
188
188
|
|
|
189
189
|
# <!--
|
|
190
190
|
# rdoc-file=vm_backtrace.c
|
|
@@ -207,9 +207,9 @@ module Kernel : BasicObject
|
|
|
207
207
|
# Optionally you can pass a range, which will return an array containing the
|
|
208
208
|
# entries within the specified range.
|
|
209
209
|
#
|
|
210
|
-
def self?.caller_locations: (
|
|
211
|
-
| (
|
|
212
|
-
| () ->
|
|
210
|
+
def self?.caller_locations: () -> Array[Thread::Backtrace::Location]
|
|
211
|
+
| (int start, ?int? length) -> Array[Thread::Backtrace::Location]?
|
|
212
|
+
| (range[int] range) -> Array[Thread::Backtrace::Location]?
|
|
213
213
|
|
|
214
214
|
# <!--
|
|
215
215
|
# rdoc-file=vm_eval.c
|
|
@@ -314,6 +314,16 @@ module Kernel : BasicObject
|
|
|
314
314
|
#
|
|
315
315
|
def self?.block_given?: () -> bool
|
|
316
316
|
|
|
317
|
+
alias self.iterator? self.block_given?
|
|
318
|
+
|
|
319
|
+
# <!--
|
|
320
|
+
# rdoc-file=vm_eval.c
|
|
321
|
+
# - iterator? -> true or false
|
|
322
|
+
# -->
|
|
323
|
+
# Deprecated. Use block_given? instead.
|
|
324
|
+
#
|
|
325
|
+
alias iterator? block_given?
|
|
326
|
+
|
|
317
327
|
# <!--
|
|
318
328
|
# rdoc-file=vm_eval.c
|
|
319
329
|
# - local_variables -> array
|
|
@@ -326,7 +336,7 @@ module Kernel : BasicObject
|
|
|
326
336
|
# end
|
|
327
337
|
# local_variables #=> [:fred, :i]
|
|
328
338
|
#
|
|
329
|
-
def self?.local_variables: () ->
|
|
339
|
+
def self?.local_variables: () -> Array[Symbol]
|
|
330
340
|
|
|
331
341
|
# <!--
|
|
332
342
|
# rdoc-file=random.c
|
|
@@ -788,7 +798,7 @@ module Kernel : BasicObject
|
|
|
788
798
|
#
|
|
789
799
|
# Files that are currently being loaded must not be registered for autoload.
|
|
790
800
|
#
|
|
791
|
-
def self?.autoload: (interned
|
|
801
|
+
def self?.autoload: (interned const, path filename) -> nil
|
|
792
802
|
|
|
793
803
|
# <!--
|
|
794
804
|
# rdoc-file=load.c
|
|
@@ -812,7 +822,7 @@ module Kernel : BasicObject
|
|
|
812
822
|
# autoload?(:B) #=> "b"
|
|
813
823
|
# end
|
|
814
824
|
#
|
|
815
|
-
def self?.autoload?: (interned name) -> String?
|
|
825
|
+
def self?.autoload?: (interned name, ?boolish inherit) -> String?
|
|
816
826
|
|
|
817
827
|
# <!--
|
|
818
828
|
# rdoc-file=proc.c
|
|
@@ -1193,7 +1203,7 @@ module Kernel : BasicObject
|
|
|
1193
1203
|
#
|
|
1194
1204
|
# global_variables.grep /std/ #=> [:$stdin, :$stdout, :$stderr]
|
|
1195
1205
|
#
|
|
1196
|
-
def self?.global_variables: () ->
|
|
1206
|
+
def self?.global_variables: () -> Array[Symbol]
|
|
1197
1207
|
|
|
1198
1208
|
# <!--
|
|
1199
1209
|
# rdoc-file=load.c
|
|
@@ -1843,7 +1853,12 @@ module Kernel : BasicObject
|
|
|
1843
1853
|
# ----------------|---------------------------------------------
|
|
1844
1854
|
# <code>'-'</code>|Whether the entities exist and are identical.
|
|
1845
1855
|
#
|
|
1846
|
-
def self?.test: (
|
|
1856
|
+
def self?.test: ('b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'G' | 'k' | 'l' | 'o' | 'O' | 'p' | 'r' | 'R' | 'S' | 'u' | 'w' | 'W' | 'x' | 'X' | 'z' |
|
|
1857
|
+
98 | 99 | 100 | 101 | 102 | 103 | 71 | 107 | 108 | 111 | 79 | 112 | 114 | 82 | 83 | 117 | 119 | 87 | 120 | 88 | 122, path filepath) -> bool
|
|
1858
|
+
| ('s' | 115, path filepath) -> Integer?
|
|
1859
|
+
| ('A' | 'M' | 'C' | 65 | 77 | 67, path filepath) -> Time
|
|
1860
|
+
| ('<' | '=' | '>' | '-' | 60 | 61 | 62 | 45, path filepath1, path filepath2) -> bool
|
|
1861
|
+
| (String | int cmd, path filepath1, ?path filepath2) -> (bool | Time | Integer | nil)
|
|
1847
1862
|
|
|
1848
1863
|
# <!--
|
|
1849
1864
|
# rdoc-file=vm_eval.c
|
data/core/ruby_vm.rbs
CHANGED
|
@@ -371,6 +371,46 @@ class RubyVM::InstructionSequence < Object
|
|
|
371
371
|
# event_symbol] pair.
|
|
372
372
|
#
|
|
373
373
|
def trace_points: () -> Array[untyped]
|
|
374
|
+
|
|
375
|
+
# <!--
|
|
376
|
+
# rdoc-file=iseq.c
|
|
377
|
+
# - of(p1)
|
|
378
|
+
# -->
|
|
379
|
+
# Returns the instruction sequence containing the given proc or method.
|
|
380
|
+
#
|
|
381
|
+
# For example, using irb:
|
|
382
|
+
#
|
|
383
|
+
# # a proc
|
|
384
|
+
# > p = proc { num = 1 + 2 }
|
|
385
|
+
# > RubyVM::InstructionSequence.of(p)
|
|
386
|
+
# > #=> <RubyVM::InstructionSequence:block in irb_binding@(irb)>
|
|
387
|
+
#
|
|
388
|
+
# # for a method
|
|
389
|
+
# > def foo(bar); puts bar; end
|
|
390
|
+
# > RubyVM::InstructionSequence.of(method(:foo))
|
|
391
|
+
# > #=> <RubyVM::InstructionSequence:foo@(irb)>
|
|
392
|
+
#
|
|
393
|
+
# Using ::compile_file:
|
|
394
|
+
#
|
|
395
|
+
# # /tmp/iseq_of.rb
|
|
396
|
+
# def hello
|
|
397
|
+
# puts "hello, world"
|
|
398
|
+
# end
|
|
399
|
+
#
|
|
400
|
+
# $a_global_proc = proc { str = 'a' + 'b' }
|
|
401
|
+
#
|
|
402
|
+
# # in irb
|
|
403
|
+
# > require '/tmp/iseq_of.rb'
|
|
404
|
+
#
|
|
405
|
+
# # first the method hello
|
|
406
|
+
# > RubyVM::InstructionSequence.of(method(:hello))
|
|
407
|
+
# > #=> #<RubyVM::InstructionSequence:0x007fb73d7cb1d0>
|
|
408
|
+
#
|
|
409
|
+
# # then the global proc
|
|
410
|
+
# > RubyVM::InstructionSequence.of($a_global_proc)
|
|
411
|
+
# > #=> #<RubyVM::InstructionSequence:0x007fb73d7caf78>
|
|
412
|
+
#
|
|
413
|
+
def self.of: (Proc | Method | UnboundMethod body) -> RubyVM::InstructionSequence?
|
|
374
414
|
end
|
|
375
415
|
|
|
376
416
|
# <!-- rdoc-file=ast.rb -->
|
data/docs/inline.md
CHANGED
|
@@ -123,10 +123,38 @@ end
|
|
|
123
123
|
|
|
124
124
|
This creates the types `::API`, `::API::V1`, and `::API::V1::Resources`.
|
|
125
125
|
|
|
126
|
+
### `module-self` constraint
|
|
127
|
+
|
|
128
|
+
The `module-self` constraint declares which classes or modules the module can be mixed into.
|
|
129
|
+
|
|
130
|
+
```ruby
|
|
131
|
+
# @rbs module-self: _Each[String]
|
|
132
|
+
module Enumerable2
|
|
133
|
+
end
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
This is equivalent to `module Enumerable2 : _Each[String]` in RBS, meaning `Enumerable2` can only be included in classes that satisfy the `_Each[String]` interface.
|
|
137
|
+
|
|
138
|
+
Multiple `module-self` constraints can be declared with separate annotations:
|
|
139
|
+
|
|
140
|
+
```ruby
|
|
141
|
+
# @rbs module-self: _Each[String]
|
|
142
|
+
# @rbs module-self: Comparable
|
|
143
|
+
module StringCollection
|
|
144
|
+
end
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
You can add a description after `--`:
|
|
148
|
+
|
|
149
|
+
```ruby
|
|
150
|
+
# @rbs module-self: Minitest::Test -- depending on assertion methods
|
|
151
|
+
module TestHelper
|
|
152
|
+
end
|
|
153
|
+
```
|
|
154
|
+
|
|
126
155
|
### Current Limitations
|
|
127
156
|
|
|
128
157
|
- Generic module definitions are not supported
|
|
129
|
-
- Module self-type constraints are not supported
|
|
130
158
|
|
|
131
159
|
## Method Definitions
|
|
132
160
|
|
|
@@ -947,6 +947,27 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
|
|
|
947
947
|
&h
|
|
948
948
|
);
|
|
949
949
|
}
|
|
950
|
+
case RBS_AST_RUBY_ANNOTATIONS_MODULE_SELF_ANNOTATION: {
|
|
951
|
+
rbs_ast_ruby_annotations_module_self_annotation_t *node = (rbs_ast_ruby_annotations_module_self_annotation_t *) instance;
|
|
952
|
+
|
|
953
|
+
VALUE h = rb_hash_new();
|
|
954
|
+
rb_hash_aset(h, ID2SYM(rb_intern("location")), rbs_location_range_to_ruby_location(ctx, node->base.location));
|
|
955
|
+
rb_hash_aset(h, ID2SYM(rb_intern("prefix_location")), rbs_location_range_to_ruby_location(ctx, node->prefix_location));
|
|
956
|
+
rb_hash_aset(h, ID2SYM(rb_intern("keyword_location")), rbs_location_range_to_ruby_location(ctx, node->keyword_location));
|
|
957
|
+
rb_hash_aset(h, ID2SYM(rb_intern("colon_location")), rbs_location_range_to_ruby_location(ctx, node->colon_location));
|
|
958
|
+
rb_hash_aset(h, ID2SYM(rb_intern("name")), rbs_struct_to_ruby_value(ctx, (rbs_node_t *) node->name)); // rbs_type_name
|
|
959
|
+
rb_hash_aset(h, ID2SYM(rb_intern("args")), rbs_node_list_to_ruby_array(ctx, node->args));
|
|
960
|
+
rb_hash_aset(h, ID2SYM(rb_intern("open_bracket_location")), rbs_location_range_to_ruby_location(ctx, node->open_bracket_location)); // optional
|
|
961
|
+
rb_hash_aset(h, ID2SYM(rb_intern("close_bracket_location")), rbs_location_range_to_ruby_location(ctx, node->close_bracket_location)); // optional
|
|
962
|
+
rb_hash_aset(h, ID2SYM(rb_intern("args_comma_locations")), rbs_location_range_list_to_ruby_array(ctx, node->args_comma_locations));
|
|
963
|
+
rb_hash_aset(h, ID2SYM(rb_intern("comment_location")), rbs_location_range_to_ruby_location(ctx, node->comment_location)); // optional
|
|
964
|
+
|
|
965
|
+
return CLASS_NEW_INSTANCE(
|
|
966
|
+
RBS_AST_Ruby_Annotations_ModuleSelfAnnotation,
|
|
967
|
+
1,
|
|
968
|
+
&h
|
|
969
|
+
);
|
|
970
|
+
}
|
|
950
971
|
case RBS_AST_RUBY_ANNOTATIONS_NODE_TYPE_ASSERTION: {
|
|
951
972
|
rbs_ast_ruby_annotations_node_type_assertion_t *node = (rbs_ast_ruby_annotations_node_type_assertion_t *) instance;
|
|
952
973
|
|
|
@@ -54,6 +54,7 @@ VALUE RBS_AST_Ruby_Annotations_DoubleSplatParamTypeAnnotation;
|
|
|
54
54
|
VALUE RBS_AST_Ruby_Annotations_InstanceVariableAnnotation;
|
|
55
55
|
VALUE RBS_AST_Ruby_Annotations_MethodTypesAnnotation;
|
|
56
56
|
VALUE RBS_AST_Ruby_Annotations_ModuleAliasAnnotation;
|
|
57
|
+
VALUE RBS_AST_Ruby_Annotations_ModuleSelfAnnotation;
|
|
57
58
|
VALUE RBS_AST_Ruby_Annotations_NodeTypeAssertion;
|
|
58
59
|
VALUE RBS_AST_Ruby_Annotations_ParamTypeAnnotation;
|
|
59
60
|
VALUE RBS_AST_Ruby_Annotations_ReturnTypeAnnotation;
|
|
@@ -147,6 +148,7 @@ void rbs__init_constants(void) {
|
|
|
147
148
|
IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_InstanceVariableAnnotation, RBS_AST_Ruby_Annotations, "InstanceVariableAnnotation");
|
|
148
149
|
IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_MethodTypesAnnotation, RBS_AST_Ruby_Annotations, "MethodTypesAnnotation");
|
|
149
150
|
IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_ModuleAliasAnnotation, RBS_AST_Ruby_Annotations, "ModuleAliasAnnotation");
|
|
151
|
+
IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_ModuleSelfAnnotation, RBS_AST_Ruby_Annotations, "ModuleSelfAnnotation");
|
|
150
152
|
IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_NodeTypeAssertion, RBS_AST_Ruby_Annotations, "NodeTypeAssertion");
|
|
151
153
|
IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_ParamTypeAnnotation, RBS_AST_Ruby_Annotations, "ParamTypeAnnotation");
|
|
152
154
|
IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_ReturnTypeAnnotation, RBS_AST_Ruby_Annotations, "ReturnTypeAnnotation");
|
|
@@ -62,6 +62,7 @@ extern VALUE RBS_AST_Ruby_Annotations_DoubleSplatParamTypeAnnotation;
|
|
|
62
62
|
extern VALUE RBS_AST_Ruby_Annotations_InstanceVariableAnnotation;
|
|
63
63
|
extern VALUE RBS_AST_Ruby_Annotations_MethodTypesAnnotation;
|
|
64
64
|
extern VALUE RBS_AST_Ruby_Annotations_ModuleAliasAnnotation;
|
|
65
|
+
extern VALUE RBS_AST_Ruby_Annotations_ModuleSelfAnnotation;
|
|
65
66
|
extern VALUE RBS_AST_Ruby_Annotations_NodeTypeAssertion;
|
|
66
67
|
extern VALUE RBS_AST_Ruby_Annotations_ParamTypeAnnotation;
|
|
67
68
|
extern VALUE RBS_AST_Ruby_Annotations_ReturnTypeAnnotation;
|