From 3d6500ee6e3676979d5199dc7b5feab0d15235de Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Wed, 4 Jan 2023 09:35:52 +0000 Subject: [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: https://github.com/ruby/irb/commit/f47808999d24865fba1929dea1a7011ff5a517d6 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 --- lib/irb/workspace.rb | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'lib/irb/workspace.rb') diff --git a/lib/irb/workspace.rb b/lib/irb/workspace.rb index e5ef52528a..a3d8891b86 100644 --- a/lib/irb/workspace.rb +++ b/lib/irb/workspace.rb @@ -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 -- cgit v1.2.3