mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/error_highlight] Reconsider the API of ErrorHighlight.spot
acb2046a82
This commit is contained in:
parent
f428ced69c
commit
ca4e5b1eb3
2 changed files with 16 additions and 18 deletions
|
@ -21,16 +21,13 @@ module ErrorHighlight
|
|||
|
||||
case self
|
||||
when NoMethodError, NameError
|
||||
point = :name
|
||||
opts[:point_type] = :name
|
||||
opts[:name] = name
|
||||
when TypeError, ArgumentError
|
||||
point = :args
|
||||
opts[:point_type] = :args
|
||||
end
|
||||
|
||||
spot = ErrorHighlight.spot(node, point, **opts) do |lineno, last_lineno|
|
||||
last_lineno ||= lineno
|
||||
node.script_lines[lineno - 1 .. last_lineno - 1].join("")
|
||||
end
|
||||
spot = ErrorHighlight.spot(node, **opts)
|
||||
|
||||
rescue Errno::ENOENT
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue