to_source 0.2.19 → 0.2.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ # v0.2.19 2013-03-30
2
+
3
+ * [fix] Op assign 2 operators (self.foo ||= bar, etc) [nevir]
4
+
5
+ [Compare v0.2.19..v0.2.20](https://github.com/mbj/to_source/compare/v0.2.18...v0.2.20)
6
+
1
7
  # v0.2.19 2013-03-1
2
8
 
3
9
  * [change] Bump dependencies
@@ -6,144 +12,144 @@
6
12
 
7
13
  # v0.2.18 2013-01-29
8
14
 
9
- * [fixed] Emit ranges in parantheses to resolve ambiguity
15
+ * [fix] Emit ranges in parantheses to resolve ambiguity
10
16
 
11
17
  [Compare v0.2.17..v0.2.18](https://github.com/mbj/to_source/compare/v0.2.17...v0.2.18)
12
18
 
13
19
  # v0.2.17 2013-01-26
14
20
 
15
- * [fixed] Fix op assign 1 operators with implicit index array[] ||= etc
16
- * [fixed] Fix op assign 1 operators with explicit index array[foo] ||= etc
17
- * [fixed] Add support regexp in if statements with implicit haystack (Rubinius::AST::Match)
18
- * [fixed] Add support for Rubionius::AST::Flip{2,3} (flip flops)
19
- * [fixed] Add support for Rubionius::AST::VAlias
20
- * [fixed] Fix multiple edge cases with array literals and splats
21
- * [fixed] Add support for mixed splat arguments
22
- * [fixed] Add support for __ENCODING__
23
- * [fixed] Fix emit of splat arguments to binary method operators
24
- * [fixed] Fix multiple assigments when assigning to element with splat index
25
- * [fixed] Add support for retry
26
- * [fixed] Add support for redo
27
- * [fixed] Add support rubinius specific type constant
28
- * [fixed] Add support for dynamic once literal
29
- * [fixed] Emit regexp options for single and dynamic literals
30
- * [fixed] Add support for undef keyword
31
- * [fixed] Add support toplevel module name
32
- * [fixed] Fix regexp emitter for edge cases
33
- * [fixed] Fix element reference with splat arguments
34
- * [fixed] Add support for construct
35
- * [fixed] Add support splat assigmnent in multiple assignment
36
- * [fixed] Add support for /s/ =~ foo (Rubinius::AST::Match2)
37
- * [fixed] Add support for $` (Rubinius::AST::BackRef)
38
- * [fixed] Support multiple assignments also for attribute and element assignments
21
+ * [fix] Fix op assign 1 operators with implicit index array[] ||= etc
22
+ * [fix] Fix op assign 1 operators with explicit index array[foo] ||= etc
23
+ * [fix] Add support regexp in if statements with implicit haystack (Rubinius::AST::Match)
24
+ * [fix] Add support for Rubionius::AST::Flip{2,3} (flip flops)
25
+ * [fix] Add support for Rubionius::AST::VAlias
26
+ * [fix] Fix multiple edge cases with array literals and splats
27
+ * [fix] Add support for mixed splat arguments
28
+ * [fix] Add support for __ENCODING__
29
+ * [fix] Fix emit of splat arguments to binary method operators
30
+ * [fix] Fix multiple assigments when assigning to element with splat index
31
+ * [fix] Add support for retry
32
+ * [fix] Add support for redo
33
+ * [fix] Add support rubinius specific type constant
34
+ * [fix] Add support for dynamic once literal
35
+ * [fix] Emit regexp options for single and dynamic literals
36
+ * [fix] Add support for undef keyword
37
+ * [fix] Add support toplevel module name
38
+ * [fix] Fix regexp emitter for edge cases
39
+ * [fix] Fix element reference with splat arguments
40
+ * [fix] Add support for construct
41
+ * [fix] Add support splat assigmnent in multiple assignment
42
+ * [fix] Add support for /s/ =~ foo (Rubinius::AST::Match2)
43
+ * [fix] Add support for $` (Rubinius::AST::BackRef)
44
+ * [fix] Support multiple assignments also for attribute and element assignments
39
45
 
40
46
  [Compare v0.2.16..v0.2.17](https://github.com/mbj/to_source/compare/v0.2.16...v0.2.17)
41
47
 
42
48
  # v0.2.16 2013-01-25
43
49
 
44
- * [fixed] Handle Rubinius::AST::Case
50
+ * [fix] Handle Rubinius::AST::Case
45
51
 
46
52
  [Compare v0.2.15..v0.2.16](https://github.com/mbj/to_source/compare/v0.2.15...v0.2.16)
47
53
 
48
54
  # v0.2.15 2013-01-24
49
55
 
50
- * [fixed] Emit dynamic regexp literals with split groups correctly
56
+ * [fix] Emit dynamic regexp literals with split groups correctly
51
57
 
52
58
  [Compare v0.2.14..v0.2.15](https://github.com/mbj/to_source/compare/v0.2.14...v0.2.15)
53
59
 
54
60
  # v0.2.14 2013-01-09
55
61
 
56
- * [fixed] Emit send with arguments and body correctly
62
+ * [fix] Emit send with arguments and body correctly
57
63
 
58
64
  [Compare v0.2.13..v0.2.14](https://github.com/mbj/to_source/compare/v0.2.13...v0.2.14)
59
65
 
60
66
  # v0.2.13 2013-01-09
61
67
 
62
- * [fixed] Emit send with arguments and body correctly
68
+ * [fix] Emit send with arguments and body correctly
63
69
 
64
70
  [Compare v0.2.12..v0.2.13](https://github.com/mbj/to_source/compare/v0.2.12...v0.2.13)
65
71
 
66
72
  # v0.2.12 2013-01-09
67
73
 
68
- * [fixed] Emit edge cases with dynamic literals correctly
74
+ * [fix] Emit edge cases with dynamic literals correctly
69
75
 
70
76
  [Compare v0.2.11..v0.2.12](https://github.com/mbj/to_source/compare/v0.2.11...v0.2.12)
71
77
 
72
78
  # v0.2.11 2013-01-09
73
79
 
74
- * [fixed] Allow all nodes to be entrypoints
80
+ * [fix] Allow all nodes to be entrypoints
75
81
 
76
82
  [Compare v0.2.10..v0.2.11](https://github.com/mbj/to_source/compare/v0.2.10...v0.2.11)
77
83
 
78
84
  # v0.2.10 2013-01-07
79
85
 
80
86
  * [Changed] Rewrote internals compleatly, no outer API change
81
- * [fixed] Emit indentation of complex nested structures with rescue statements correctly
87
+ * [fix] Emit indentation of complex nested structures with rescue statements correctly
82
88
 
83
89
  [Compare v0.2.9..v0.2.10](https://github.com/mbj/to_source/compare/v0.2.9...v0.2.10)
84
90
 
85
91
  # v0.2.9 2013-01-04
86
92
 
87
- * [fixed] Handle regexp literals containing slashes in non shash delimiters %r(/) correctly
93
+ * [fix] Handle regexp literals containing slashes in non shash delimiters %r(/) correctly
88
94
 
89
95
  [Compare v0.2.8..v0.2.9](https://github.com/mbj/to_source/compare/v0.2.8...v0.2.9)
90
96
 
91
97
  # v0.2.8 2013-01-03
92
98
 
93
99
  * [Changed] Emit many times more ugly code, but correctnes > beautifulnes
94
- * [fixed] Emit break with parantheses
95
- * [fixed] Emit op assign and as "&&="
96
- * [fixed] Emit op assign or as "||="
100
+ * [fix] Emit break with parantheses
101
+ * [fix] Emit op assign and as "&&="
102
+ * [fix] Emit op assign or as "||="
97
103
 
98
104
  [Compare v0.2.7..v0.2.8](https://github.com/mbj/to_source/compare/v0.2.7...v0.2.8)
99
105
 
100
106
  # v0.2.7 2013-01-02
101
107
 
102
- * [fixed] Emit super with blocks correctly
108
+ * [fix] Emit super with blocks correctly
103
109
 
104
110
  [Compare v0.2.6..v0.2.7](https://github.com/mbj/to_source/compare/v0.2.6...v0.2.7)
105
111
 
106
112
  # v0.2.6 2013-01-01
107
113
 
108
- * [fixed] Emit super vs super() correctly
114
+ * [fix] Emit super vs super() correctly
109
115
 
110
116
  [Compare v0.2.5..v0.2.6](https://github.com/mbj/to_source/compare/v0.2.5...v0.2.6)
111
117
 
112
118
  # v0.2.5 2012-12-14
113
119
 
114
- * [fixed] Emit unary operators correctly
115
- * [fixed] Define with optional splat and block argument
116
- * [fixed] Emit arguments to break keyword
120
+ * [fix] Emit unary operators correctly
121
+ * [fix] Define with optional splat and block argument
122
+ * [fix] Emit arguments to break keyword
117
123
  * [change] Uglify output of binary operators with unneded paranteses. Correct output > nice output.
118
- * [fixed] Emit nested binary operators correctly.
119
- * [fixed] Emit element reference on self correctly. self[foo].
124
+ * [fix] Emit nested binary operators correctly.
125
+ * [fix] Emit element reference on self correctly. self[foo].
120
126
 
121
127
  [Compare v0.2.4..v0.2.5](https://github.com/mbj/to_source/compare/v0.2.4...v0.2.5)
122
128
 
123
129
  # v0.2.4 2012-12-07
124
130
 
125
131
  * [feature] Allow to emit pattern variables as root node
126
- * [fixed] Emit send with splat and block argument correctly
132
+ * [fix] Emit send with splat and block argument correctly
127
133
 
128
134
  [Compare v0.2.3..v0.2.4](https://github.com/mbj/to_source/compare/v0.2.3...v0.2.4)
129
135
 
130
136
  # v0.2.3 2012-12-07
131
137
 
132
- * [fixed] Nuke dangling require (sorry for not running specs after gemspec change)
138
+ * [fix] Nuke dangling require (sorry for not running specs after gemspec change)
133
139
 
134
140
  [Compare v0.2.2..v0.2.3](https://github.com/mbj/to_source/compare/v0.2.2...v0.2.3)
135
141
 
136
142
  # v0.2.2 2012-12-07
137
143
 
138
- * [fixed] Emit of pattern arguments with no formal arguments present
139
- * [fixed] Missed to require set
144
+ * [fix] Emit of pattern arguments with no formal arguments present
145
+ * [fix] Missed to require set
140
146
 
141
147
  [Compare v0.2.1..v0.2.2](https://github.com/mbj/to_source/compare/v0.2.1...v0.2.2)
142
148
 
143
149
  # v0.2.1 2012-12-07
144
150
 
145
- * [fixed] Emit of def on splat with block
146
- * [fixed] Emit of pattern args
151
+ * [fix] Emit of def on splat with block
152
+ * [fix] Emit of pattern args
147
153
 
148
154
  [Compare v0.2.0..v0.2.1](https://github.com/mbj/to_source/compare/v0.2.0...v0.2.1)
149
155
 
@@ -151,10 +157,10 @@
151
157
 
152
158
  * [BRAKING CHANGE] Remove core extension Rubinius::AST::Node#to_source (mbj)
153
159
  * [feature] Add support for MRI via melbourne gem (mbj)
154
- * [fixed] 100% Yard covered documentation (mbj)
155
- * [fixed] Emit most binary operators without parantheses (mbj)
160
+ * [fix] 100% Yard covered documentation (mbj)
161
+ * [fix] Emit most binary operators without parantheses (mbj)
156
162
  * [feature] Port tests to rspec2 and greatly improve coverage and layout of these.
157
163
  * [feature] Introduce metric tools via devtools
158
- * [fixed] Lots of transitvity edge cases
164
+ * [fix] Lots of transitvity edge cases
159
165
 
160
166
  [Compare v0.1.3..v0.2.0](https://github.com/mbj/to_source/ompare/v0.1.3...v0.2.0)
@@ -18,10 +18,26 @@ module ToSource
18
18
  visit(util.receiver)
19
19
  emit('.')
20
20
  emit(util.name)
21
- emit(' |= ')
21
+ emit(" #{operator} ")
22
22
  visit(util.value)
23
23
  end
24
24
 
25
+ MAPPING = {
26
+ :or => :'||',
27
+ :and => :'&&'
28
+ }.freeze
29
+
30
+ # Return operator
31
+ #
32
+ # @return [String]
33
+ #
34
+ # @api private
35
+ #
36
+ def operator
37
+ op = node.op
38
+ "#{MAPPING.fetch(op, op)}="
39
+ end
40
+
25
41
  end
26
42
  end
27
43
  end
@@ -182,12 +182,15 @@ describe ToSource,'.to_source' do
182
182
  end
183
183
  end
184
184
 
185
- context 'conditional element assignment' do
186
- assert_source 'foo[key] ||= bar'
187
- end
188
185
 
189
- context 'attribute assignment on merge' do
190
- assert_source 'self.foo |= bar'
186
+ %w(|= ||= &= &&= += -= *= /= **= %=).each do |op|
187
+ context "conditional attribute #{op} assignment" do
188
+ assert_source "self.foo #{op} bar"
189
+ end
190
+
191
+ context "conditional element #{op} assignment" do
192
+ assert_source "foo[key] #{op} bar"
193
+ end
191
194
  end
192
195
 
193
196
 
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'to_source'
4
- s.version = '0.2.19'
4
+ s.version = '0.2.20'
5
5
  s.authors = ['Markus Schirp']
6
6
  s.email = ['mbj@seonic.net']
7
7
  s.homepage = 'http://github.com/mbj/to_source'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: to_source
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.19
4
+ version: 0.2.20
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-01 00:00:00.000000000 Z
12
+ date: 2013-03-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: adamantium