Skip to content

Commit 14cd434

Browse files
Merge pull request #94 from darsnack/darsnack/julia1.6
Fix anonymous functions in Julia 1.6
2 parents f66e5da + eedb308 commit 14cd434

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/anonymous.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,20 @@ else
1212
const _uncompress = Base._uncompressed_ast
1313
end
1414

15+
if VERSION < v"1.6-"
1516
structdata(meth::Method) =
1617
[meth.module, meth.name, meth.file, meth.line, meth.sig, getfield(meth, syms_fieldname),
1718
meth.ambig, meth.nargs, meth.isva, meth.nospecialize,
1819
_uncompress(meth, meth.source)]
20+
else
21+
structdata(meth::Method) =
22+
[meth.module, meth.name, meth.file, meth.line, meth.sig, getfield(meth, syms_fieldname),
23+
meth.nargs, meth.isva, meth.nospecialize, _uncompress(meth, meth.source)]
24+
end
1925

2026
initstruct(::Type{Method}) = ccall(:jl_new_method_uninit, Ref{Method}, (Any,), Main)
2127

28+
if VERSION < v"1.6-"
2229
function newstruct!(meth::Method, mod, name, file, line, sig,
2330
syms, ambig, nargs, isva, nospecialize, ast)
2431
meth.module = mod
@@ -35,6 +42,23 @@ function newstruct!(meth::Method, mod, name, file, line, sig,
3542
meth.pure = ast.pure
3643
return meth
3744
end
45+
else
46+
function newstruct!(meth::Method, mod, name, file, line, sig,
47+
syms, nargs, isva, nospecialize, ast)
48+
meth.module = mod
49+
meth.name = name
50+
meth.file = file
51+
meth.line = line
52+
meth.sig = sig
53+
setfield!(meth, syms_fieldname, syms)
54+
meth.nospecialize = nospecialize
55+
meth.nargs = nargs
56+
meth.isva = isva
57+
meth.source = ast
58+
meth.pure = ast.pure
59+
return meth
60+
end
61+
end
3862

3963
function structdata(t::TypeName)
4064
primary = Base.unwrap_unionall(t.wrapper)

0 commit comments

Comments
 (0)