Skip to content

Commit 783a130

Browse files
committed
Fix renaming on nightly
1 parent d485b8c commit 783a130

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/LoweredCodeUtils.jl

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -386,29 +386,34 @@ function methoddef!(@nospecialize(recurse), signatures, frame::Frame, @nospecial
386386
if isa(name, Bool)
387387
error("not valid for anonymous methods")
388388
end
389+
parentname = get_parentname(name) # e.g., name = #foo#7 and parentname = foo
390+
pcinc = 1
391+
nextstmt = pc_expr(frame, pc+pcinc)
392+
while ismethod1(nextstmt) || isexpr(nextstmt, :global)
393+
if ismethod1(nextstmt)
394+
name = nextstmt.args[1]
395+
end
396+
pcinc += 1
397+
nextstmt = pc_expr(frame, pc+pcinc)
398+
end
389399
if !define && String(name)[1] == '#'
390400
# We will have to correct the name.
391401
# We can only correct one at a time, so work backwards from a non-gensymmed name
392402
# (https://github.com/timholy/Revise.jl/issues/290)
393403
pc0 = pc
394404
idx1 = findall(ismethod1, frame.framecode.src.code)
395405
idx1 = idx1[idx1 .>= pc]
396-
i = 1
397-
while i < length(idx1) && startswith(String(pc_expr(frame, idx1[i]).args[1]), '#')
398-
i += 1
399-
end
400-
while i > 2
406+
i = length(idx1)
407+
while i > 1 && !startswith(String(pc_expr(frame, idx1[i]).args[1]), '#')
401408
i -= 1
409+
end
410+
while i > 1
402411
frame.pc = idx1[i]
403412
methoddef!(recurse, [], frame, frame.pc; define=define)
413+
i -= 1
404414
end
405415
frame.pc = pc0
406416
end
407-
parentname = get_parentname(name) # e.g., name = #foo#7 and parentname = foo
408-
nextstmt = pc_expr(frame, pc+1)
409-
if ismethod1(nextstmt)
410-
name = nextstmt.args[1]
411-
end
412417
if name != parentname && !define
413418
name, endpc = correct_name!(recurse, frame, pc, name, parentname)
414419
end

0 commit comments

Comments
 (0)