1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Use source_location instead of eval(__FILE__,binding) in Binding#irb

e9e17cbc05 (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]
This commit is contained in:
Yusuke Endoh 2019-08-03 07:44:44 +09:00
parent 44ddfec0bd
commit c683763865

View file

@ -805,7 +805,7 @@ class Binding
# #
# See IRB@IRB+Usage for more information. # See IRB@IRB+Usage for more information.
def irb def irb
IRB.setup(eval("__FILE__"), argv: []) IRB.setup(source_location[0], argv: [])
workspace = IRB::WorkSpace.new(self) workspace = IRB::WorkSpace.new(self)
STDOUT.print(workspace.code_around_binding) STDOUT.print(workspace.code_around_binding)
IRB::Irb.new(workspace).run(IRB.conf) IRB::Irb.new(workspace).run(IRB.conf)