fix for external modules

This commit is contained in:
Mike J Innes 2018-02-15 22:27:00 +00:00
parent 63862c2324
commit ee3784964e

View File

@ -7,7 +7,7 @@ children(x::Tuple) = x
mapchildren(f, x::Tuple) = map(f, x) mapchildren(f, x::Tuple) = map(f, x)
function treelike(T, fs = fieldnames(T)) function treelike(T, fs = fieldnames(T))
@eval begin @eval current_module() begin
children(x::$T) = ($([:(x.$f) for f in fs]...),) children(x::$T) = ($([:(x.$f) for f in fs]...),)
mapchildren(f, x::$T) = $T(f.(children(x))...) mapchildren(f, x::$T) = $T(f.(children(x))...)
adapt(T, x::$T) = mapchildren(x -> adapt(T, x), x) adapt(T, x::$T) = mapchildren(x -> adapt(T, x), x)