synvert-core 1.21.1 → 1.21.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be7c1313bb5e789a3f3dd489b4e3ef579b9ddd41e4bf65a14b28b96e05b4ddb3
4
- data.tar.gz: 32f69ddc1ac839e3e1d29addaadc2dc9b7119b0dbec3c4de4bf9ccc533dbe5cc
3
+ metadata.gz: 915cd8e6315447109e8088653613c14e536228cba9bbd14b7da5470488a186cf
4
+ data.tar.gz: aac013556d193b8f5948e7b227dcfe7716eb70daa02bc32983b6f60d13804921
5
5
  SHA512:
6
- metadata.gz: c0d28b3a39c908abaf543d2e9534827be828db8ab75d1e24d97e1ca9ca3d6ef3fb20dbee9e984cbaedec20b706b1732dbefdd0c45665a65a0bd822223f541dfa
7
- data.tar.gz: db045c50ecdea16622e9cfc5b72f367336486c3e0f7ee7c8f6e727606638d363fa28bfef297fa8de61327a3d6eece65f33f4d0c0bcf671599fb1cb9b82663d30
6
+ metadata.gz: c2d6997dc73ec8bbe4b1b96691f457fd9050be0fb1757651931fbe0f522fce2495e070a20d50905f47495c72034e82e00fecc4a35e56b1088e194390e406b3d3
7
+ data.tar.gz: 44f4c940be6497eeaf54aaa0f6d2688bb0da2319250dc2a6f8ace0756bfcf51f1fdd15ea7e25baa4f899cdc860e746ea9bfe9a669bfb7d39c2aa6c1306048d67
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.21.2 (2023-02-11)
4
+
5
+ * Call block multiple times when goto node array
6
+ * Update `node_mutation` to 1.9.2
7
+
3
8
  ## 1.21.1 (2023-02-10)
4
9
 
5
10
  * Add `tab_size` option to `add_leading_spaces`
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- synvert-core (1.21.1)
4
+ synvert-core (1.21.2)
5
5
  activesupport (< 7.0.0)
6
6
  erubis
7
- node_mutation (>= 1.9.0)
7
+ node_mutation (>= 1.9.2)
8
8
  node_query (>= 1.12.0)
9
9
  parallel
10
10
  parser
@@ -50,7 +50,7 @@ GEM
50
50
  method_source (1.0.0)
51
51
  minitest (5.17.0)
52
52
  nenv (0.3.0)
53
- node_mutation (1.9.0)
53
+ node_mutation (1.9.2)
54
54
  erubis
55
55
  node_query (1.12.0)
56
56
  notiffany (0.1.3)
@@ -85,7 +85,7 @@ GEM
85
85
  thor (1.2.1)
86
86
  tzinfo (2.0.6)
87
87
  concurrent-ruby (~> 1.0)
88
- zeitwerk (2.6.6)
88
+ zeitwerk (2.6.7)
89
89
 
90
90
  PLATFORMS
91
91
  ruby
@@ -22,8 +22,16 @@ module Synvert::Core
22
22
  @child_node_name.to_s.split('.').each do |child_node_name|
23
23
  child_node = child_node_name.is_a?(Parser::AST::Node) ? child_node_name : child_node.send(child_node_name)
24
24
  end
25
- @instance.process_with_other_node child_node do
26
- @instance.instance_eval(&@block)
25
+ if child_node.is_a?(Array)
26
+ child_node.each do |child_child_node|
27
+ @instance.process_with_other_node child_child_node do
28
+ @instance.instance_eval(&@block)
29
+ end
30
+ end
31
+ else
32
+ @instance.process_with_other_node child_node do
33
+ @instance.instance_eval(&@block)
34
+ end
27
35
  end
28
36
  end
29
37
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Synvert
4
4
  module Core
5
- VERSION = '1.21.1'
5
+ VERSION = '1.21.2'
6
6
  end
7
7
  end
@@ -10,6 +10,8 @@ module Synvert::Core
10
10
  }
11
11
  let(:source) { <<~EOS }
12
12
  Factory.define :user do |user|
13
+ user.first_name 'First'
14
+ user.last_name 'Last'
13
15
  end
14
16
  EOS
15
17
 
@@ -17,7 +19,7 @@ module Synvert::Core
17
19
  before { instance.current_node = node }
18
20
 
19
21
  describe '#process' do
20
- it 'call block with child node' do
22
+ it 'calls block with child node' do
21
23
  run = false
22
24
  type_in_scope = nil
23
25
  scope =
@@ -30,6 +32,17 @@ module Synvert::Core
30
32
  expect(type_in_scope).to eq :const
31
33
  expect(instance.current_node.type).to eq :block
32
34
  end
35
+
36
+ it 'calls block multiple times with blok body' do
37
+ count = 0
38
+ scope =
39
+ Rewriter::GotoScope.new instance, 'body' do
40
+ count += 1
41
+ end
42
+ scope.process
43
+ expect(count).to eq 2
44
+ expect(instance.current_node.type).to eq :block
45
+ end
33
46
  end
34
47
  end
35
48
  end
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_runtime_dependency "activesupport", "< 7.0.0"
23
23
  spec.add_runtime_dependency "erubis"
24
24
  spec.add_runtime_dependency "node_query", ">= 1.12.0"
25
- spec.add_runtime_dependency "node_mutation", ">= 1.9.0"
25
+ spec.add_runtime_dependency "node_mutation", ">= 1.9.2"
26
26
  spec.add_runtime_dependency "parser"
27
27
  spec.add_runtime_dependency "parser_node_ext", ">= 0.9.0"
28
28
  spec.add_runtime_dependency "parallel"
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: 1.21.1
4
+ version: 1.21.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-10 00:00:00.000000000 Z
11
+ date: 2023-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 1.9.0
61
+ version: 1.9.2
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 1.9.0
68
+ version: 1.9.2
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: parser
71
71
  requirement: !ruby/object:Gem::Requirement