aboutsummaryrefslogtreecommitdiffstats
path: root/lib/error_highlight
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2022-08-10 21:17:04 +0900
committergit <svn-admin@ruby-lang.org>2022-08-10 21:19:10 +0900
commit3a58009066049f9af09ea3171cecab88ba0d9f1c (patch)
tree20a90bbc117f2b57fcf3b6aeb6103dfce6ff20e3 /lib/error_highlight
parent99e7fa5b3718d61d61427c67d244ec50b9eb8578 (diff)
downloadruby-3a58009066049f9af09ea3171cecab88ba0d9f1c.tar.gz
[ruby/error_highlight] Make backtrace_location keyword work
We had to keep backtrace_location before opts is overwritten. https://github.com/ruby/error_highlight/commit/2735e4681a
Diffstat (limited to 'lib/error_highlight')
-rw-r--r--lib/error_highlight/base.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/error_highlight/base.rb b/lib/error_highlight/base.rb
index 51f1ce369d..dbd173a5cd 100644
--- a/lib/error_highlight/base.rb
+++ b/lib/error_highlight/base.rb
@@ -26,9 +26,9 @@ module ErrorHighlight
case obj
when Exception
exc = obj
+ loc = opts[:backtrace_location]
opts = { point_type: opts.fetch(:point_type, :name) }
- loc = opts[:backtrace_location]
unless loc
case exc
when TypeError, ArgumentError
@@ -44,6 +44,8 @@ module ErrorHighlight
opts[:name] = exc.name if NameError === obj
end
+ return nil unless Thread::Backtrace::Location === loc
+
node = RubyVM::AbstractSyntaxTree.of(loc, keep_script_lines: true)
Spotter.new(node, **opts).spot