@@ -235,27 +235,29 @@ Base.similar(data::AbstractData{S}) where {S} = similar(data, S)
235
235
typesize (eltype (parent (data)), S)
236
236
end
237
237
238
+ @inline _getproperty (data:: AbstractData , :: Val{Name} ) where {Name} =
239
+ _getproperty (data, Val (Name), Name)
240
+
238
241
@generated function _getproperty (
239
242
data:: AbstractData{S} ,
240
243
:: Val{Name} ,
244
+ name,
241
245
) where {S, Name}
242
- errorstring = " Invalid field name $(Name) for type $(S) "
243
246
i = findfirst (isequal (Name), fieldnames (S))
244
- if i === nothing
245
- return :(error ($ errorstring))
246
- end
247
247
static_idx = Val {i} ()
248
- return :(Base. @_inline_meta ; DataLayouts. _property_view (data, $ static_idx))
248
+ return :(
249
+ Base. @_inline_meta ; DataLayouts. _property_view (data, $ static_idx, name)
250
+ )
249
251
end
250
252
251
253
@inline function Base. getproperty (data:: AbstractData{S} , name:: Symbol ) where {S}
252
- _getproperty (data, Val {name} ())
254
+ _getproperty (data, Val {name} (), name )
253
255
end
254
256
@inline function Base. dotgetproperty (
255
257
data:: AbstractData{S} ,
256
258
name:: Symbol ,
257
259
) where {S}
258
- _getproperty (data, Val {name} ())
260
+ _getproperty (data, Val {name} (), name )
259
261
end
260
262
261
263
Base. @propagate_inbounds function Base. getproperty (
@@ -275,11 +277,18 @@ Base.@propagate_inbounds function Base.getproperty(
275
277
union_all (data){SS, Base. tail (type_params (data))... }(dataview)
276
278
end
277
279
280
+ @noinline _property_view (
281
+ data:: AbstractData{S} ,
282
+ :: Val{Nothing} ,
283
+ name,
284
+ ) where {S} = error (" Invalid field name $name for type $(S) " )
285
+
278
286
# In the past, we've sometimes needed a generated function
279
287
# for inference and constant propagation:
280
288
Base. @propagate_inbounds @generated function _property_view (
281
289
data:: AD ,
282
290
:: Val{Idx} ,
291
+ name,
283
292
) where {S, Idx, AD <: AbstractData{S} }
284
293
SS = fieldtype (S, Idx)
285
294
T = eltype (parent_array_type (AD))
@@ -674,7 +683,7 @@ Base.lastindex(data::VF) = length(data)
674
683
nlevels (:: VF{S, Nv} ) where {S, Nv} = Nv
675
684
676
685
Base. @propagate_inbounds Base. getproperty (data:: VF , i:: Integer ) =
677
- _property_view (data, Val (i))
686
+ _property_view (data, Val (i), i )
678
687
679
688
Base. @propagate_inbounds column (data:: VF , i, h) = column (data, i, 1 , h)
680
689
0 commit comments