Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix anonymous functions in Julia 1.6 #94

Merged
merged 2 commits into from
Apr 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/anonymous.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@ else
const _uncompress = Base._uncompressed_ast
end

if VERSION < v"1.6-"
structdata(meth::Method) =
[meth.module, meth.name, meth.file, meth.line, meth.sig, getfield(meth, syms_fieldname),
meth.ambig, meth.nargs, meth.isva, meth.nospecialize,
_uncompress(meth, meth.source)]
else
structdata(meth::Method) =
[meth.module, meth.name, meth.file, meth.line, meth.sig, getfield(meth, syms_fieldname),
meth.nargs, meth.isva, meth.nospecialize, _uncompress(meth, meth.source)]
end

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

if VERSION < v"1.6-"
function newstruct!(meth::Method, mod, name, file, line, sig,
syms, ambig, nargs, isva, nospecialize, ast)
meth.module = mod
Expand All @@ -35,6 +42,23 @@ function newstruct!(meth::Method, mod, name, file, line, sig,
meth.pure = ast.pure
return meth
end
else
function newstruct!(meth::Method, mod, name, file, line, sig,
syms, nargs, isva, nospecialize, ast)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To confirm, has ambig been removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah remove here

meth.module = mod
meth.name = name
meth.file = file
meth.line = line
meth.sig = sig
setfield!(meth, syms_fieldname, syms)
meth.nospecialize = nospecialize
meth.nargs = nargs
meth.isva = isva
meth.source = ast
meth.pure = ast.pure
return meth
end
end

function structdata(t::TypeName)
primary = Base.unwrap_unionall(t.wrapper)
Expand Down