ripper-plus 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ripper-plus/transformer.rb +1 -1
- data/lib/ripper-plus/version.rb +1 -1
- data/spec/transformer_spec.rb +30 -0
- metadata +3 -3
@@ -126,7 +126,7 @@ module RipperPlus
|
|
126
126
|
end
|
127
127
|
when :rescue
|
128
128
|
list, name, body = tree[1..3]
|
129
|
-
transform_tree(list, scope_stack)
|
129
|
+
transform_tree(list, scope_stack) if list
|
130
130
|
# Don't forget the rescue argument!
|
131
131
|
if name
|
132
132
|
add_variables_from_node(name, scope_stack)
|
data/lib/ripper-plus/version.rb
CHANGED
data/spec/transformer_spec.rb
CHANGED
@@ -526,6 +526,36 @@ describe RipperPlus::Transformer do
|
|
526
526
|
input_tree.should transform_to output_tree
|
527
527
|
end
|
528
528
|
|
529
|
+
it 'does not blow up due to the lack of a rescue list' do
|
530
|
+
input_tree =
|
531
|
+
[:program,
|
532
|
+
[[:def,
|
533
|
+
[:@ident, "foo", [1, 4]],
|
534
|
+
[:params, nil, nil, nil, nil, nil],
|
535
|
+
[:bodystmt,
|
536
|
+
[[:method_add_arg,
|
537
|
+
[:fcall, [:@ident, "p", [1, 9]]],
|
538
|
+
[:arg_paren,
|
539
|
+
[:args_add_block, [[:var_ref, [:@gvar, "$.", [1, 11]]]], false]]]],
|
540
|
+
[:rescue, nil, nil, [[:void_stmt]], nil],
|
541
|
+
nil,
|
542
|
+
nil]]]]
|
543
|
+
output_tree =
|
544
|
+
[:program,
|
545
|
+
[[:def,
|
546
|
+
[:@ident, "foo", [1, 4]],
|
547
|
+
[:params, nil, nil, nil, nil, nil],
|
548
|
+
[:bodystmt,
|
549
|
+
[[:method_add_arg,
|
550
|
+
[:fcall, [:@ident, "p", [1, 9]]],
|
551
|
+
[:arg_paren,
|
552
|
+
[:args_add_block, [[:var_ref, [:@gvar, "$.", [1, 11]]]], false]]]],
|
553
|
+
[:rescue, nil, nil, [[:void_stmt]], nil],
|
554
|
+
nil,
|
555
|
+
nil]]]]
|
556
|
+
input_tree.should transform_to output_tree
|
557
|
+
end
|
558
|
+
|
529
559
|
it 'observes the creation of local variables by rescue clauses' do
|
530
560
|
input_tree =
|
531
561
|
[:program,
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: ripper-plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.2.
|
5
|
+
version: 1.2.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Michael Edgar
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-06-15 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -98,7 +98,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
98
|
requirements:
|
99
99
|
- - ">="
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
hash:
|
101
|
+
hash: 4245056097260382389
|
102
102
|
segments:
|
103
103
|
- 0
|
104
104
|
version: "0"
|