Skip to content

Commit 5312b84

Browse files
committed
Ensure variables are printed in the order of the slotnames
1 parent a658ea0 commit 5312b84

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/utils.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,14 @@ Return the local variables as a vector of `Variable`[@ref].
251251
function locals(frame::Frame)
252252
vars = Variable[]
253253
data, code = frame.framedata, frame.framecode
254-
for (sym, idx) in data.last_reference
254+
added = Set{Symbol}()
255+
for sym in code.src.slotnames
256+
sym added && continue
257+
idx = get(data.last_reference, sym, 0)
258+
idx == 0 && continue
255259
push!(vars, Variable(something(data.locals[idx]), sym, false))
260+
push!(added, sym)
256261
end
257-
reverse!(vars)
258262
if code.scope isa Method
259263
syms = sparam_syms(code.scope)
260264
for i in 1:length(syms)

0 commit comments

Comments
 (0)