rbs-inline 0.4.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -5
- data/Rakefile +12 -0
- data/lib/rbs/inline/annotation_parser/tokenizer.rb +361 -0
- data/lib/rbs/inline/annotation_parser.rb +548 -326
- data/lib/rbs/inline/ast/annotations.rb +433 -138
- data/lib/rbs/inline/ast/comment_lines.rb +17 -20
- data/lib/rbs/inline/ast/declarations.rb +301 -28
- data/lib/rbs/inline/ast/members.rb +130 -121
- data/lib/rbs/inline/ast/tree.rb +37 -22
- data/lib/rbs/inline/cli.rb +12 -12
- data/lib/rbs/inline/node_utils.rb +1 -1
- data/lib/rbs/inline/parser.rb +165 -67
- data/lib/rbs/inline/version.rb +1 -1
- data/lib/rbs/inline/writer.rb +395 -118
- data/lib/rbs/inline.rb +1 -0
- data/rbs_collection.lock.yaml +2 -2
- data/sig/generated/rbs/inline/annotation_parser/tokenizer.rbs +221 -0
- data/sig/generated/rbs/inline/annotation_parser.rbs +148 -92
- data/sig/generated/rbs/inline/ast/annotations.rbs +143 -37
- data/sig/generated/rbs/inline/ast/comment_lines.rbs +8 -4
- data/sig/generated/rbs/inline/ast/declarations.rbs +133 -10
- data/sig/generated/rbs/inline/ast/members.rbs +26 -15
- data/sig/generated/rbs/inline/ast/tree.rbs +23 -17
- data/sig/generated/rbs/inline/cli.rbs +3 -3
- data/sig/generated/rbs/inline/node_utils.rbs +1 -1
- data/sig/generated/rbs/inline/parser.rbs +35 -18
- data/sig/generated/rbs/inline/writer.rbs +62 -22
- metadata +5 -3
@@ -4,7 +4,24 @@ module RBS
|
|
4
4
|
module Inline
|
5
5
|
module AST
|
6
6
|
module Annotations
|
7
|
-
type t = VarType | ReturnType | Use | Inherits | Generic | ModuleSelf | Skip |
|
7
|
+
type t = VarType | ReturnType | Use | Inherits | Generic | ModuleSelf | Skip | MethodTypeAssertion | TypeAssertion | SyntaxErrorAssertion | Dot3Assertion | Application | RBSAnnotation | Override | IvarType | Embedded | Method | SplatParamType | DoubleSplatParamType | BlockType | ModuleDecl | ClassDecl
|
8
|
+
|
9
|
+
module Utils
|
10
|
+
# @rbs (Tree) -> RBS::AST::TypeParam?
|
11
|
+
def translate_type_param: (Tree) -> RBS::AST::TypeParam?
|
12
|
+
|
13
|
+
# @rbs (Types::t) -> RBS::AST::Declarations::Class::Super?
|
14
|
+
def translate_super_class: (Types::t) -> RBS::AST::Declarations::Class::Super?
|
15
|
+
|
16
|
+
# Assumes the tree is generated through `#parse_module_name`
|
17
|
+
#
|
18
|
+
# Returns a type name, or `nil` if the tree is something invalid.
|
19
|
+
#
|
20
|
+
# @param tree -- A tree object that is generated through `#parse_module_name`
|
21
|
+
#
|
22
|
+
# @rbs (AST::Tree) -> TypeName?
|
23
|
+
def translate_type_name: (AST::Tree) -> TypeName?
|
24
|
+
end
|
8
25
|
|
9
26
|
class Base
|
10
27
|
attr_reader source: CommentLines
|
@@ -13,7 +30,7 @@ module RBS
|
|
13
30
|
|
14
31
|
# @rbs tree: Tree
|
15
32
|
# @rbs source: CommentLines
|
16
|
-
# @rbs
|
33
|
+
# @rbs return: void
|
17
34
|
def initialize: (Tree tree, CommentLines source) -> void
|
18
35
|
end
|
19
36
|
|
@@ -27,11 +44,46 @@ module RBS
|
|
27
44
|
# @rbs override
|
28
45
|
def initialize: ...
|
29
46
|
|
30
|
-
#
|
47
|
+
# : () -> bool
|
31
48
|
def complete?: () -> bool
|
32
49
|
end
|
33
50
|
|
34
|
-
|
51
|
+
class SpecialVarTypeAnnotation < Base
|
52
|
+
attr_reader name: Symbol?
|
53
|
+
|
54
|
+
attr_reader type: Types::t?
|
55
|
+
|
56
|
+
attr_reader comment: String?
|
57
|
+
|
58
|
+
attr_reader type_source: String
|
59
|
+
|
60
|
+
# @rbs override
|
61
|
+
def initialize: ...
|
62
|
+
end
|
63
|
+
|
64
|
+
# `@rbs *x: T`
|
65
|
+
class SplatParamType < SpecialVarTypeAnnotation
|
66
|
+
end
|
67
|
+
|
68
|
+
# `@rbs` **x: T
|
69
|
+
class DoubleSplatParamType < SpecialVarTypeAnnotation
|
70
|
+
end
|
71
|
+
|
72
|
+
# `@rbs &block: METHOD-TYPE` or `@rbs &block: ? METHOD-TYPE`
|
73
|
+
class BlockType < Base
|
74
|
+
attr_reader name: Symbol?
|
75
|
+
|
76
|
+
attr_reader type: Types::Block?
|
77
|
+
|
78
|
+
attr_reader comment: String?
|
79
|
+
|
80
|
+
attr_reader type_source: String
|
81
|
+
|
82
|
+
# @rbs override
|
83
|
+
def initialize: ...
|
84
|
+
end
|
85
|
+
|
86
|
+
# `@rbs return: T`
|
35
87
|
class ReturnType < Base
|
36
88
|
attr_reader type: Types::t?
|
37
89
|
|
@@ -40,7 +92,7 @@ module RBS
|
|
40
92
|
# @rbs override
|
41
93
|
def initialize: ...
|
42
94
|
|
43
|
-
# @rbs
|
95
|
+
# @rbs return: bool
|
44
96
|
def complete?: () -> bool
|
45
97
|
end
|
46
98
|
|
@@ -58,53 +110,45 @@ module RBS
|
|
58
110
|
def initialize: ...
|
59
111
|
end
|
60
112
|
|
61
|
-
|
62
|
-
|
63
|
-
attr_reader type: Types::t | MethodType | nil
|
64
|
-
|
65
|
-
def initialize: (untyped tree, untyped source) -> untyped
|
66
|
-
|
67
|
-
# @rbs returns bool
|
68
|
-
def complete?: () -> bool
|
113
|
+
class MethodTypeAssertion < Base
|
114
|
+
attr_reader method_type: MethodType
|
69
115
|
|
70
|
-
#
|
71
|
-
def
|
116
|
+
# @rbs override
|
117
|
+
def initialize: ...
|
72
118
|
|
73
|
-
|
74
|
-
def method_type?: () -> MethodType?
|
119
|
+
def type_source: () -> String
|
75
120
|
end
|
76
121
|
|
77
|
-
|
78
|
-
|
79
|
-
attr_reader types: Array[Types::t]?
|
122
|
+
class TypeAssertion < Base
|
123
|
+
attr_reader type: Types::t
|
80
124
|
|
81
125
|
# @rbs override
|
82
126
|
def initialize: ...
|
83
127
|
|
84
|
-
|
85
|
-
def complete?: () -> bool
|
128
|
+
def type_source: () -> String
|
86
129
|
end
|
87
130
|
|
88
|
-
|
89
|
-
|
90
|
-
# The type of block
|
91
|
-
#
|
92
|
-
# * Types::Block when syntactically correct input is given
|
93
|
-
# * String when syntax error is reported
|
94
|
-
# * `nil` when nothing is given
|
95
|
-
attr_reader block_type: Types::Block | String | nil
|
131
|
+
class SyntaxErrorAssertion < Base
|
132
|
+
attr_reader error_string: String
|
96
133
|
|
97
|
-
#
|
98
|
-
|
134
|
+
# @rbs override
|
135
|
+
def initialize: ...
|
136
|
+
end
|
99
137
|
|
100
|
-
|
101
|
-
#
|
102
|
-
|
103
|
-
|
104
|
-
|
138
|
+
class Dot3Assertion < Base
|
139
|
+
# @rbs override
|
140
|
+
def initialize: ...
|
141
|
+
end
|
142
|
+
|
143
|
+
# `#[TYPE, ..., TYPE]`
|
144
|
+
class Application < Base
|
145
|
+
attr_reader types: Array[Types::t]?
|
105
146
|
|
106
147
|
# @rbs override
|
107
148
|
def initialize: ...
|
149
|
+
|
150
|
+
# @rbs return: bool
|
151
|
+
def complete?: () -> bool
|
108
152
|
end
|
109
153
|
|
110
154
|
# `# @rbs %a{a} %a{a} ...`
|
@@ -113,6 +157,8 @@ module RBS
|
|
113
157
|
|
114
158
|
# @rbs override
|
115
159
|
def initialize: ...
|
160
|
+
|
161
|
+
def annotations: () -> Array[RBS::AST::Annotation]
|
116
162
|
end
|
117
163
|
|
118
164
|
# `# @rbs skip`
|
@@ -170,6 +216,8 @@ module RBS
|
|
170
216
|
|
171
217
|
attr_reader comment: String?
|
172
218
|
|
219
|
+
include Utils
|
220
|
+
|
173
221
|
# @rbs override
|
174
222
|
def initialize: ...
|
175
223
|
end
|
@@ -181,6 +229,64 @@ module RBS
|
|
181
229
|
# @rbs override
|
182
230
|
def initialize: ...
|
183
231
|
end
|
232
|
+
|
233
|
+
# `@rbs METHOD-TYPE``
|
234
|
+
class Method < Base
|
235
|
+
type method_type = [ MethodType, method_type? ] | String
|
236
|
+
|
237
|
+
attr_reader method_types: method_type?
|
238
|
+
|
239
|
+
# `true` if the method definition is overloading something
|
240
|
+
attr_reader overloading: bool
|
241
|
+
|
242
|
+
attr_reader type: MethodType?
|
243
|
+
|
244
|
+
attr_reader method_type_source: String
|
245
|
+
|
246
|
+
# @rbs override
|
247
|
+
def initialize: ...
|
248
|
+
|
249
|
+
# : (Array[tree]) -> method_type?
|
250
|
+
def construct_method_types: (Array[tree]) -> method_type?
|
251
|
+
|
252
|
+
# @rbs () { (MethodType) -> void } -> void
|
253
|
+
# | () -> Enumerator[MethodType, void]
|
254
|
+
def each_method_type: () { (MethodType) -> void } -> void
|
255
|
+
| () -> Enumerator[MethodType, void]
|
256
|
+
|
257
|
+
# Returns the parsing error overload string
|
258
|
+
#
|
259
|
+
# Returns `nil` if no parsing error found.
|
260
|
+
def error_source: () -> String?
|
261
|
+
end
|
262
|
+
|
263
|
+
# `@rbs module Foo`
|
264
|
+
class ModuleDecl < Base
|
265
|
+
attr_reader name: TypeName?
|
266
|
+
|
267
|
+
attr_reader type_params: Array[RBS::AST::TypeParam]
|
268
|
+
|
269
|
+
attr_reader self_types: Array[RBS::AST::Declarations::Module::Self]
|
270
|
+
|
271
|
+
include Utils
|
272
|
+
|
273
|
+
# @rbs override
|
274
|
+
def initialize: ...
|
275
|
+
end
|
276
|
+
|
277
|
+
# `@rbs class Foo`
|
278
|
+
class ClassDecl < Base
|
279
|
+
attr_reader name: TypeName?
|
280
|
+
|
281
|
+
attr_reader type_params: Array[RBS::AST::TypeParam]
|
282
|
+
|
283
|
+
attr_reader super_class: RBS::AST::Declarations::Class::Super?
|
284
|
+
|
285
|
+
include Utils
|
286
|
+
|
287
|
+
# @rbs override
|
288
|
+
def initialize: ...
|
289
|
+
end
|
184
290
|
end
|
185
291
|
end
|
186
292
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module RBS
|
4
4
|
module Inline
|
5
5
|
module AST
|
6
|
-
# CommentLines represents consecutive comments
|
6
|
+
# CommentLines represents consecutive comments, providing a mapping from locations in `#string` to a pair of a comment and its offset
|
7
7
|
#
|
8
8
|
# The comments construct one String.
|
9
9
|
#
|
@@ -15,15 +15,19 @@ module RBS
|
|
15
15
|
# We want to get a String of comment1 and comment2, `"Hello\nWorld".
|
16
16
|
# And want to translate a location in the string into the location in comment1 and comment2.
|
17
17
|
class CommentLines
|
18
|
-
attr_reader comments: Array[
|
18
|
+
attr_reader comments: Array[Prism::Comment]
|
19
19
|
|
20
20
|
# @rbs comments: Array[Prism::Comment]
|
21
|
-
def initialize: (Array[Prism::Comment] comments) ->
|
21
|
+
def initialize: (Array[Prism::Comment] comments) -> void
|
22
|
+
|
23
|
+
def lines: () -> Array[String]
|
22
24
|
|
23
25
|
def string: () -> String
|
24
26
|
|
27
|
+
# Translates the cursor index of `#string` into the cursor index of a specific comment object
|
28
|
+
#
|
25
29
|
# @rbs index: Integer
|
26
|
-
# @rbs
|
30
|
+
# @rbs return: [Prism::Comment, Integer]?
|
27
31
|
def comment_location: (Integer index) -> [ Prism::Comment, Integer ]?
|
28
32
|
end
|
29
33
|
end
|
@@ -6,11 +6,14 @@ module RBS
|
|
6
6
|
module Declarations
|
7
7
|
module ConstantUtil
|
8
8
|
# @rbs node: Prism::Node
|
9
|
-
# @rbs
|
9
|
+
# @rbs return: TypeName?
|
10
10
|
def type_name: (Prism::Node node) -> TypeName?
|
11
|
+
|
12
|
+
# @rbs (Prism::Node) -> Prism::Node?
|
13
|
+
def value_node: (Prism::Node) -> Prism::Node?
|
11
14
|
end
|
12
15
|
|
13
|
-
type t = ClassDecl | ModuleDecl | ConstantDecl | SingletonClassDecl
|
16
|
+
type t = ClassDecl | ModuleDecl | ConstantDecl | SingletonClassDecl | BlockDecl | DataAssignDecl | StructAssignDecl
|
14
17
|
|
15
18
|
interface _WithComments
|
16
19
|
def comments: () -> AnnotationParser::ParsingResult?
|
@@ -18,7 +21,7 @@ module RBS
|
|
18
21
|
|
19
22
|
# @rbs module-self _WithComments
|
20
23
|
module Generics : _WithComments
|
21
|
-
# @rbs
|
24
|
+
# @rbs return: Array[RBS::AST::TypeParam]
|
22
25
|
def type_params: () -> Array[RBS::AST::TypeParam]
|
23
26
|
end
|
24
27
|
|
@@ -55,7 +58,7 @@ module RBS
|
|
55
58
|
# @rbs node: Prism::ClassNode
|
56
59
|
# @rbs comments: AnnotationParser::ParsingResult?
|
57
60
|
# @rbs super_app: Annotations::Application?
|
58
|
-
# @rbs
|
61
|
+
# @rbs return: void
|
59
62
|
def initialize: (Prism::ClassNode node, AnnotationParser::ParsingResult? comments, Annotations::Application? super_app) -> void
|
60
63
|
|
61
64
|
# @rbs %a{pure}
|
@@ -86,25 +89,25 @@ module RBS
|
|
86
89
|
|
87
90
|
attr_reader comments: AnnotationParser::ParsingResult?
|
88
91
|
|
89
|
-
attr_reader assertion: Annotations::
|
92
|
+
attr_reader assertion: Annotations::TypeAssertion?
|
90
93
|
|
91
94
|
# @rbs node: Prism::ConstantWriteNode
|
92
95
|
# @rbs comments: AnnotationParser::ParsingResult?
|
93
|
-
# @rbs assertion: Annotations::
|
94
|
-
def initialize: (Prism::ConstantWriteNode node, AnnotationParser::ParsingResult? comments, Annotations::
|
96
|
+
# @rbs assertion: Annotations::TypeAssertion?
|
97
|
+
def initialize: (Prism::ConstantWriteNode node, AnnotationParser::ParsingResult? comments, Annotations::TypeAssertion? assertion) -> void
|
95
98
|
|
96
99
|
# @rbs %a{pure}
|
97
|
-
# @rbs
|
100
|
+
# @rbs return: Types::t
|
98
101
|
%a{pure}
|
99
102
|
def type: () -> Types::t
|
100
103
|
|
101
104
|
# @rbs %a{pure}
|
102
105
|
# @rbs return Types::t?
|
103
106
|
%a{pure}
|
104
|
-
def literal_type: () ->
|
107
|
+
def literal_type: () -> Types::t?
|
105
108
|
|
106
109
|
# @rbs %a{pure}
|
107
|
-
# @rbs
|
110
|
+
# @rbs return: TypeName?
|
108
111
|
%a{pure}
|
109
112
|
def constant_name: () -> TypeName?
|
110
113
|
|
@@ -113,6 +116,126 @@ module RBS
|
|
113
116
|
|
114
117
|
class SingletonClassDecl < ModuleOrClass[Prism::SingletonClassNode]
|
115
118
|
end
|
119
|
+
|
120
|
+
class BlockDecl < Base
|
121
|
+
attr_reader node: Prism::BlockNode
|
122
|
+
|
123
|
+
attr_reader comments: AnnotationParser::ParsingResult?
|
124
|
+
|
125
|
+
# Members included in the declaration
|
126
|
+
attr_reader members: Array[Members::t | t]
|
127
|
+
|
128
|
+
# @rbs (Prism::BlockNode, AnnotationParser::ParsingResult?) -> void
|
129
|
+
def initialize: (Prism::BlockNode, AnnotationParser::ParsingResult?) -> void
|
130
|
+
|
131
|
+
def start_line: () -> Integer
|
132
|
+
|
133
|
+
def module_class_annotation: () -> (Annotations::ModuleDecl | Annotations::ClassDecl | nil)
|
134
|
+
end
|
135
|
+
|
136
|
+
# @rbs module-self _WithTypeDecls
|
137
|
+
module DataStructUtil : _WithTypeDecls
|
138
|
+
interface _WithTypeDecls
|
139
|
+
def type_decls: () -> Hash[Integer, Annotations::TypeAssertion]
|
140
|
+
|
141
|
+
def each_attribute_argument: () { (Prism::Node) -> void } -> void
|
142
|
+
|
143
|
+
def comments: %a{pure} () -> AnnotationParser::ParsingResult?
|
144
|
+
end
|
145
|
+
|
146
|
+
# @rbs %a{pure}
|
147
|
+
# @rbs () { ([Symbol, Annotations::TypeAssertion?]) -> void } -> void
|
148
|
+
# | () -> Enumerator[[Symbol, Annotations::TypeAssertion?], void]
|
149
|
+
%a{pure}
|
150
|
+
def each_attribute: () { ([ Symbol, Annotations::TypeAssertion? ]) -> void } -> void
|
151
|
+
| () -> Enumerator[[ Symbol, Annotations::TypeAssertion? ], void]
|
152
|
+
|
153
|
+
def class_annotations: () -> Array[RBS::AST::Annotation]
|
154
|
+
end
|
155
|
+
|
156
|
+
class DataAssignDecl < Base
|
157
|
+
extend ConstantUtil
|
158
|
+
|
159
|
+
include DataStructUtil
|
160
|
+
|
161
|
+
attr_reader node: Prism::ConstantWriteNode
|
162
|
+
|
163
|
+
attr_reader comments: AnnotationParser::ParsingResult?
|
164
|
+
|
165
|
+
attr_reader type_decls: Hash[Integer, Annotations::TypeAssertion]
|
166
|
+
|
167
|
+
attr_reader data_define_node: Prism::CallNode
|
168
|
+
|
169
|
+
# @rbs (Prism::ConstantWriteNode, Prism::CallNode, AnnotationParser::ParsingResult?, Hash[Integer, Annotations::TypeAssertion]) -> void
|
170
|
+
def initialize: (Prism::ConstantWriteNode, Prism::CallNode, AnnotationParser::ParsingResult?, Hash[Integer, Annotations::TypeAssertion]) -> void
|
171
|
+
|
172
|
+
def start_line: () -> Integer
|
173
|
+
|
174
|
+
# @rbs %a{pure}
|
175
|
+
# @rbs () -> TypeName?
|
176
|
+
%a{pure}
|
177
|
+
def constant_name: () -> TypeName?
|
178
|
+
|
179
|
+
# @rbs (Prism::ConstantWriteNode) -> Prism::CallNode?
|
180
|
+
def self.data_define?: (Prism::ConstantWriteNode) -> Prism::CallNode?
|
181
|
+
|
182
|
+
# @rbs () { (Prism::Node) -> void } -> void
|
183
|
+
def each_attribute_argument: () { (Prism::Node) -> void } -> void
|
184
|
+
end
|
185
|
+
|
186
|
+
class StructAssignDecl < Base
|
187
|
+
extend ConstantUtil
|
188
|
+
|
189
|
+
include DataStructUtil
|
190
|
+
|
191
|
+
attr_reader node: Prism::ConstantWriteNode
|
192
|
+
|
193
|
+
attr_reader comments: AnnotationParser::ParsingResult?
|
194
|
+
|
195
|
+
attr_reader type_decls: Hash[Integer, Annotations::TypeAssertion]
|
196
|
+
|
197
|
+
attr_reader struct_new_node: Prism::CallNode
|
198
|
+
|
199
|
+
# @rbs (Prism::ConstantWriteNode, Prism::CallNode, AnnotationParser::ParsingResult?, Hash[Integer, Annotations::TypeAssertion]) -> void
|
200
|
+
def initialize: (Prism::ConstantWriteNode, Prism::CallNode, AnnotationParser::ParsingResult?, Hash[Integer, Annotations::TypeAssertion]) -> void
|
201
|
+
|
202
|
+
def start_line: () -> Integer
|
203
|
+
|
204
|
+
# @rbs %a{pure}
|
205
|
+
# @rbs () -> TypeName?
|
206
|
+
%a{pure}
|
207
|
+
def constant_name: () -> TypeName?
|
208
|
+
|
209
|
+
# @rbs () { (Prism::Node) -> void } -> void
|
210
|
+
def each_attribute_argument: () { (Prism::Node) -> void } -> void
|
211
|
+
|
212
|
+
# @rbs (Prism::ConstantWriteNode) -> Prism::CallNode?
|
213
|
+
def self.struct_new?: (Prism::ConstantWriteNode) -> Prism::CallNode?
|
214
|
+
|
215
|
+
# @rbs %a{pure}
|
216
|
+
%a{pure}
|
217
|
+
def keyword_init?: () -> bool
|
218
|
+
|
219
|
+
# @rbs %a{pure}
|
220
|
+
%a{pure}
|
221
|
+
def positional_init?: () -> bool
|
222
|
+
|
223
|
+
# Returns `true` is annotation is given to make all attributes *readonly*
|
224
|
+
#
|
225
|
+
# Add `# @rbs %a{rbs-inline:readonly-attributes=true}` to the class to make all attributes `attr_reader`, instead of `attr_accessor`.
|
226
|
+
#
|
227
|
+
# @rbs %a{pure}
|
228
|
+
%a{pure}
|
229
|
+
def readonly_attributes?: () -> bool
|
230
|
+
|
231
|
+
# Returns `true` if annotation is given to make all `.new` arguments required
|
232
|
+
#
|
233
|
+
# Add `# @rbs %a{rbs-inline:new-args=required}` to the class to make all of the parameters required.
|
234
|
+
#
|
235
|
+
# @rbs %a{pure}
|
236
|
+
%a{pure}
|
237
|
+
def required_new_args?: () -> bool
|
238
|
+
end
|
116
239
|
end
|
117
240
|
end
|
118
241
|
end
|
@@ -37,30 +37,41 @@ module RBS
|
|
37
37
|
# ```
|
38
38
|
attr_reader visibility: RBS::AST::Members::visibility?
|
39
39
|
|
40
|
-
|
40
|
+
# Assertion given at the end of the method name
|
41
|
+
attr_reader assertion: Annotations::TypeAssertion?
|
41
42
|
|
42
43
|
# @rbs node: Prism::DefNode
|
43
44
|
# @rbs comments: AnnotationParser::ParsingResult?
|
44
45
|
# @rbs visibility: RBS::AST::Members::visibility?
|
45
|
-
# @rbs assertion: Annotations::
|
46
|
-
def initialize: (Prism::DefNode node, AnnotationParser::ParsingResult? comments, RBS::AST::Members::visibility? visibility, Annotations::
|
46
|
+
# @rbs assertion: Annotations::TypeAssertion?
|
47
|
+
def initialize: (Prism::DefNode node, AnnotationParser::ParsingResult? comments, RBS::AST::Members::visibility? visibility, Annotations::TypeAssertion? assertion) -> void
|
47
48
|
|
48
49
|
# Returns the name of the method
|
49
50
|
def method_name: () -> Symbol
|
50
51
|
|
51
|
-
|
52
|
+
# Returns `nil` if no `@rbs METHOD-TYPE` or `#:` annotation is given
|
53
|
+
#
|
54
|
+
# Returns an empty array if only `...` method type is given.
|
55
|
+
def annotated_method_types: () -> Array[MethodType]?
|
52
56
|
|
53
57
|
def return_type: () -> Types::t?
|
54
58
|
|
55
59
|
def var_type_hash: () -> Hash[Symbol, Types::t?]
|
56
60
|
|
61
|
+
def splat_param_type_annotation: () -> Annotations::SplatParamType?
|
62
|
+
|
63
|
+
def double_splat_param_type_annotation: () -> Annotations::DoubleSplatParamType?
|
64
|
+
|
65
|
+
def overloading?: () -> bool
|
66
|
+
|
57
67
|
def method_overloads: () -> Array[RBS::AST::Members::MethodDefinition::Overload]
|
58
68
|
|
59
69
|
def method_annotations: () -> Array[RBS::AST::Annotation]
|
60
70
|
|
71
|
+
# Returns the `@rbs override` annotation
|
61
72
|
def override_annotation: () -> AST::Annotations::Override?
|
62
73
|
|
63
|
-
def
|
74
|
+
def block_type_annotation: () -> AST::Annotations::BlockType?
|
64
75
|
end
|
65
76
|
|
66
77
|
class RubyAlias < RubyBase
|
@@ -70,12 +81,12 @@ module RBS
|
|
70
81
|
|
71
82
|
# @rbs node: Prism::AliasMethodNode
|
72
83
|
# @rbs comments: AnnotationParser::ParsingResult?
|
73
|
-
def initialize: (Prism::AliasMethodNode node, AnnotationParser::ParsingResult? comments) ->
|
84
|
+
def initialize: (Prism::AliasMethodNode node, AnnotationParser::ParsingResult? comments) -> void
|
74
85
|
|
75
|
-
# @rbs
|
86
|
+
# @rbs return: Symbol -- the name of *old* method
|
76
87
|
def old_name: () -> Symbol
|
77
88
|
|
78
|
-
# @rbs
|
89
|
+
# @rbs return: Symbol -- the name of *new* method
|
79
90
|
def new_name: () -> Symbol
|
80
91
|
end
|
81
92
|
|
@@ -94,10 +105,10 @@ module RBS
|
|
94
105
|
# @rbs node: Prism::CallNode
|
95
106
|
# @rbs comments: AnnotationParser::ParsingResult?
|
96
107
|
# @rbs application: Annotations::Application?
|
97
|
-
# @rbs
|
108
|
+
# @rbs return: void
|
98
109
|
def initialize: (Prism::CallNode node, AnnotationParser::ParsingResult? comments, Annotations::Application? application) -> void
|
99
110
|
|
100
|
-
# @rbs
|
111
|
+
# @rbs return: ::RBS::AST::Members::Include
|
101
112
|
# | ::RBS::AST::Members::Extend
|
102
113
|
# | ::RBS::AST::Members::Prepend
|
103
114
|
# | nil
|
@@ -109,16 +120,16 @@ module RBS
|
|
109
120
|
|
110
121
|
attr_reader comments: AnnotationParser::ParsingResult?
|
111
122
|
|
112
|
-
attr_reader assertion: Annotations::
|
123
|
+
attr_reader assertion: Annotations::TypeAssertion?
|
113
124
|
|
114
125
|
# @rbs node: Prism::CallNode
|
115
126
|
# @rbs comments: AnnotationParser::ParsingResult?
|
116
|
-
# @rbs assertion: Annotations::
|
117
|
-
# @rbs
|
118
|
-
def initialize: (Prism::CallNode node, AnnotationParser::ParsingResult? comments, Annotations::
|
127
|
+
# @rbs assertion: Annotations::TypeAssertion?
|
128
|
+
# @rbs return: void
|
129
|
+
def initialize: (Prism::CallNode node, AnnotationParser::ParsingResult? comments, Annotations::TypeAssertion? assertion) -> void
|
119
130
|
|
120
131
|
# @rbs return Array[RBS::AST::Members::AttrReader | RBS::AST::Members::AttrWriter | RBS::AST::Members::AttrAccessor]?
|
121
|
-
def rbs: () ->
|
132
|
+
def rbs: () -> Array[RBS::AST::Members::AttrReader | RBS::AST::Members::AttrWriter | RBS::AST::Members::AttrAccessor]?
|
122
133
|
|
123
134
|
# Returns the type of the attribute
|
124
135
|
#
|