synvert-core 0.16.0 → 0.16.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/CHANGELOG.md +2 -0
- data/lib/synvert/core/exceptions.rb +3 -3
- data/lib/synvert/core/rewriter/instance.rb +1 -1
- data/lib/synvert/core/rewriter/scope/within_scope.rb +18 -11
- data/lib/synvert/core/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: 327989a145ffc5562768e51cf54f6a86ad2bed0b329c7398eb9499a3fa0f4b07
|
4
|
+
data.tar.gz: d7cb9ca59c8a821329b7063e515a329ab451a83ce80439028af458d9cf745804
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e3afcda5002e5d275faba969dc193e0d8f88781e647ab7fecb44bbbe3b0de383aa74bfad2341b406e148005c4ec7b44fbe941ab884f2a1968d4c81ec1cb9080
|
7
|
+
data.tar.gz: 2b504f8c0a822ae0874e154d45f811b9301bda4c7399bf4c54c365d30bf719367d17a04f0bd41fd77c618c0045901bf70e825301b3811ba023fe0f20bf1c17d5
|
data/CHANGELOG.md
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
module Synvert::Core
|
4
4
|
# Rewriter not found exception.
|
5
|
-
class RewriterNotFound <
|
5
|
+
class RewriterNotFound < RuntimeError
|
6
6
|
end
|
7
7
|
|
8
8
|
# Gemfile.lock not found exception.
|
9
|
-
class GemfileLockNotFound <
|
9
|
+
class GemfileLockNotFound < RuntimeError
|
10
10
|
end
|
11
11
|
|
12
12
|
# Method not supported exception.
|
13
|
-
class MethodNotSupported <
|
13
|
+
class MethodNotSupported < RuntimeError
|
14
14
|
end
|
15
15
|
end
|
@@ -108,7 +108,7 @@ module Synvert::Core
|
|
108
108
|
if @actions.length > 0
|
109
109
|
@actions.sort_by! { |action| action.send(@options[:sort_by]) }
|
110
110
|
conflict_actions = get_conflict_actions
|
111
|
-
@actions.
|
111
|
+
@actions.reverse_each do |action|
|
112
112
|
source[action.begin_pos...action.end_pos] = action.rewritten_code
|
113
113
|
source = remove_code_or_whole_line(source, action.line)
|
114
114
|
end
|
@@ -22,18 +22,8 @@ module Synvert::Core
|
|
22
22
|
current_node = @instance.current_node
|
23
23
|
return unless current_node
|
24
24
|
|
25
|
+
matching_nodes = find_matching_nodes(current_node)
|
25
26
|
@instance.process_with_node current_node do
|
26
|
-
matching_nodes = []
|
27
|
-
matching_nodes << current_node if current_node.match? @rules
|
28
|
-
if @options[:recursive]
|
29
|
-
current_node.recursive_children do |child_node|
|
30
|
-
matching_nodes << child_node if child_node.match? @rules
|
31
|
-
end
|
32
|
-
else
|
33
|
-
current_node.children do |child_node|
|
34
|
-
matching_nodes << child_node if child_node.match? @rules
|
35
|
-
end
|
36
|
-
end
|
37
27
|
matching_nodes.each do |matching_node|
|
38
28
|
@instance.process_with_node matching_node do
|
39
29
|
@instance.instance_eval &@block
|
@@ -41,5 +31,22 @@ module Synvert::Core
|
|
41
31
|
end
|
42
32
|
end
|
43
33
|
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def find_matching_nodes(current_node)
|
38
|
+
matching_nodes = []
|
39
|
+
if @options[:recursive]
|
40
|
+
matching_nodes << current_node if current_node.match? @rules
|
41
|
+
current_node.recursive_children do |child_node|
|
42
|
+
matching_nodes << child_node if child_node.match? @rules
|
43
|
+
end
|
44
|
+
else
|
45
|
+
current_node.each do |child_node|
|
46
|
+
matching_nodes << child_node if child_node.match? @rules
|
47
|
+
end
|
48
|
+
end
|
49
|
+
matching_nodes
|
50
|
+
end
|
44
51
|
end
|
45
52
|
end
|
data/lib/synvert/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synvert-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|