to_source 0.2.12 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Changelog.md +7 -1
- data/config/flay.yml +2 -2
- data/config/flog.yml +1 -1
- data/config/site.reek +9 -8
- data/config/yardstick.yml +1 -1
- data/lib/to_source.rb +2 -3
- data/lib/to_source/emitter.rb +13 -0
- data/lib/to_source/emitter/literal.rb +14 -13
- data/lib/to_source/emitter/loop.rb +37 -0
- data/lib/to_source/emitter/match3.rb +3 -2
- data/lib/to_source/emitter/module.rb +4 -4
- data/lib/to_source/emitter/multiple_assignment.rb +10 -3
- data/lib/to_source/emitter/op_assign1.rb +4 -3
- data/lib/to_source/emitter/op_assign2.rb +4 -3
- data/lib/to_source/emitter/rescue.rb +3 -2
- data/lib/to_source/emitter/rescue_condition.rb +10 -10
- data/lib/to_source/emitter/scoped_name.rb +6 -2
- data/lib/to_source/emitter/send.rb +32 -12
- data/lib/to_source/emitter/send_with_arguments.rb +13 -18
- data/lib/to_source/emitter/singleton_class.rb +8 -5
- data/lib/to_source/emitter/unary_operator_method.rb +2 -2
- data/lib/to_source/emitter/unless.rb +12 -2
- data/lib/to_source/emitter/util.rb +3 -2
- data/lib/to_source/emitter/yield.rb +1 -1
- data/spec/unit/to_source/class_methods/run_spec.rb +25 -9
- data/to_source.gemspec +1 -1
- metadata +2 -3
- data/lib/to_source/emitter/until.rb +0 -20
- data/lib/to_source/emitter/while.rb +0 -20
data/Changelog.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
# v0.2.
|
1
|
+
# v0.2.13 2013-01-9
|
2
|
+
|
3
|
+
* [fixed] Emit send with arguments and body correctly
|
4
|
+
|
5
|
+
[Compare v0.2.12..v0.2.13](https://github.com/mbj/to_source/compare/v0.2.12...v0.2.13)
|
6
|
+
|
7
|
+
# v0.2.12 2013-01-9
|
2
8
|
|
3
9
|
* [fixed] Emit edge cases with dynamic literals correctly
|
4
10
|
|
data/config/flay.yml
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
---
|
2
|
-
threshold:
|
3
|
-
total_score:
|
2
|
+
threshold: 40
|
3
|
+
total_score: 619
|
data/config/flog.yml
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
---
|
2
|
-
threshold:
|
2
|
+
threshold: 22.2
|
data/config/site.reek
CHANGED
@@ -8,9 +8,8 @@ UncommunicativeParameterName:
|
|
8
8
|
- !ruby/regexp /[0-9]$/
|
9
9
|
- !ruby/regexp /[A-Z]/
|
10
10
|
LargeClass:
|
11
|
-
max_methods:
|
12
|
-
exclude:
|
13
|
-
- "Mutant::Matcher::Method" # 13 methods
|
11
|
+
max_methods: 11
|
12
|
+
exclude: []
|
14
13
|
enabled: true
|
15
14
|
max_instance_variables: 3
|
16
15
|
UncommunicativeMethodName:
|
@@ -23,8 +22,7 @@ UncommunicativeMethodName:
|
|
23
22
|
- !ruby/regexp /[A-Z]/
|
24
23
|
LongParameterList:
|
25
24
|
max_params: 2
|
26
|
-
exclude:
|
27
|
-
- "Mutant::Context::Constant#initialize" # 3 params
|
25
|
+
exclude: []
|
28
26
|
enabled: true
|
29
27
|
overrides: {}
|
30
28
|
FeatureEnvy:
|
@@ -38,9 +36,12 @@ BooleanParameter:
|
|
38
36
|
enabled: true
|
39
37
|
IrresponsibleModule:
|
40
38
|
exclude: []
|
41
|
-
enabled:
|
39
|
+
enabled: false
|
42
40
|
UncommunicativeModuleName:
|
43
|
-
accept:
|
41
|
+
accept:
|
42
|
+
- ToSource::Emitter::Match3
|
43
|
+
- ToSource::Emitter::OpAssign1
|
44
|
+
- ToSource::Emitter::OpAssign2
|
44
45
|
exclude: []
|
45
46
|
enabled: true
|
46
47
|
reject:
|
@@ -52,7 +53,7 @@ NestedIterators:
|
|
52
53
|
enabled: true
|
53
54
|
max_allowed_nesting: 1
|
54
55
|
LongMethod:
|
55
|
-
max_statements:
|
56
|
+
max_statements: 7
|
56
57
|
exclude: []
|
57
58
|
enabled: true
|
58
59
|
Duplication:
|
data/config/yardstick.yml
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
---
|
2
|
-
threshold:
|
2
|
+
threshold: 63.4
|
data/lib/to_source.rb
CHANGED
@@ -30,9 +30,9 @@ require 'to_source/emitter/scoped_name'
|
|
30
30
|
require 'to_source/emitter/send'
|
31
31
|
require 'to_source/emitter/send_with_arguments'
|
32
32
|
require 'to_source/emitter/block_pass'
|
33
|
+
require 'to_source/emitter/block_argument'
|
33
34
|
require 'to_source/emitter/iter'
|
34
35
|
require 'to_source/emitter/pattern_arguments'
|
35
|
-
require 'to_source/emitter/block_argument'
|
36
36
|
require 'to_source/emitter/unary_operator_method'
|
37
37
|
require 'to_source/emitter/binary_operator_method'
|
38
38
|
require 'to_source/emitter/binary_operator'
|
@@ -43,13 +43,12 @@ require 'to_source/emitter/defined'
|
|
43
43
|
require 'to_source/emitter/attribute_assignment'
|
44
44
|
require 'to_source/emitter/element_assignment'
|
45
45
|
require 'to_source/emitter/if'
|
46
|
-
require 'to_source/emitter/
|
46
|
+
require 'to_source/emitter/loop'
|
47
47
|
require 'to_source/emitter/ensure'
|
48
48
|
require 'to_source/emitter/receiver_case'
|
49
49
|
require 'to_source/emitter/when'
|
50
50
|
require 'to_source/emitter/splat_when'
|
51
51
|
require 'to_source/emitter/unless'
|
52
|
-
require 'to_source/emitter/until'
|
53
52
|
require 'to_source/emitter/class'
|
54
53
|
require 'to_source/emitter/module'
|
55
54
|
require 'to_source/emitter/op_assign2'
|
data/lib/to_source/emitter.rb
CHANGED
@@ -65,6 +65,19 @@ module ToSource
|
|
65
65
|
emitter.new(node, buffer)
|
66
66
|
end
|
67
67
|
|
68
|
+
def self.delegate(*names)
|
69
|
+
names.each do |name|
|
70
|
+
define_delegator(name)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.define_delegator(name)
|
75
|
+
define_method(name) do
|
76
|
+
node.public_send(name)
|
77
|
+
end
|
78
|
+
private name
|
79
|
+
end
|
80
|
+
|
68
81
|
attr_reader :buffer
|
69
82
|
|
70
83
|
def initialize(node, buffer)
|
@@ -29,9 +29,10 @@ module ToSource
|
|
29
29
|
private
|
30
30
|
|
31
31
|
def dispatch
|
32
|
-
|
32
|
+
util = node
|
33
|
+
visit(util.start)
|
33
34
|
emit(token)
|
34
|
-
visit(
|
35
|
+
visit(util.finish)
|
35
36
|
end
|
36
37
|
|
37
38
|
def token
|
@@ -54,26 +55,26 @@ module ToSource
|
|
54
55
|
|
55
56
|
handle(Rubinius::AST::HashLiteral)
|
56
57
|
|
57
|
-
|
58
|
-
body = node.array.each_slice(2).to_a
|
59
|
-
|
60
|
-
max = body.length - 1
|
58
|
+
private
|
61
59
|
|
60
|
+
def dispatch
|
62
61
|
emit '{'
|
62
|
+
emit_body
|
63
|
+
emit '}'
|
64
|
+
end
|
63
65
|
|
64
|
-
|
65
|
-
|
66
|
-
|
66
|
+
def emit_body
|
67
|
+
body = node.array.each_slice(2).to_a
|
68
|
+
max = body.length - 1
|
69
|
+
body.each_with_index do |(key, value), index|
|
67
70
|
visit(key)
|
68
|
-
emit
|
71
|
+
emit(' => ')
|
69
72
|
visit(value)
|
70
73
|
|
71
74
|
if index < max
|
72
|
-
emit
|
75
|
+
emit(', ')
|
73
76
|
end
|
74
77
|
end
|
75
|
-
|
76
|
-
emit '}'
|
77
78
|
end
|
78
79
|
|
79
80
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module ToSource
|
2
|
+
class Emitter
|
3
|
+
class Loop < self
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def dispatch
|
8
|
+
emit(self.class::KEYWORD)
|
9
|
+
space
|
10
|
+
visit(condition)
|
11
|
+
indent
|
12
|
+
visit(body)
|
13
|
+
unindent
|
14
|
+
emit_end
|
15
|
+
end
|
16
|
+
|
17
|
+
def condition
|
18
|
+
node.condition
|
19
|
+
end
|
20
|
+
|
21
|
+
def body
|
22
|
+
node.body
|
23
|
+
end
|
24
|
+
|
25
|
+
class While < self
|
26
|
+
handle(Rubinius::AST::While)
|
27
|
+
KEYWORD = :while
|
28
|
+
end
|
29
|
+
|
30
|
+
class Until < self
|
31
|
+
handle(Rubinius::AST::Until)
|
32
|
+
KEYWORD = :until
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -7,11 +7,18 @@ module ToSource
|
|
7
7
|
private
|
8
8
|
|
9
9
|
def dispatch
|
10
|
-
|
11
|
-
run(Util::DelimitedBody, node.left.body)
|
10
|
+
emit_left
|
12
11
|
emit(' = ')
|
12
|
+
emit_right
|
13
|
+
end
|
14
|
+
|
15
|
+
def emit_left
|
16
|
+
run(Util::DelimitedBody, node.left.body)
|
17
|
+
end
|
18
|
+
|
19
|
+
def emit_right
|
13
20
|
right = node.right
|
14
|
-
if
|
21
|
+
if right.kind_of?(Rubinius::AST::ArrayLiteral)
|
15
22
|
run(Util::DelimitedBody, right.body)
|
16
23
|
else
|
17
24
|
visit(right)
|
@@ -7,11 +7,12 @@ module ToSource
|
|
7
7
|
private
|
8
8
|
|
9
9
|
def dispatch
|
10
|
-
|
10
|
+
util = node
|
11
|
+
visit(util.receiver)
|
11
12
|
emit('[')
|
12
|
-
visit(
|
13
|
+
visit(util.arguments.array.first)
|
13
14
|
emit('] ||= ')
|
14
|
-
visit(
|
15
|
+
visit(util.value)
|
15
16
|
end
|
16
17
|
|
17
18
|
end
|
@@ -8,7 +8,7 @@ module ToSource
|
|
8
8
|
|
9
9
|
def dispatch
|
10
10
|
emit('rescue')
|
11
|
-
|
11
|
+
emit_conditions
|
12
12
|
emit_splat
|
13
13
|
emit_assignment
|
14
14
|
emit_body
|
@@ -21,23 +21,23 @@ module ToSource
|
|
21
21
|
unindent
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def emit_conditions
|
25
25
|
conditions = node.conditions || return
|
26
|
-
|
27
26
|
body = conditions.body
|
28
27
|
|
29
28
|
first = body.first
|
30
29
|
unless body.one? and first.kind_of?(Rubinius::AST::ConstantAccess) and first.name == :StandardError
|
31
|
-
|
30
|
+
space
|
32
31
|
run(Util::DelimitedBody, body)
|
33
32
|
end
|
34
33
|
end
|
35
34
|
|
36
35
|
def emit_splat
|
37
|
-
|
38
|
-
|
39
|
-
emit('
|
40
|
-
|
36
|
+
util = node
|
37
|
+
splat = util.splat || return
|
38
|
+
emit(',') if util.conditions
|
39
|
+
space
|
40
|
+
visit(splat)
|
41
41
|
end
|
42
42
|
|
43
43
|
def emit_assignment
|
@@ -47,8 +47,8 @@ module ToSource
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def emit_next
|
50
|
-
|
51
|
-
visit(
|
50
|
+
next_rescue = node.next || return
|
51
|
+
visit(next_rescue)
|
52
52
|
end
|
53
53
|
|
54
54
|
end
|
@@ -6,10 +6,14 @@ module ToSource
|
|
6
6
|
handle(Rubinius::AST::ScopedModuleName)
|
7
7
|
handle(Rubinius::AST::ScopedConstant)
|
8
8
|
|
9
|
+
private
|
10
|
+
|
11
|
+
delegate(:parent, :name)
|
12
|
+
|
9
13
|
def dispatch
|
10
|
-
visit(
|
14
|
+
visit(parent)
|
11
15
|
emit('::')
|
12
|
-
emit(
|
16
|
+
emit(name)
|
13
17
|
end
|
14
18
|
|
15
19
|
end
|
@@ -24,22 +24,42 @@ module ToSource
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def normal_dispatch
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
emit(node.name)
|
27
|
+
emit_receiver
|
28
|
+
emit_name
|
29
|
+
emit_block_pass
|
33
30
|
emit_block
|
34
31
|
end
|
35
32
|
|
33
|
+
def block?
|
34
|
+
!!block
|
35
|
+
end
|
36
|
+
|
37
|
+
delegate(:block, :name, :receiver)
|
38
|
+
|
39
|
+
def block_pass?
|
40
|
+
block? && block.kind_of?(Rubinius::AST::BlockPass19)
|
41
|
+
end
|
42
|
+
|
43
|
+
def emit_name
|
44
|
+
emit(name)
|
45
|
+
end
|
46
|
+
|
47
|
+
def emit_receiver
|
48
|
+
return if node.privately
|
49
|
+
visit(receiver)
|
50
|
+
emit('.')
|
51
|
+
end
|
52
|
+
|
36
53
|
def emit_block
|
37
|
-
block
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
54
|
+
return unless block? and !block_pass?
|
55
|
+
visit(block)
|
56
|
+
end
|
57
|
+
|
58
|
+
def emit_block_pass
|
59
|
+
return unless block_pass?
|
60
|
+
emit('(')
|
61
|
+
visit(block)
|
62
|
+
emit(')')
|
43
63
|
end
|
44
64
|
|
45
65
|
end
|
@@ -1,22 +1,26 @@
|
|
1
1
|
module ToSource
|
2
2
|
class Emitter
|
3
|
-
class SendWithArguments <
|
3
|
+
class SendWithArguments < Send
|
4
4
|
|
5
5
|
handle(Rubinius::AST::SendWithArguments)
|
6
6
|
|
7
7
|
private
|
8
8
|
|
9
9
|
def dispatch
|
10
|
-
if
|
11
|
-
run(ElementReference
|
10
|
+
if element_reference?
|
11
|
+
run(ElementReference)
|
12
12
|
return
|
13
13
|
end
|
14
14
|
if binary_operator_method?
|
15
|
-
run(BinaryOperatorMethod
|
15
|
+
run(BinaryOperatorMethod)
|
16
16
|
return
|
17
17
|
end
|
18
18
|
normal_dispatch
|
19
19
|
end
|
20
|
+
|
21
|
+
def element_reference?
|
22
|
+
name == :[]
|
23
|
+
end
|
20
24
|
|
21
25
|
BINARY_OPERATORS = %w(
|
22
26
|
+ - * / & | && || << >> ==
|
@@ -28,17 +32,11 @@ module ToSource
|
|
28
32
|
BINARY_OPERATORS.include?(node.name)
|
29
33
|
end
|
30
34
|
|
31
|
-
def emit_receiver
|
32
|
-
unless node.privately
|
33
|
-
visit(node.receiver)
|
34
|
-
emit('.')
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
35
|
def normal_dispatch
|
39
36
|
emit_receiver
|
40
|
-
|
37
|
+
emit_name
|
41
38
|
emit_arguments
|
39
|
+
emit_block
|
42
40
|
end
|
43
41
|
|
44
42
|
def emit_arguments
|
@@ -49,12 +47,9 @@ module ToSource
|
|
49
47
|
end
|
50
48
|
|
51
49
|
def emit_block_pass(emitter)
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
emit(', ') if emitter.any?
|
56
|
-
visit(block)
|
57
|
-
end
|
50
|
+
return unless block_pass?
|
51
|
+
emit(', ') if emitter.any?
|
52
|
+
visit(block)
|
58
53
|
end
|
59
54
|
|
60
55
|
end
|
@@ -5,17 +5,20 @@ module ToSource
|
|
5
5
|
|
6
6
|
handle(Rubinius::AST::SClass)
|
7
7
|
|
8
|
+
private
|
9
|
+
|
8
10
|
def dispatch
|
9
|
-
emit(
|
10
|
-
space
|
11
|
-
emit(:<<)
|
12
|
-
space
|
11
|
+
emit('class << ')
|
13
12
|
visit(node.receiver)
|
13
|
+
emit_body
|
14
|
+
emit_end
|
15
|
+
end
|
16
|
+
|
17
|
+
def emit_body
|
14
18
|
indent
|
15
19
|
# FIXME: attr_reader missing on Rubinius::AST::SClass
|
16
20
|
visit(node.instance_variable_get(:@body))
|
17
21
|
unindent
|
18
|
-
emit_end
|
19
22
|
end
|
20
23
|
|
21
24
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module ToSource
|
2
2
|
class Emitter
|
3
|
-
class UnaryOperatorMethod <
|
3
|
+
class UnaryOperatorMethod < Send
|
4
4
|
|
5
5
|
UNARY_MAPPING = {
|
6
6
|
:-@ => :-,
|
@@ -12,7 +12,7 @@ module ToSource
|
|
12
12
|
def dispatch
|
13
13
|
name = node.name
|
14
14
|
emit(UNARY_MAPPING.fetch(name, name))
|
15
|
-
visit(
|
15
|
+
visit(receiver)
|
16
16
|
end
|
17
17
|
|
18
18
|
end
|
@@ -1,16 +1,26 @@
|
|
1
1
|
module ToSource
|
2
2
|
class Emitter
|
3
3
|
class Unless < self
|
4
|
+
|
5
|
+
private
|
4
6
|
|
5
7
|
def dispatch
|
6
8
|
emit('unless ')
|
7
|
-
visit(
|
9
|
+
visit(condition)
|
8
10
|
indent
|
9
|
-
visit(
|
11
|
+
visit(else_body)
|
10
12
|
unindent
|
11
13
|
emit_end
|
12
14
|
end
|
13
15
|
|
16
|
+
def condition
|
17
|
+
node.condition
|
18
|
+
end
|
19
|
+
|
20
|
+
def else_body
|
21
|
+
node.else
|
22
|
+
end
|
23
|
+
|
14
24
|
end
|
15
25
|
end
|
16
26
|
end
|
@@ -439,15 +439,6 @@ describe ToSource,'.to_source' do
|
|
439
439
|
assert_source 'foo.bar(:baz, :yeah)'
|
440
440
|
end
|
441
441
|
|
442
|
-
context 'with block' do
|
443
|
-
assert_source <<-RUBY
|
444
|
-
foo.bar do
|
445
|
-
3
|
446
|
-
4
|
447
|
-
end
|
448
|
-
RUBY
|
449
|
-
end
|
450
|
-
|
451
442
|
context 'to self' do
|
452
443
|
|
453
444
|
context 'explicitly' do
|
@@ -473,6 +464,15 @@ describe ToSource,'.to_source' do
|
|
473
464
|
end
|
474
465
|
end
|
475
466
|
|
467
|
+
context 'with block' do
|
468
|
+
assert_source <<-RUBY
|
469
|
+
foo.bar do
|
470
|
+
3
|
471
|
+
4
|
472
|
+
end
|
473
|
+
RUBY
|
474
|
+
end
|
475
|
+
|
476
476
|
context 'with block that takes pattern and formal arguments' do
|
477
477
|
assert_source <<-RUBY
|
478
478
|
foo.bar do |(a, b), c|
|
@@ -499,6 +499,14 @@ describe ToSource,'.to_source' do
|
|
499
499
|
RUBY
|
500
500
|
end
|
501
501
|
|
502
|
+
context 'with arguments and block' do
|
503
|
+
assert_source <<-RUBY
|
504
|
+
foo.bar(baz) do
|
505
|
+
4
|
506
|
+
end
|
507
|
+
RUBY
|
508
|
+
end
|
509
|
+
|
502
510
|
context 'with splat argument' do
|
503
511
|
assert_source 'foo.bar(*args)'
|
504
512
|
end
|
@@ -835,6 +843,14 @@ describe ToSource,'.to_source' do
|
|
835
843
|
end
|
836
844
|
end
|
837
845
|
|
846
|
+
context 'loop' do
|
847
|
+
assert_source <<-RUBY
|
848
|
+
loop do
|
849
|
+
foo
|
850
|
+
end
|
851
|
+
RUBY
|
852
|
+
end
|
853
|
+
|
838
854
|
context 'while' do
|
839
855
|
context 'single statement in body' do
|
840
856
|
assert_source <<-RUBY
|
data/to_source.gemspec
CHANGED
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.
|
4
|
+
version: 0.2.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -135,6 +135,7 @@ files:
|
|
135
135
|
- lib/to_source/emitter/keyword_value.rb
|
136
136
|
- lib/to_source/emitter/literal.rb
|
137
137
|
- lib/to_source/emitter/literal/dynamic.rb
|
138
|
+
- lib/to_source/emitter/loop.rb
|
138
139
|
- lib/to_source/emitter/match3.rb
|
139
140
|
- lib/to_source/emitter/module.rb
|
140
141
|
- lib/to_source/emitter/multiple_assignment.rb
|
@@ -160,10 +161,8 @@ files:
|
|
160
161
|
- lib/to_source/emitter/toplevel.rb
|
161
162
|
- lib/to_source/emitter/unary_operator_method.rb
|
162
163
|
- lib/to_source/emitter/unless.rb
|
163
|
-
- lib/to_source/emitter/until.rb
|
164
164
|
- lib/to_source/emitter/util.rb
|
165
165
|
- lib/to_source/emitter/when.rb
|
166
|
-
- lib/to_source/emitter/while.rb
|
167
166
|
- lib/to_source/emitter/yield.rb
|
168
167
|
- lib/to_source/emitter/z_super.rb
|
169
168
|
- lib/to_source/state.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module ToSource
|
2
|
-
class Emitter
|
3
|
-
class Until < self
|
4
|
-
|
5
|
-
handle(Rubinius::AST::Until)
|
6
|
-
|
7
|
-
private
|
8
|
-
|
9
|
-
def dispatch
|
10
|
-
emit('until ')
|
11
|
-
visit(node.condition)
|
12
|
-
indent
|
13
|
-
visit(node.body)
|
14
|
-
unindent
|
15
|
-
emit_end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module ToSource
|
2
|
-
class Emitter
|
3
|
-
class While < self
|
4
|
-
|
5
|
-
handle(Rubinius::AST::While)
|
6
|
-
|
7
|
-
private
|
8
|
-
|
9
|
-
def dispatch
|
10
|
-
emit('while ')
|
11
|
-
visit(node.condition)
|
12
|
-
indent
|
13
|
-
visit(node.body)
|
14
|
-
unindent
|
15
|
-
emit_end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|