synvert-core 0.57.0 → 0.57.1

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: '01935a8e5222f3058d6bcca0057cbe684ce0a43dabeaeac97dac0aa17c230b79'
4
- data.tar.gz: 427851e9745c4c960b1f437c397e9332ebf6a8df4126c58652927c9810db7d05
3
+ metadata.gz: d308267b7dc3f8561869a44ab25b6ffb329f4dfbc04ae66e960de167faa1ee4a
4
+ data.tar.gz: c6863adae12f49e7d8c0eb79c336f11b5dfaead8b7679a32c32a2131a0cd2ccf
5
5
  SHA512:
6
- metadata.gz: 50a73df1cb5034afeb269776f5e4bf76873b236e490fa54e6bffd91dabfb2726260b99bca95230022314be890454645b8c032c4006c22271a7a460c50b77e3dc
7
- data.tar.gz: c7ca6e209b229a3951b6846173268d254034e3ff9480e47add2e7649326ab004d806f09ec784fdf86154c8414c7e9e947e6ea72e6fbc5c2d65018f1909928e18
6
+ metadata.gz: ce3db59d4d4d047c4abafbe3130252615bf601fc980c601d93552777105c646eb76174e04ae5e7af16004570f4d091c7549c40c5b5b0e803ab8eb916607ae34a
7
+ data.tar.gz: 2095af835a69d267a8d78112752aa553c002cb0699f3ca082b2ef0600e95b772eba9aae76cbd863ae3e8d7a7101c92942e03ae89e34d0c3abd6a636a5b65ac29
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.57.1 (2021-10-18)
4
+
5
+ * Support `left_value` and `right_value` for `and` and `or` node
6
+
3
7
  ## 0.57.0 (2021-10-02)
4
8
 
5
9
  * Compare ruby version in `.ruby-version` or `.rvmrc`
@@ -215,7 +215,7 @@ module Parser::AST
215
215
  # @return [Parser::AST::Node] variable nodes.
216
216
  # @raise [Synvert::Core::MethodNotSupported] if calls on other node.
217
217
  def left_value
218
- if %i[masgn lvasgn ivasgn cvasgn].include? type
218
+ if %i[masgn lvasgn ivasgn cvasgn and or].include? type
219
219
  children[0]
220
220
  elsif :or_asgn == type
221
221
  children[0].children[0]
@@ -229,7 +229,7 @@ module Parser::AST
229
229
  # @return [Array<Parser::AST::Node>] variable nodes.
230
230
  # @raise [Synvert::Core::MethodNotSupported] if calls on other node.
231
231
  def right_value
232
- if %i[masgn lvasgn ivasgn cvasgn or_asgn].include? type
232
+ if %i[masgn lvasgn ivasgn cvasgn or_asgn and or].include? type
233
233
  children[1]
234
234
  else
235
235
  raise Synvert::Core::MethodNotSupported, "right_value is not handled for #{debug_info}"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Synvert
4
4
  module Core
5
- VERSION = '0.57.0'
5
+ VERSION = '0.57.1'
6
6
  end
7
7
  end
@@ -291,6 +291,16 @@ describe Parser::AST::Node do
291
291
  node = parse('a ||= 1')
292
292
  expect(node.left_value).to eq :a
293
293
  end
294
+
295
+ it 'gets for and' do
296
+ node = parse('foo && bar')
297
+ expect(node.left_value).to eq parse('foo')
298
+ end
299
+
300
+ it 'gets for or' do
301
+ node = parse('foo || bar')
302
+ expect(node.left_value).to eq parse('foo')
303
+ end
294
304
  end
295
305
 
296
306
  describe '#right_value' do
@@ -323,6 +333,16 @@ describe Parser::AST::Node do
323
333
  node = parse('a ||= 1')
324
334
  expect(node.right_value).to eq parse('1')
325
335
  end
336
+
337
+ it 'gets for and' do
338
+ node = parse('foo && bar')
339
+ expect(node.right_value).to eq parse('bar')
340
+ end
341
+
342
+ it 'gets for or' do
343
+ node = parse('foo || bar')
344
+ expect(node.right_value).to eq parse('bar')
345
+ end
326
346
  end
327
347
 
328
348
  describe '#to_value' do
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.57.0
4
+ version: 0.57.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-10-02 00:00:00.000000000 Z
11
+ date: 2021-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport