rbi 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbi/rewriters/remove_known_definitions.rb +20 -2
- data/lib/rbi/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e263b24187c9a9f490f5c29a249d22d2ee564a2a59aaea3f79eb62cbff8ac24f
|
4
|
+
data.tar.gz: c5bd9aed9462d42b8dddef6b6c8bfe001224747b49ee1ad187721daf9ac946d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1174676242d2ed3cfdebc28bc6eb70789d249cf10c4e5d8fceab47c58024b8db4a3f4bad9609c7543e510e6d85b6f321fc0ee65ce8d4204fee417bafb1e44510
|
7
|
+
data.tar.gz: 29f7a0b48aa474e3f970bba94e85fc6621ed9449f99c7249c2056a79ae5418b0c9b0e5e6ee97b37c5244e83c1514851a59a998a932e3c4ef36ef308b61036662
|
@@ -83,12 +83,12 @@ module RBI
|
|
83
83
|
when RBI::Scope
|
84
84
|
visit_all(node.nodes)
|
85
85
|
previous = previous_definition_for(node)
|
86
|
-
delete_node(node, previous) if previous && node
|
86
|
+
delete_node(node, previous) if previous && can_delete_node?(node, previous)
|
87
87
|
when RBI::Tree
|
88
88
|
visit_all(node.nodes)
|
89
89
|
when RBI::Indexable
|
90
90
|
previous = previous_definition_for(node)
|
91
|
-
delete_node(node, previous) if previous
|
91
|
+
delete_node(node, previous) if previous && can_delete_node?(node, previous)
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
@@ -103,6 +103,24 @@ module RBI
|
|
103
103
|
nil
|
104
104
|
end
|
105
105
|
|
106
|
+
sig { params(node: Node, previous: Node).returns(T::Boolean) }
|
107
|
+
def can_delete_node?(node, previous)
|
108
|
+
return false unless node.class == previous.class
|
109
|
+
|
110
|
+
case node
|
111
|
+
when Scope
|
112
|
+
node.empty?
|
113
|
+
when Attr
|
114
|
+
previous = T.cast(previous, Attr)
|
115
|
+
node.names == previous.names && node.sigs == previous.sigs
|
116
|
+
when Method
|
117
|
+
previous = T.cast(previous, Method)
|
118
|
+
node.params == previous.params && node.sigs == previous.sigs
|
119
|
+
else
|
120
|
+
true
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
106
124
|
sig { params(node: RBI::Node, previous: RBI::Node).void }
|
107
125
|
def delete_node(node, previous)
|
108
126
|
node.detach
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre Terrasa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ast
|