Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CodeTracking"
uuid = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
authors = ["Tim Holy <tim.holy@gmail.com>"]
version = "1.3.8"
version = "1.3.9"

[deps]
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Expand Down
12 changes: 6 additions & 6 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,15 @@ fileline(lin::LineInfoNode) = String(lin.file), lin.line
fileline(lnn::LineNumberNode) = String(lnn.file), lnn.line

if VERSION ≥ v"1.12.0-DEV.173" # https://github.com/JuliaLang/julia/pull/52415
function linetable_scopes(m::Method)
src = Base.uncompressed_ast(m)
function linetable_scopes(src::Core.CodeInfo, m)
lts = [Vector{Base.Compiler.IRShow.LineInfoNode}() for _ = eachindex(src.code)]
for pc = eachindex(src.code)
Base.IRShow.append_scopes!(lts[pc], pc, src.debuginfo, m)
end
return lts
end
else
function linetable_scopes(m::Method)
src = Base.uncompressed_ast(m)
function linetable_scopes(src::Core.CodeInfo, _)
lt, cl = src.linetable, src.codelocs
lts = [Vector{Core.LineInfoNode}() for _ = eachindex(src.code)]
for pc = eachindex(src.code)
Expand All @@ -222,7 +220,8 @@ else
return lts
end
end
@doc """

"""
scopes = linetable_scopes(m::Method)

Return an array of "scopes" for each statement in the lowered code for `m`. If
Expand All @@ -237,7 +236,8 @@ The precise type of these entries varies with Julia version,
`Base.Compiler.IRShow.LineInfoNode` objects on Julia 1.12 and up, and
`Core.LineInfoNode` objects on earlier versions. These objects differ in some of
their fields. `:method`, `:file`, and `:line` are common to both types.
""" linetable_scopes
"""
linetable_scopes(m::Method) = linetable_scopes(Base.uncompressed_ast(m), m)

getmethod(m::Method) = m
getmethod(mi::Core.MethodInstance) = getmethod(mi.def)
Expand Down
Loading