@@ -21,13 +21,6 @@ function buildfromschema(initializer, ::Type{T}, ::Type{NT}) where {T, NT<:Tup}
2121 StructArray {T} (nt)
2222end
2323
24- @static if VERSION < v " 1.2.0"
25- @inline _getproperty (v:: Tuple , field) = getfield (v, field)
26- @inline _getproperty (v, field) = getproperty (v, field)
27- else
28- const _getproperty = getproperty
29- end
30-
3124function _foreachfield (names, L)
3225 vars = ntuple (i -> gensym (), L)
3326 exprs = Expr[]
@@ -36,7 +29,7 @@ function _foreachfield(names, L)
3629 end
3730 for field in names
3831 sym = QuoteNode (field)
39- args = [Expr (:call , :_getproperty , var, sym) for var in vars]
32+ args = [Expr (:call , :getcolumn , var, sym) for var in vars]
4033 push! (exprs, Expr (:call , :f , args... ))
4134 end
4235 push! (exprs, :(return nothing ))
@@ -122,13 +115,6 @@ function replace_storage(f, s::StructArray{T}) where T
122115 StructArray {T} (newcols)
123116end
124117
125- to_tup (c:: T ) where {T} = to_tup (c, fieldnames (staticschema (T)))
126- function to_tup (c, fields:: NTuple{N, Symbol} ) where N
127- t = ntuple (i -> getproperty (c, fields[i]), N)
128- return NamedTuple {fields} (t)
129- end
130- to_tup (c, fields:: NTuple{N, Int} ) where {N} = ntuple (i -> _getproperty (c, fields[i]), N)
131-
132118astuple (:: Type{NamedTuple{names, types}} ) where {names, types} = types
133119astuple (:: Type{T} ) where {T<: Tuple } = T
134120
@@ -148,8 +134,3 @@ _setdiff(a, b) = setdiff(a, b)
148134@inline _setdiff (a:: Tuple , :: Tuple{} ) = a
149135@inline _setdiff (a:: Tuple , b:: Tuple ) = _setdiff (_exclude (a, b[1 ]), Base. tail (b))
150136@inline _exclude (a, b) = foldl ((ys, x) -> x == b ? ys : (ys... , x), a; init = ())
151-
152- # _foreach(f, xs) = foreach(f, xs)
153- _foreach (f, xs:: Tuple ) = foldl ((_, x) -> (f (x); nothing ), xs; init = nothing )
154- # Note `foreach` is not optimized for tuples yet.
155- # See: https://github.com/JuliaLang/julia/pull/31901
0 commit comments