Skip to content
Snippets Groups Projects

fix legacy import

Merged Lukas Hupe requested to merge fix-legacy into dev
2 files
+ 23
11
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 11
5
@@ -94,6 +94,12 @@ will return
```
"""
function splitstoredtype(t::Expr)
# catch module names and stuff
if t.head == :.
n,p,o = InPartS.splitstoredtype(t.args[2].value)
return Expr(:., t.args[1], QuoteNode(n)), p, o
end
omitted = []
if t.head == :where
omitted = t.args[2:end]
@@ -267,14 +273,14 @@ module ExportUtils
# function called when instantiating struct upon deserialization (default: call kw-only constructor)
importconstruct(t::Type; kwargs...) = t(; kwargs...)
#
#
"""
isserializable(T::Type) → Bool
isserializable(item::T) → Bool
Indicates whether serialize!/deserialize were defined for the type T or item(s) of type T. The type
for which `true` is returned always corresponds to the type that can also be passed to `serialize!`.
For `VectorExport`s, this means that the relevant serializable type is `Vector{T}`, not `T` itself.
For more information on the export system, consult the InPartS manual.
"""
isserializable(::Type) = false
@@ -357,7 +363,7 @@ macro exportoff(type, fieldnames...)
block = quote end
for field in fieldnames
val = FieldExport{field}
push!(block.args,
push!(block.args,
quote
ExportUtils.exportfield(::Type{<:$(esc(type))}, ::$val) = false
end
@@ -407,7 +413,7 @@ will contain the data corresponding to the exported fields of the type.
The first form registers an existing function `func`, the second and third define and
register a function at the same time.
The fourth form takes an expression `expr` as the second argument
that directly yields the struct (avoiding the definition of an extra function). In the `expr`, the symbol
`type` refers to the type that is being imported (which will be a subtype of the `type` passed as the
@@ -462,7 +468,7 @@ end
function _importconstruct_def(type::Type, e::Expr)
kwargslist = Expr(:parameters)
for ex allexports(type)
for ex allexports(type)
push!(kwargslist.args, ExportUtils.importname(type, ex))
end
return quote
Loading