synvert-core 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/synvert/core/node_ext.rb +3 -9
- data/lib/synvert/core/version.rb +1 -1
- data/spec/synvert/core/node_ext_spec.rb +7 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 147d5855d29224ef920cd0249c021c0825f52ae7
|
4
|
+
data.tar.gz: 151c8fcd306d95ac3e401f6b5e7c266dde352bd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efd95157a71e181ad15658aa06c3ddb41d85a80801ecb118cd4d74877db98bdfaf9a6ff66d9838deca432cdcbd3cc122c572c6998120053a3711db6ac6ea02b2
|
7
|
+
data.tar.gz: 4d7105931e33abe42f7d6722e9948251151155db3ee401ecb6f187228c67226b0662f831dc45b3de0050a4bf280400781c20c1b6d3b43251889e28635030b8d1
|
data/CHANGELOG.md
CHANGED
@@ -214,13 +214,10 @@ module Parser::AST
|
|
214
214
|
|
215
215
|
# Return the left value.
|
216
216
|
#
|
217
|
-
# @return [
|
217
|
+
# @return [Parser::AST::Node] variable nodes.
|
218
218
|
# @raise [Synvert::Core::MethodNotSupported] if calls on other node.
|
219
219
|
def left_value
|
220
|
-
|
221
|
-
when :masgn
|
222
|
-
self.children[0].children
|
223
|
-
when :lvasgn, :ivasgn
|
220
|
+
if [:masgn, :lvasgn, :ivasgn].include? self.type
|
224
221
|
self.children[0]
|
225
222
|
else
|
226
223
|
raise Synvert::Core::MethodNotSupported.new "left_value is not handled for #{self.debug_info}"
|
@@ -232,10 +229,7 @@ module Parser::AST
|
|
232
229
|
# @return [Array<Parser::AST::Node>] variable nodes.
|
233
230
|
# @raise [Synvert::Core::MethodNotSupported] if calls on other node.
|
234
231
|
def right_value
|
235
|
-
|
236
|
-
when :masgn
|
237
|
-
self.children[1].children
|
238
|
-
when :lvasgn, :ivasgn
|
232
|
+
if [:masgn, :lvasgn, :ivasgn].include? self.type
|
239
233
|
self.children[1]
|
240
234
|
else
|
241
235
|
raise Synvert::Core::MethodNotSupported.new "right_value is not handled for #{self.debug_info}"
|
data/lib/synvert/core/version.rb
CHANGED
@@ -190,7 +190,7 @@ describe Parser::AST::Node do
|
|
190
190
|
describe "#left_value" do
|
191
191
|
it 'gets for masgn' do
|
192
192
|
node = parse("a, b = 1, 2")
|
193
|
-
expect(node.left_value.
|
193
|
+
expect(node.left_value.to_source).to eq 'a, b'
|
194
194
|
end
|
195
195
|
|
196
196
|
it 'gets for lvasgn' do
|
@@ -207,7 +207,12 @@ describe Parser::AST::Node do
|
|
207
207
|
describe "#right_value" do
|
208
208
|
it 'gets for masgn' do
|
209
209
|
node = parse("a, b = 1, 2")
|
210
|
-
expect(node.right_value).to eq
|
210
|
+
expect(node.right_value).to eq parse('[1, 2]')
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'gets for masgn' do
|
214
|
+
node = parse("a, b = params")
|
215
|
+
expect(node.right_value).to eq parse("params")
|
211
216
|
end
|
212
217
|
|
213
218
|
it 'gets for lvasgn' do
|