diff --git a/src/reflection/reflection.jl b/src/reflection/reflection.jl index 2f715c5..5851bc2 100644 --- a/src/reflection/reflection.jl +++ b/src/reflection/reflection.jl @@ -89,7 +89,13 @@ function invoke_tweaks!(ci::CodeInfo) ci.slotflags = [0x00, ci.slotflags[1], 0x00, ci.slotflags[2:end]...] ci.code = map(ci.code) do x prewalk(x) do x - x isa SlotNumber ? SlotNumber(x.id == 1 ? 2 : x.id+2) : x + if x isa SlotNumber + SlotNumber(x.id == 1 ? 2 : x.id+2) + elseif x isa Core.ReturnNode && isdefined(x, :val) && x.val isa SlotNumber + Core.ReturnNode(SlotNumber(x.val.id == 1 ? 2 : x.val.id+2)) + else + x + end end end end