Skip to content

Commit

Permalink
Fix for #273 (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
goerch authored Dec 2, 2021
1 parent 42318ea commit e1ab5a8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/JET.jl
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,17 @@ const StateAtPC = Tuple{State,Int}
const LineTable = Union{Vector{Any},Vector{LineInfoNode}}

get_stmt((sv, pc)::StateAtPC) = @inbounds sv.src.code[pc]
get_lin((sv, pc)::StateAtPC) = @inbounds (sv.src.linetable::LineTable)[sv.src.codelocs[pc]]::LineInfoNode
get_lin((sv, pc)::StateAtPC) = begin
codeloc = sv.src.codelocs[pc]
linetable = sv.src.linetable::LineTable
if 1 <= codeloc <= length(linetable)
return @inbounds linetable[codeloc]::LineInfoNode
else
# Packages might dynamically generate code, which does not reference
# a source, see https://github.com/aviatesk/JET.jl/issues/273
return LineInfoNode(sv.mod, :unknown, :unknown, 0, 0)
end
end
get_ssavaluetype((sv, pc)::StateAtPC) = @inbounds sv.src.ssavaluetypes[pc]

get_slottype(s::Union{StateAtPC,State}, slot) = get_slottype(s, slot_id(slot))
Expand Down

0 comments on commit e1ab5a8

Please sign in to comment.