[ruby/irb] Use InstructionSequence#script_lines to get method source
(https://github.com/ruby/irb/pull/1005) It works with both prism and parse.y https://github.com/ruby/irb/commit/bcfaa72d5a
This commit is contained in:
parent
1c3981cb88
commit
6c4ce72609
@ -100,7 +100,7 @@ module IRB
|
||||
Source.new(file, line)
|
||||
elsif method
|
||||
# Method defined with eval, probably in IRB session
|
||||
source = RubyVM::AbstractSyntaxTree.of(method)&.source rescue nil
|
||||
source = RubyVM::InstructionSequence.of(method)&.script_lines&.join rescue nil
|
||||
Source.new(file, line, source)
|
||||
end
|
||||
rescue EvaluationError
|
||||
|
Loading…
x
Reference in New Issue
Block a user