From 6c4ce72609396cff8970c0fdebbfa190ec75ece1 Mon Sep 17 00:00:00 2001 From: tomoya ishida Date: Tue, 17 Sep 2024 02:36:21 +0900 Subject: [PATCH] [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 --- lib/irb/source_finder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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