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