Compare b7c8d11 ... +0 ... cf13881

Flags

Flags have been temporarily removed from this view while the flagging feature is refactored for better performance and user experience.

You can still use flags when viewing individual files. Flag-level thresholds will also remain on pull and merge requests in your repository provider.

More information can be found in our documentation.

Showing 1 of 1 files from the diff.

@@ -28,44 +28,58 @@
Loading
28 28
        line = loc[2]
29 29
    end
30 30
31 +
    src = frame.framecode.src
32 +
31 33
    exprs = []
32 -
    for pc in frame.pc:length(frame.framecode.src.codelocs)
34 +
    for pc in frame.pc:length(src.codelocs)
33 35
        loc = JuliaInterpreter.whereis(frame, pc)
34 36
35 37
        if loc === nothing || loc[2] > line
36 38
            return exprs
37 39
        end
38 40
39 -
        expr = JuliaInterpreter.pc_expr(frame, pc)
41 +
        expr = JuliaInterpreter.pc_expr(src, pc)
40 42
        if Meta.isexpr(expr, :call)
41 43
            for i in 1:length(expr.args)
42 -
                val = try
43 -
                    JuliaInterpreter.@lookup(frame, expr.args[i])
44 -
                catch err
45 -
                    expr.args[i]
46 -
                end
47 -
                expr.args[i] = maybe_quote(val)
44 +
                expr.args[i] = maybe_quote(expr.args[i])
48 45
            end
49 -
            push!(exprs, (pc = pc, expr = prettify_expr(expr)))
46 +
            push!(exprs, (pc = pc, expr = prettyprint_expr(expr, src)))
50 47
        elseif Meta.isexpr(expr, :(=))
51 48
            expr = expr.args[2]
52 -
            push!(exprs, (pc = pc, expr = prettify_expr(expr)))
49 +
            push!(exprs, (pc = pc, expr = prettyprint_expr(expr, src)))
53 50
        end
54 51
    end
55 52
    exprs
56 53
end
57 54
58 -
function prettify_expr(expr)
59 -
    if Meta.isexpr(expr, :call)
60 -
        fname = expr.args[1]
55 +
function prettyprint_expr(expr, src)
56 +
    io = IOBuffer()
57 +
    prettyprint_expr(io, expr, src)
58 +
    return String(take!(io))
59 +
end
61 60
62 -
        if Base.isoperator(Symbol(fname))
63 -
            join(string.(expr.args[2:end]), " $(fname) ")
64 -
        else
65 -
            string(fname, '(', join(expr.args[2:end], ", "), ')')
61 +
function prettyprint_expr(io, expr, src)
62 +
    if Meta.isexpr(expr, :call)
63 +
        for (i, ex) in enumerate(expr.args)
64 +
            if ex isa QuoteNode
65 +
                print(io, ex.value)
66 +
            elseif ex isa JuliaInterpreter.SlotNumber || ex isa Core.SlotNumber
67 +
                print(io, src.slotnames[ex.id])
68 +
            elseif ex isa JuliaInterpreter.SSAValue || ex isa Core.SSAValue
69 +
                print(io, '%', ex.id)
70 +
            else
71 +
                prettyprint_expr(io, ex, src)
72 +
            end
73 +
            if i == 1
74 +
                print(io, '(')
75 +
            elseif i == length(expr.args)
76 +
                print(io, ')')
77 +
            else
78 +
                print(io, ", ")
79 +
            end
66 80
        end
67 81
    else
68 -
        repr(expr)
82 +
        show(io, expr)
69 83
    end
70 84
end
71 85

Learn more Showing 3 files with coverage changes found.

Changes in src/debugger_utils.jl
New
Loading file...
Changes in src/packagedef.jl
+2
Loading file...
Changes in src/debugger_requests.jl
+8
Loading file...
Files Coverage
src -0.01% 0.18%
Project Totals (6 files) 0.18%
Loading