seattlerb/ruby2ruby

block causing syntax error

zenspider opened this issue · 1 comments

See https://github.com/seattlerb/heckle/issues/1

I've come across a block of code I can't heckle because it always causes a syntax error. Style issues aside, here's the block:

 def my_awesome_method
   begin
     if true
       puts "cool"
     end
     {}.delete(:whatever)
   rescue 
     puts "weird"
   end
 end

Heckle tries to replace the block as such:

--- original
+++ mutation
 def my_awesome_method
   begin
     (puts("cool") if true
-    {  }.delete(:whatever)) rescue puts("weird")
+    # do nothing) rescue puts("weird")
   end
 end

Not sure if this is an issue directly with heckle or one of the libraries it uses, e.g. ParseTree.

This is fixed... UGLY but fixed:

def my_awesome_method
  (puts("cool") if true
  {}.delete(:whatever)) rescue puts("weird")
end