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.
@@ -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)
@@ -2,7 +2,7 @@ module RipperPlus
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 2
5
- PATCH = 1
5
+ PATCH = 2
6
6
  BUILD = ''
7
7
 
8
8
  if BUILD.empty?
@@ -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.1
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-05-04 00:00:00 Z
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: -1596603294838898229
101
+ hash: 4245056097260382389
102
102
  segments:
103
103
  - 0
104
104
  version: "0"