365
365
rename_framemethods! (frame:: Frame ) = rename_framemethods! (finish_and_return!, frame)
366
366
367
367
"""
368
- pctop, isgen = find_corrected_name(frame, pc, name, parentname)
368
+ pctop, isgen = find_corrected_name(recurse, frame, pc, name, parentname)
369
369
370
370
Scans forward from `pc` in `frame` until a method is found that calls `name`.
371
371
`pctop` points to the beginning of that method's signature.
@@ -374,16 +374,29 @@ Scans forward from `pc` in `frame` until a method is found that calls `name`.
374
374
Alternatively, this returns `nothing` if `pc` does not appear to point to either
375
375
a keyword or generated method.
376
376
"""
377
- function find_corrected_name (frame, pc, name, parentname)
377
+ function find_corrected_name (@nospecialize (recurse), frame, pc, name, parentname)
378
378
stmt = pc_expr (frame, pc)
379
379
while true
380
+ pc0 = pc
380
381
while ! ismethod3 (stmt)
381
382
pc = next_or_nothing (frame, pc)
382
383
pc === nothing && return nothing
383
384
stmt = pc_expr (frame, pc)
384
385
end
385
386
body = stmt. args[3 ]
386
- if stmt. args[1 ] != name
387
+ if stmt. args[1 ] != name && isa (body, SSAValue)
388
+ # OK, we can't skip all the stuff that might define the body
389
+ # See https://github.com/timholy/Revise.jl/issues/398
390
+ pc = pc0
391
+ stmt = pc_expr (frame, pc)
392
+ while ! ismethod3 (stmt)
393
+ pc = step_expr! (recurse, frame, stmt, true )
394
+ pc === nothing && return nothing
395
+ stmt = pc_expr (frame, pc)
396
+ end
397
+ body = @lookup (frame, stmt. args[3 ])
398
+ end
399
+ if stmt. args[1 ] != name && isa (body, CodeInfo)
387
400
# This might be the GeneratedFunctionStub for a @generated method
388
401
for (i, bodystmt) in enumerate (body. code)
389
402
if isexpr (bodystmt, :meta ) && bodystmt. args[1 ] == :generated
435
448
436
449
function get_running_name (@nospecialize (recurse), frame, pc, name, parentname)
437
450
# Get the correct name (the one that's actively running)
438
- nameinfo = find_corrected_name (frame, pc, name, parentname)
451
+ nameinfo = find_corrected_name (recurse, frame, pc, name, parentname)
439
452
if nameinfo === nothing
440
453
pc = skip_until (stmt-> isexpr (stmt, :method , 3 ), frame, pc)
441
454
pc = next_or_nothing (frame, pc)
0 commit comments