Skip to content

Commit a6c6d35

Browse files
committed
Fallback to Backtrace#path if absolute_path is nil
1 parent bdb8849 commit a6c6d35

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/tapioca/runtime/reflection.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,17 @@ def resolve_loc(locations)
210210
end
211211
return unless resolved_loc
212212

213+
resolved_loc_path = resolved_loc.absolute_path || resolved_loc.path
214+
213215
# Find the location of the last frame in this file to get the most accurate line number.
214-
resolved_loc = locations.find { |loc| loc.absolute_path == resolved_loc.absolute_path }
216+
resolved_loc = locations.find { |loc| loc.absolute_path == resolved_loc_path }
215217
return unless resolved_loc
216218

217219
# If the last operation was a `require`, and we have no more frames,
218220
# we are probably dealing with a C-method.
219221
return if locations.first&.label == "require"
220222

221-
file = resolved_loc.absolute_path || ""
223+
file = resolved_loc.absolute_path || resolved_loc.path || ""
222224

223225
SourceLocation.from_loc([file, resolved_loc.lineno])
224226
end

0 commit comments

Comments
 (0)