diff --git a/src/codeedges.jl b/src/codeedges.jl index 8a1c452..df3266c 100644 --- a/src/codeedges.jl +++ b/src/codeedges.jl @@ -104,7 +104,9 @@ function print_with_code(preprint, postprint, io::IO, src::CodeInfo) if isdefined(JuliaInterpreter, :reverse_lookup_globalref!) JuliaInterpreter.reverse_lookup_globalref!(src.code) end - io = IOContext(io, :displaysize=>displaysize(io)) + io = IOContext(io, + :displaysize=>displaysize(io), + :SOURCE_SLOTNAMES => Base.sourceinfo_slotnames(src)) used = BitSet() cfg = Core.Compiler.compute_basic_blocks(src.code) for stmt in src.code diff --git a/test/codeedges.jl b/test/codeedges.jl index 9b6da64..86d2022 100644 --- a/test/codeedges.jl +++ b/test/codeedges.jl @@ -439,6 +439,21 @@ module ModSelective end else @test occursin("No IR statement printer", str) end + + # display slot names + ex = :(let + s = 0.0 + for i = 1:5 + s += rand() + end + return s + end) + lwr = Meta.lower(Main, ex) + src = lwr.args[1] + LoweredCodeUtils.print_with_code(io, src, trues(length(src.code))) + str = String(take!(io)) + @test count("s = ", str) == 2 + @test count("i = ", str) == 1 end end