ruby2ruby 2.3.0 → 2.3.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
  SHA1:
3
- metadata.gz: eb8caf02a8d2b2af6ef49ddd52a55f62e4dc683a
4
- data.tar.gz: bbdd946629c332a35d65d9919bad429510e64218
3
+ metadata.gz: 7370313e3e5edb8daa2cbbf2fb09d692076c1b1d
4
+ data.tar.gz: 449fd3f4262f9edd0e112b5c4d5be7c2fe2804d5
5
5
  SHA512:
6
- metadata.gz: 2ac5b2af3ec0b14d74abbb17f4247b2c590bb8072b2adfae590a16a59cd5b78ef746585ff6561f56d28250407fcbdf6d565aa96934f6536280c936a5c639ceef
7
- data.tar.gz: 5b77706f664f28b47927fa6a81615719cc0ca8deedfcd090d541a80c53989292f6311794d41bbec7f1b9c328f5da167dac98567f9cc382650fbc1b5f07b623e3
6
+ metadata.gz: a9894255594551689f3b4a0a6a1043fce8506d64ee10e89d5a77d0ea045b0ed373bcac2ea56ec06b7b23cbe80696bf78c1ad27053ddb566222fc3e8b6fb58c46
7
+ data.tar.gz: 850e6856e5a10e73f013e44ecc1a0e9873149c393f1652e7afdabc84780d4d1495f841e3cf0eb5973c722c582f04411c978c20ffc3c5d2dcc6330529934d351e
@@ -1,3 +1,3 @@
1
- y��.ٻRC
2
- M����$"½?�;�S{���+����gj,b��ɕ�0%�ݓp�>
3
- ~-�Kw�g��
1
+ %�? �ܞ#C4����� R��%\7S�i�a����Y
2
+ o�%�,�*��-!�C�R#�Ϋn�]:,�Q�W�IW�����Ŵ�j(����_�ν |Zֿxfd'�^���I���Uq��9�F3��qY3�/9��6�xjZ��Ljt�Y/wJ��pL
3
+ ���g�+"GR䋎Z��E7���1�� �M�e�c1�D����*QW����'�m>��A��~E��6Y$8 f�6 t�
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,13 @@
1
+ === 2.3.1 / 2016-10-09
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Support more op_asgn nodes. (presidentbeef)
6
+
7
+ * 1 bug fix:
8
+
9
+ * Fix for non-binary 'binary' calls (eg arity > 1). (presidentbeef)
10
+
1
11
  === 2.3.0 / 2016-02-18
2
12
 
3
13
  * 3 minor enhancements:
@@ -31,7 +31,7 @@ end
31
31
  # Generate ruby code from a sexp.
32
32
 
33
33
  class Ruby2Ruby < SexpProcessor
34
- VERSION = "2.3.0" # :nodoc:
34
+ VERSION = "2.3.1" # :nodoc:
35
35
 
36
36
  # cutoff for one-liners
37
37
  LINE_LENGTH = 78
@@ -256,6 +256,8 @@ class Ruby2Ruby < SexpProcessor
256
256
  when *BINARY then
257
257
  if safe_call
258
258
  "#{receiver}&.#{name}(#{args.join(', ')})"
259
+ elsif args.length > 1
260
+ "#{receiver}.#{name}(#{args.join(', ')})"
259
261
  else
260
262
  "(#{receiver} #{name} #{args.join(', ')})"
261
263
  end
@@ -734,6 +736,16 @@ class Ruby2Ruby < SexpProcessor
734
736
  "$#{exp.shift}"
735
737
  end
736
738
 
739
+ def process_op_asgn(exp) # :nodoc:
740
+ # [[:lvar, :x], [:call, nil, :z, [:lit, 1]], :y, :"||"]
741
+ lhs = process(exp.shift)
742
+ rhs = process(exp.shift)
743
+ index = exp.shift
744
+ op = exp.shift
745
+
746
+ "#{lhs}.#{index} #{op}= #{rhs}"
747
+ end
748
+
737
749
  def process_op_asgn1(exp) # :nodoc:
738
750
  # [[:lvar, :b], [:arglist, [:lit, 1]], :"||", [:lit, 10]]
739
751
  lhs = process(exp.shift)
@@ -854,6 +866,27 @@ class Ruby2Ruby < SexpProcessor
854
866
  end
855
867
  end
856
868
 
869
+ def process_safe_op_asgn(exp) # :nodoc:
870
+ # [[:lvar, :x], [:call, nil, :z, [:lit, 1]], :y, :"||"]
871
+ lhs = process(exp.shift)
872
+ rhs = process(exp.shift)
873
+ index = exp.shift
874
+ op = exp.shift
875
+
876
+ "#{lhs}&.#{index} #{op}= #{rhs}"
877
+ end
878
+
879
+ def process_safe_op_asgn2(exp) # :nodoc:
880
+ # [[:lvar, :c], :var=, :"||", [:lit, 20]]
881
+ lhs = process(exp.shift)
882
+ index = exp.shift.to_s[0..-2]
883
+ msg = exp.shift
884
+
885
+ rhs = process(exp.shift)
886
+
887
+ "#{lhs}&.#{index} #{msg}= #{rhs}"
888
+ end
889
+
857
890
  def process_sclass(exp) # :nodoc:
858
891
  "class << #{process(exp.shift)}\n#{indent(process_block(exp))}\nend"
859
892
  end
@@ -412,6 +412,28 @@ class TestRuby2Ruby < R2RTestCase
412
412
  util_compare inn, out
413
413
  end
414
414
 
415
+ def test_safe_op_asgn
416
+ inn = s(:safe_op_asgn,
417
+ s(:call, nil, :x),
418
+ s(:call, nil, :z, s(:lit, 1)),
419
+ :y,
420
+ :+)
421
+
422
+ out = "x&.y += z(1)"
423
+ util_compare inn, out
424
+ end
425
+
426
+ def test_safe_op_asgn2
427
+ inn = s(:safe_op_asgn2,
428
+ s(:call, nil, :x),
429
+ :y=,
430
+ :"||",
431
+ s(:lit, 1))
432
+
433
+ out = "x&.y ||= 1"
434
+ util_compare inn, out
435
+ end
436
+
415
437
  def test_splat_call
416
438
  inn = s(:call, nil, :x,
417
439
  s(:splat,
@@ -515,6 +537,14 @@ class TestRuby2Ruby < R2RTestCase
515
537
  end
516
538
  end
517
539
 
540
+ def test_binary_operators_with_multiple_arguments
541
+ Ruby2Ruby::BINARY.each do |op|
542
+ inn = s(:call, s(:lvar, :x), op, s(:lit, 2), s(:lit, 3))
543
+ out = "x.#{op}(2, 3)"
544
+ util_compare inn, out
545
+ end
546
+ end
547
+
518
548
  def test_call_empty_hash
519
549
  inn = s(:call, nil, :foo, s(:hash))
520
550
  out = "foo({})"
@@ -591,6 +621,17 @@ class TestRuby2Ruby < R2RTestCase
591
621
  util_compare inn, out
592
622
  end
593
623
 
624
+ def test_op_asgn
625
+ inn = s(:op_asgn,
626
+ s(:call, nil, :x),
627
+ s(:call, nil, :z, s(:lit, 1)),
628
+ :y,
629
+ :+)
630
+
631
+ out = "x.y += z(1)"
632
+ util_compare inn, out
633
+ end
634
+
594
635
  def test_rescue_block
595
636
  inn = s(:rescue,
596
637
  s(:call, nil, :alpha),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby2ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -10,9 +10,9 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBAzANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDijCCAnKgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTE1MDkxOTIwNTEyMloXDTE2MDkxODIwNTEyMlowRTETMBEGA1UE
15
+ GRYDY29tMB4XDTE2MDkyNjAxNTczNVoXDTE3MDkyNjAxNTczNVowRTETMBEGA1UE
16
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
17
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
18
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -20,16 +20,17 @@ cert_chain:
20
20
  oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
21
21
  GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
22
22
  qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
23
-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5RfA8oQEkg8hrxA5PQSz4TOFJGLpFvIapEk6tMruQ0bHgkhr9auXg==
31
32
  -----END CERTIFICATE-----
32
- date: 2016-02-19 00:00:00.000000000 Z
33
+ date: 2016-10-09 00:00:00.000000000 Z
33
34
  dependencies:
34
35
  - !ruby/object:Gem::Dependency
35
36
  name: sexp_processor
@@ -59,20 +60,6 @@ dependencies:
59
60
  - - ~>
60
61
  - !ruby/object:Gem::Version
61
62
  version: '3.1'
62
- - !ruby/object:Gem::Dependency
63
- name: minitest
64
- requirement: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ~>
67
- - !ruby/object:Gem::Version
68
- version: '5.8'
69
- type: :development
70
- prerelease: false
71
- version_requirements: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ~>
74
- - !ruby/object:Gem::Version
75
- version: '5.8'
76
63
  - !ruby/object:Gem::Dependency
77
64
  name: rdoc
78
65
  requirement: !ruby/object:Gem::Requirement
@@ -93,14 +80,14 @@ dependencies:
93
80
  requirements:
94
81
  - - ~>
95
82
  - !ruby/object:Gem::Version
96
- version: '3.14'
83
+ version: '3.15'
97
84
  type: :development
98
85
  prerelease: false
99
86
  version_requirements: !ruby/object:Gem::Requirement
100
87
  requirements:
101
88
  - - ~>
102
89
  - !ruby/object:Gem::Version
103
- version: '3.14'
90
+ version: '3.15'
104
91
  description: |-
105
92
  ruby2ruby provides a means of generating pure ruby code easily from
106
93
  RubyParser compatible Sexps. This makes making dynamic language
metadata.gz.sig CHANGED
Binary file