Skip to content

Commit 50194c8

Browse files
committed
Generalize the "method" for linetable_scopes
It could be a module, too.
1 parent 7f85b77 commit 50194c8

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "CodeTracking"
22
uuid = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
33
authors = ["Tim Holy <[email protected]>"]
4-
version = "1.3.8"
4+
version = "1.3.9"
55

66
[deps]
77
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

src/utils.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,17 @@ end
194194
fileline(lin::LineInfoNode) = String(lin.file), lin.line
195195
fileline(lnn::LineNumberNode) = String(lnn.file), lnn.line
196196

197+
linetable_scopes(m::Method) = linetable_scopes(Base.uncompressed_ast(m), m) # Fallback to the uncompressed AST for Julia < 1.12
197198
if VERSION v"1.12.0-DEV.173" # https://github.com/JuliaLang/julia/pull/52415
198-
function linetable_scopes(m::Method)
199-
src = Base.uncompressed_ast(m)
199+
function linetable_scopes(src::Core.CodeInfo, m)
200200
lts = [Vector{Base.Compiler.IRShow.LineInfoNode}() for _ = eachindex(src.code)]
201201
for pc = eachindex(src.code)
202202
Base.IRShow.append_scopes!(lts[pc], pc, src.debuginfo, m)
203203
end
204204
return lts
205205
end
206206
else
207-
function linetable_scopes(m::Method)
208-
src = Base.uncompressed_ast(m)
207+
function linetable_scopes(src::Core.CodeInfo, _)
209208
lt, cl = src.linetable, src.codelocs
210209
lts = [Vector{Core.LineInfoNode}() for _ = eachindex(src.code)]
211210
for pc = eachindex(src.code)

0 commit comments

Comments
 (0)