defn+ivar becomes attr_reader regardless of ivar name
robertfeldt opened this issue · 2 comments
robertfeldt commented
This is both unexpected and could be argued to be "wrong":
feldt:~/tmp$ irb
1.9.3-p286 :001 > require 'ruby_parser'
=> true
1.9.3-p286 :002 > require 'ruby2ruby'
=> true
1.9.3-p286 :003 > Ruby2Ruby.new.process Ruby19Parser.new.parse("def start; @constant; end")
=> "attr_reader :start"
robertfeldt commented
By the way, I found this in real, production code where there is a very good argument for why the code should actually be "def start; @contant; end". I worked around it for now by adding a dummy ivar assignment before the return but it feels hackish to need to work around it.
zenspider commented
Fixed. Thanks for the report!