summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomoya ishida <tomoyapenguin@gmail.com>2024-09-17 02:36:21 +0900
committergit <svn-admin@ruby-lang.org>2024-09-16 17:36:27 +0000
commit6c4ce72609396cff8970c0fdebbfa190ec75ece1 (patch)
tree03a0214ca3028b912ee75aeb31f0b6f06c7334e2
parent1c3981cb88f13a40576ddf73fc8525a277af512c (diff)
[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
-rw-r--r--lib/irb/source_finder.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/irb/source_finder.rb b/lib/irb/source_finder.rb
index 5d7d729d19..c515da5702 100644
--- a/lib/irb/source_finder.rb
+++ b/lib/irb/source_finder.rb
@@ -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