@@ -23,8 +23,6 @@ function buildfromschema(initializer, ::Type{T}, ::Type{NT}) where {T, NT<:Tup}
2323 StructArray {T} (nt)
2424end
2525
26- Base. @pure SkipConstructor (:: Type ) = false
27-
2826@static if VERSION < v " 1.2.0"
2927 @inline _getproperty (v:: Tuple , field) = getfield (v, field)
3028 @inline _getproperty (v, field) = getproperty (v, field)
4846
4947foreachfield (f, x:: T , xs... ) where {T} = foreachfield (staticschema (T), f, x, xs... )
5048
51- function createinstance (:: Type{T} , args... ) where {T}
52- SkipConstructor (T) ? unsafe_createinstance (T, args... ) : T (args... )
53- end
54-
49+ createinstance (:: Type{T} , args... ) where {T} = T (args... )
5550createinstance (:: Type{T} , args... ) where {T<: Union{Tuple, NamedTuple} } = T (args)
5651
57- @generated function unsafe_createinstance (:: Type{T} , args... ) where {T}
58- v = fieldnames (T)
59- new_tup = Expr (:(= ), Expr (:tuple , v... ), :args )
60- construct = Expr (:new , :T , (:(convert (fieldtype (T, $ (Expr (:quote , sym))), $ sym)) for sym in v). .. )
61- Expr (:block , new_tup, construct)
62- end
63-
6452add_params (:: Type{T} , :: Type{C} ) where {T, C<: Tuple } = T
6553add_params (:: Type{T} , :: Type{C} ) where {T<: Tuple , C<: Tuple } = C
6654add_params (:: Type{<:NamedTuple{names}} , :: Type{C} ) where {names, C<: Tuple } = NamedTuple{names, C}
0 commit comments