From 2b471666833597d45f09ddb40f75e8e2f7579b56 Mon Sep 17 00:00:00 2001 From: Kyle Daruwalla Date: Fri, 2 Apr 2021 10:31:37 -0500 Subject: [PATCH 1/2] Remove ambig field of Method for >= Julia 1.6 --- src/anonymous.jl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/anonymous.jl b/src/anonymous.jl index 6a0eeeb..859f0ef 100644 --- a/src/anonymous.jl +++ b/src/anonymous.jl @@ -12,22 +12,27 @@ 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) function newstruct!(meth::Method, mod, name, file, line, sig, - syms, ambig, nargs, isva, nospecialize, ast) + syms, nargs, isva, nospecialize, ast) meth.module = mod meth.name = name meth.file = file meth.line = line meth.sig = sig setfield!(meth, syms_fieldname, syms) - meth.ambig = ambig meth.nospecialize = nospecialize meth.nargs = nargs meth.isva = isva From eedb308d58c026eae3193fc2d73bab5f9f54e3ab Mon Sep 17 00:00:00 2001 From: Kyle Daruwalla Date: Fri, 2 Apr 2021 10:52:43 -0500 Subject: [PATCH 2/2] Add version check for newstruct! with ambig field --- src/anonymous.jl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/anonymous.jl b/src/anonymous.jl index 859f0ef..2c20d63 100644 --- a/src/anonymous.jl +++ b/src/anonymous.jl @@ -25,6 +25,24 @@ 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 + meth.name = name + meth.file = file + meth.line = line + meth.sig = sig + setfield!(meth, syms_fieldname, syms) + meth.ambig = ambig + meth.nospecialize = nospecialize + meth.nargs = nargs + meth.isva = isva + meth.source = ast + meth.pure = ast.pure + return meth +end +else function newstruct!(meth::Method, mod, name, file, line, sig, syms, nargs, isva, nospecialize, ast) meth.module = mod @@ -40,6 +58,7 @@ function newstruct!(meth::Method, mod, name, file, line, sig, meth.pure = ast.pure return meth end +end function structdata(t::TypeName) primary = Base.unwrap_unionall(t.wrapper)