summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-08-03 07:44:44 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-08-03 07:44:44 +0900
commitc6837638657429034825d5c9e2a29c340898afb8 (patch)
tree4655331430ef09099960a1f50aba8769a6e870e1
parent44ddfec0bd366cd2337fd34847cddedd0a7b6775 (diff)
Use source_location instead of eval(__FILE__,binding) in Binding#irb
e9e17cbc051e894dfd27eda5feca2939f65552db (enabling the warning by default) caused a warning in test-spec: ``` /data/chkbuild/tmp/build/20190802T213005Z/ruby/spec/ruby/core/binding/irb_spec.rb Binding#irb - creates an IRB session with the binding in scope/data/chkbuild/tmp/build/20190802T213005Z/ruby/spec/ruby/core/binding/fixtures/irb.rb:3: warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead ``` https://rubyci.org/logs/rubyci.s3.amazonaws.com/debian/ruby-master/log/20190802T213005Z.log.html.gz ref: [Bug #4352]
-rw-r--r--lib/irb.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/irb.rb b/lib/irb.rb
index f9c2778..a08aa87 100644
--- a/lib/irb.rb
+++ b/lib/irb.rb
@@ -805,7 +805,7 @@ class Binding
#
# See IRB@IRB+Usage for more information.
def irb
- IRB.setup(eval("__FILE__"), argv: [])
+ IRB.setup(source_location[0], argv: [])
workspace = IRB::WorkSpace.new(self)
STDOUT.print(workspace.code_around_binding)
IRB::Irb.new(workspace).run(IRB.conf)