Skip to content
Browse files

- 1.9: Fixed parsing of op_asgn + rescue: 'a ||= b rescue nil'

[git-p4: depot-paths = "//src/ruby_parser/dev/": change = 7699]
  • Loading branch information...
1 parent 0350843 commit 6c45ff898b9c85e82d3b573d2928017722900eb7 @zenspider zenspider committed Aug 5, 2012
Showing with 10 additions and 1 deletion.
  1. +1 −1 lib/ruby19_parser.y
  2. +9 −0 test/test_ruby_parser.rb
View
2 lib/ruby19_parser.y
@@ -582,7 +582,7 @@ rule
| var_lhs tOP_ASGN arg kRESCUE_MOD arg
{
result = new_op_asgn val
- result = self.node_assign s(:rescue, result, new_resbody(s(:array), val[4]))
+ result = s(:rescue, result, new_resbody(s(:array), val[4]))
}
| primary_value tLBRACK2 opt_call_args rbracket tOP_ASGN arg
{
View
9 test/test_ruby_parser.rb
@@ -787,6 +787,15 @@ def test_cond_unary_minus
assert_parse rb, pt
end
+
+ def test_bug_op_asgn_rescue
+ rb = "a ||= b rescue nil"
+ pt = s(:rescue,
+ s(:op_asgn_or, s(:lvar, :a), s(:lasgn, :a, s(:call, nil, :b))),
+ s(:resbody, s(:array), s(:nil)))
+
+ assert_parse rb, pt
+ end
end
class TestRubyParser < MiniTest::Unit::TestCase

0 comments on commit 6c45ff8

Please sign in to comment.
Something went wrong with that request. Please try again.