Warnings in parser.rb
Closed this issue · 0 comments
cschneid commented
I'm getting several warnings when I run my app that loads pry-inline.
I'm on Ruby 2.2.5
/Users/cschneid/.rvm/gems/ruby-2.2.5/gems/pry-inline-1.0.2/lib/pry-inline/parser.rb:33: warning: method redefined; discarding old on_parse_error
/Users/cschneid/.rvm/gems/ruby-2.2.5/gems/pry-inline-1.0.2/lib/pry-inline/parser.rb:14: warning: previous definition of on_parse_error was here
>> require 'ripper'
=> true
>> Ripper::Version
=> "0.1.0"
It looks like Ripper::PARSER_EVENTS
contains a :parse_error
token, which creates the on_parse_error
function. But then towards the bottom of the file, there's an explicit on_parse_error
definition that triggers this warning.
The fix is pretty simple (next if event == :parse_error
in the first loop).