rbi 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/rbi/parser.rb +19 -10
- data/lib/rbi/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a98dd77d2fde6771b24b8ab87d585b94b944beea38a2d60a2ba38f7738deb67b
|
4
|
+
data.tar.gz: 56eb299a37b8755b57ebd72ffc4dcf6179a739e4146f6903c3d63450a586307b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e2a8e48b3210f41a3b38bf2844d895a0d232c8296b7122ecb64705ec9b77d56dd88ca0e1dd3b2fa15755ce90e63ee3ef17ccbc1174b3034b4d825bb4444c357
|
7
|
+
data.tar.gz: df19f77e6e4dd24e9309b03d4a1cd3008386bc3a48fe6998782008459fac78f9f97c52f603db2f65b1c68d42c3fe49f1145a7d40fcc845473c667ec4287127af
|
data/Gemfile
CHANGED
data/lib/rbi/parser.rb
CHANGED
@@ -178,6 +178,7 @@ module RBI
|
|
178
178
|
@scopes_stack = T.let([@tree], T::Array[Tree])
|
179
179
|
@last_node = T.let(nil, T.nilable(::AST::Node))
|
180
180
|
@last_sigs = T.let([], T::Array[RBI::Sig])
|
181
|
+
@last_sigs_comments = T.let([], T::Array[Comment])
|
181
182
|
|
182
183
|
separate_header_comments
|
183
184
|
end
|
@@ -208,11 +209,12 @@ module RBI
|
|
208
209
|
node = parse_send(node)
|
209
210
|
current_scope << node if node
|
210
211
|
when :block
|
211
|
-
|
212
|
-
if
|
213
|
-
@last_sigs <<
|
214
|
-
|
215
|
-
|
212
|
+
rbi_node = parse_block(node)
|
213
|
+
if rbi_node.is_a?(Sig)
|
214
|
+
@last_sigs << rbi_node
|
215
|
+
@last_sigs_comments.concat(node_comments(node))
|
216
|
+
elsif rbi_node
|
217
|
+
current_scope << rbi_node
|
216
218
|
end
|
217
219
|
else
|
218
220
|
visit_all(node.children)
|
@@ -268,7 +270,7 @@ module RBI
|
|
268
270
|
params: node.children[1].children.map { |child| parse_param(child) },
|
269
271
|
sigs: current_sigs,
|
270
272
|
loc: loc,
|
271
|
-
comments: node_comments(node)
|
273
|
+
comments: current_sigs_comments + node_comments(node)
|
272
274
|
)
|
273
275
|
when :defs
|
274
276
|
Method.new(
|
@@ -277,7 +279,7 @@ module RBI
|
|
277
279
|
is_singleton: true,
|
278
280
|
sigs: current_sigs,
|
279
281
|
loc: loc,
|
280
|
-
comments: node_comments(node)
|
282
|
+
comments: current_sigs_comments + node_comments(node)
|
281
283
|
)
|
282
284
|
else
|
283
285
|
raise ParseError.new("Unsupported def node type `#{node.type}`", loc)
|
@@ -324,13 +326,13 @@ module RBI
|
|
324
326
|
case method_name
|
325
327
|
when :attr_reader
|
326
328
|
symbols = node.children[2..-1].map { |child| child.children[0] }
|
327
|
-
AttrReader.new(*symbols, sigs: current_sigs, loc: loc, comments: comments)
|
329
|
+
AttrReader.new(*symbols, sigs: current_sigs, loc: loc, comments: current_sigs_comments + comments)
|
328
330
|
when :attr_writer
|
329
331
|
symbols = node.children[2..-1].map { |child| child.children[0] }
|
330
|
-
AttrWriter.new(*symbols, sigs: current_sigs, loc: loc, comments: comments)
|
332
|
+
AttrWriter.new(*symbols, sigs: current_sigs, loc: loc, comments: current_sigs_comments + comments)
|
331
333
|
when :attr_accessor
|
332
334
|
symbols = node.children[2..-1].map { |child| child.children[0] }
|
333
|
-
AttrAccessor.new(*symbols, sigs: current_sigs, loc: loc, comments: comments)
|
335
|
+
AttrAccessor.new(*symbols, sigs: current_sigs, loc: loc, comments: current_sigs_comments + comments)
|
334
336
|
when :include
|
335
337
|
names = node.children[2..-1].map { |child| parse_expr(child) }
|
336
338
|
Include.new(*names, loc: loc, comments: comments)
|
@@ -533,6 +535,13 @@ module RBI
|
|
533
535
|
sigs
|
534
536
|
end
|
535
537
|
|
538
|
+
sig { returns(T::Array[Comment]) }
|
539
|
+
def current_sigs_comments
|
540
|
+
comments = @last_sigs_comments.dup
|
541
|
+
@last_sigs_comments.clear
|
542
|
+
comments
|
543
|
+
end
|
544
|
+
|
536
545
|
sig { void }
|
537
546
|
def assoc_dangling_comments
|
538
547
|
last_line = T.let(nil, T.nilable(Integer))
|
data/lib/rbi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre Terrasa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ast
|
@@ -107,14 +107,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 2.
|
110
|
+
version: 2.7.0
|
111
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
113
|
- - ">="
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
|
-
rubygems_version: 3.
|
117
|
+
rubygems_version: 3.3.3
|
118
118
|
signing_key:
|
119
119
|
specification_version: 4
|
120
120
|
summary: RBI generation framework
|