diff options
author | Kyrylo Silin <silin@kyrylo.org> | 2018-11-12 02:00:02 +0800 |
---|---|---|
committer | Kyrylo Silin <silin@kyrylo.org> | 2018-11-12 02:00:02 +0800 |
commit | 48405c48cd6c4054bdec187530a6d66b93a2b57b (patch) | |
tree | c13db0a4a98a91e8927faf491350e53985a4d160 /lib/method_source/code_helpers.rb | |
parent | 609c4c438b38a8944ae5d9560b9c467775496c02 (diff) | |
download | method_source-48405c48cd6c4054bdec187530a6d66b93a2b57b.tar.gz |
Revert "method_source: fix broken Procs on JRuby 9.2.0.0"
Fixes #52 (Revert the JRuby 9.2.0.0 source_location hack once the newest version
is out)
This reverts commit 20fb1efde4530c78f7627d8b5b4e0b3f43cf821d.
Diffstat (limited to 'lib/method_source/code_helpers.rb')
-rw-r--r-- | lib/method_source/code_helpers.rb | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/lib/method_source/code_helpers.rb b/lib/method_source/code_helpers.rb index e431742..9d9da55 100644 --- a/lib/method_source/code_helpers.rb +++ b/lib/method_source/code_helpers.rb @@ -1,9 +1,6 @@ module MethodSource module CodeHelpers - # @return [Boolean] - JRUBY_9200 = (defined?(JRUBY_VERSION) || false) && JRUBY_VERSION == '9.2.0.0' - # Retrieve the first expression starting on the given line of the given file. # # This is useful to get module or method source code. @@ -32,26 +29,6 @@ module MethodSource extract_first_expression(relevant_lines, options[:consume]) rescue SyntaxError => e - # JRuby 9.2.0.0 breaks #source_location for Procs (it reports line number - # as the last line of the Proc). This raises SyntaxError. - # See https://github.com/pry/pry/issues/1804 for details. - # - # To fix this, this hack rewinds source location one step at a time and - # tries to see if the new location is a complete expression. - # - # TODO: delete this once latest JRuby version is bumped. - # See https://github.com/banister/method_source/issues/52 - if JRUBY_9200 && line_number > 0 - loop do - line_number -= 1 - - # Skip empty lines since they are not real expressions. - break unless lines[line_number - 1] == "\n" - end - - retry - end - raise if options[:strict] begin |