Skip to content

Commit fb6699d

Browse files
serenity4MichaelHatherly
authored andcommitted
Fix extraction of argnames for generated functions
1 parent 9a8adb5 commit fb6699d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/utilities.jl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,18 @@ args = arguments(first(methods(f)))
449449
```
450450
"""
451451
function arguments(m::Method)
452-
local template = get_method_source(m)
453-
if isdefined(template, :slotnames)
454-
local args = map(template.slotnames[1:nargs(m)]) do arg
452+
local argnames = nothing
453+
if isdefined(m, :generator)
454+
# Generated function.
455+
argnames = m.generator.argnames
456+
else
457+
local template = get_method_source(m)
458+
if isdefined(template, :slotnames)
459+
argnames = template.slotnames
460+
end
461+
end
462+
if !isnothing(argnames)
463+
local args = map(argnames) do arg
455464
arg === Symbol("#unused#") ? "_" : arg
456465
end
457466
return filter(arg -> arg !== Symbol("#self#"), args)

0 commit comments

Comments
 (0)