Skip to content

Commit ac8e704

Browse files
committed
fix copy of nothing
1 parent 10d9e76 commit ac8e704

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Expression.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ _data(x::Metadata) = getfield(x, :_data)
1414
Base.propertynames(x::Metadata) = propertynames(_data(x))
1515
@inline Base.getproperty(x::Metadata, f::Symbol) = getproperty(_data(x), f)
1616
Base.show(io::IO, x::Metadata) = print(io, "Metadata(", _data(x), ")")
17+
@inline _copy(x) = copy(x)
18+
@inline _copy(x::Nothing) = nothing
1719
@inline function Base.copy(metadata::Metadata)
1820
nt = _data(metadata)
19-
copied_nt = NamedTuple{keys(nt)}(map(copy, values(nt)))
21+
copied_nt = NamedTuple{keys(nt)}(map(_copy, values(nt)))
2022
return Metadata(copied_nt)
2123
end
2224
@inline Base.:(==)(x::Metadata, y::Metadata) = _data(x) == _data(y)

0 commit comments

Comments
 (0)