[ruby/irb] workspace.rb cleanup

(https://github.com/ruby/irb/pull/489)

* Remove unnecessary Binding#source_location check

`Binding#source_location` was added in 2.6, which is the minimum supported
version now. So this check is no longer necessary.

* Remove unused IRB.delete_caller

This method was added in the earliest version of IRB:

f47808999d

But it's not currently referenced by anything. We can verify this with a
org-wide search result:

https://github.com/search?q=org%3Aruby+delete_caller&type=code
This commit is contained in:
Stan Lo 2023-01-04 09:35:52 +00:00 committed by git
parent e25c173c97
commit 3d6500ee6e

View File

@ -142,11 +142,7 @@ EOF
end
def code_around_binding
if @binding.respond_to?(:source_location)
file, pos = @binding.source_location
else
file, pos = @binding.eval('[__FILE__, __LINE__]')
end
file, pos = @binding.source_location
if defined?(::SCRIPT_LINES__[file]) && lines = ::SCRIPT_LINES__[file]
code = ::SCRIPT_LINES__[file].join('')
@ -173,8 +169,5 @@ EOF
"\nFrom: #{file} @ line #{pos + 1} :\n\n#{body}#{Color.clear}\n"
end
def IRB.delete_caller
end
end
end