Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 33 additions & 30 deletions src/all_implementations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2090,14 +2090,16 @@

"""
Base.getindex(
layout::Record{FIELDS,CONTENTS},
f::Symbol,
) where {FIELDS,CONTENTS<:Base.Tuple{Vararg{Content}}}
layout::AwkwardArray.Record,
f::Symbol,
)
"""
Base.getindex(
layout::Record{FIELDS,CONTENTS},
f::Symbol,
) where {FIELDS,CONTENTS<:Base.Tuple{Vararg{Content}}} = layout.array.contents[f][layout.at]
layout::AwkwardArray.Record,
f::Symbol,
) = getfield(layout, :array).contents[f][getfield(layout, :at)]

Base.getproperty(layout::Record, f::Symbol) = layout[f]

Check warning on line 2102 in src/all_implementations.jl

View check run for this annotation

Codecov / codecov/patch

src/all_implementations.jl#L2102

Added line #L2102 was not covered by tests

"""
Base.:(==)(
Expand Down Expand Up @@ -2388,15 +2390,16 @@

"""
Base.getindex(
layout::SlotRecord{CONTENTS},
layout::SlotRecord,
f::Int64,
) where {CONTENTS<:Base.Tuple{Vararg{Content}}}
)
"""
Base.getindex(
layout::SlotRecord{CONTENTS},
layout::SlotRecord,
f::Int64,
) where {CONTENTS<:Base.Tuple{Vararg{Content}}} =
layout.array.contents[f][layout.at]
) = getfield(layout, :array).contents[f][getfield(layout, :at)]

Base.getproperty(layout::SlotRecord, f::Symbol) = layout[f]

Check warning on line 2402 in src/all_implementations.jl

View check run for this annotation

Codecov / codecov/patch

src/all_implementations.jl#L2402

Added line #L2402 was not covered by tests

"""
Base.:(==)(
Expand Down Expand Up @@ -2445,7 +2448,7 @@
CONTENTS1<:Base.Tuple{Vararg{Content,N}},
CONTENTS2<:Base.Tuple{Vararg{Content,N}},
}
for i in eachindex(layout1.array.contents) # same number of indexes by type constraint
for i in eachindex(getfield(layout1, :array).contents) # same number of indexes by type constraint
if layout1[i] != layout2[i] # compare tuple items
return false
end
Expand Down Expand Up @@ -4002,8 +4005,8 @@
function Base.push!(special::Specialization, input)
tmp = length(special.tagged)
push!(special.tagged, input)
push!(special.array.tags, special.tag - firstindex(special.array.contents))
push!(special.array.index, tmp)
push!(getfield(special, :array).tags, special.tag - firstindex(getfield(special, :array).contents))
push!(getfield(special, :array).index, tmp)
special
end

Expand All @@ -4023,8 +4026,8 @@
function end_list!(special::Specialization)
tmp = length(special.tagged)
end_list!(special.tagged)
push!(special.array.tags, special.tag - firstindex(special.array.contents))
push!(special.array.index, tmp)
push!(getfield(special, :array).tags, special.tag - firstindex(getfield(special, :array).contents))
push!(getfield(special, :array).index, tmp)
special
end

Expand All @@ -4034,8 +4037,8 @@
function end_record!(special::Specialization)
tmp = length(special.tagged)
end_record!(special.tagged)
push!(special.array.tags, special.tag - firstindex(special.array.contents))
push!(special.array.index, tmp)
push!(getfield(special, :array).tags, special.tag - firstindex(getfield(special, :array).contents))
push!(getfield(special, :array).index, tmp)

Check warning on line 4041 in src/all_implementations.jl

View check run for this annotation

Codecov / codecov/patch

src/all_implementations.jl#L4040-L4041

Added lines #L4040 - L4041 were not covered by tests
special
end

Expand All @@ -4045,8 +4048,8 @@
function end_tuple!(special::Specialization)
tmp = length(special.tagged)
end_tuple!(special.tagged)
push!(special.array.tags, special.tag - firstindex(special.array.contents))
push!(special.array.index, tmp)
push!(getfield(special, :array).tags, special.tag - firstindex(getfield(special, :array).contents))
push!(getfield(special, :array).index, tmp)

Check warning on line 4052 in src/all_implementations.jl

View check run for this annotation

Codecov / codecov/patch

src/all_implementations.jl#L4051-L4052

Added lines #L4051 - L4052 were not covered by tests
special
end

Expand All @@ -4060,8 +4063,8 @@
) where {ARRAY<:UnionArray,TAGGED<:OptionType}
tmp = length(special.tagged)
push_null!(special.tagged)
push!(special.array.tags, special.tag - firstindex(special.array.contents))
push!(special.array.index, tmp)
push!(getfield(special, :array).tags, special.tag - firstindex(getfield(special, :array).contents))
push!(getfield(special, :array).index, tmp)

Check warning on line 4067 in src/all_implementations.jl

View check run for this annotation

Codecov / codecov/patch

src/all_implementations.jl#L4066-L4067

Added lines #L4066 - L4067 were not covered by tests
special
end

Expand All @@ -4071,8 +4074,8 @@
function push_dummy!(special::Specialization)
tmp = length(special.tagged)
push_dummy!(special.tagged)
push!(special.array.tags, special.tag - firstindex(special.array.contents))
push!(special.array.index, tmp)
push!(getfield(special, :array).tags, special.tag - firstindex(getfield(special, :array).contents))
push!(getfield(special, :array).index, tmp)
special
end

Expand Down Expand Up @@ -4236,7 +4239,7 @@
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {FIELDS,CONTENTS<:Base.Tuple{Vararg{Content}}} = NamedTuple{FIELDS}(
to_vector_or_scalar(record.array.contents[f][record.at], view = view, na = na) for
to_vector_or_scalar(getfield(record, :array).contents[f][record.at], view = view, na = na) for
f in FIELDS
)

Expand All @@ -4253,7 +4256,7 @@
na::Union{Missing,Nothing} = missing,
) where {CONTENTS<:Base.Tuple{Vararg{Content}}} = Base.Tuple(
to_vector_or_scalar(content[record.at], view = view, na = na) for
content in tuple.array.contents
content in getfield(tuple, :array).contents
)

"""
Expand Down Expand Up @@ -4731,7 +4734,7 @@
limit_cols -= 5 # anticipate the ", ..."

which = 0
fields = keys(data.array.contents)
fields = keys(getfield(data, :array).contents)

Check warning on line 4737 in src/all_implementations.jl

View check run for this annotation

Codecov / codecov/patch

src/all_implementations.jl#L4737

Added line #L4737 was not covered by tests
for field in fields
key = Base.string(field)

Expand Down Expand Up @@ -4798,7 +4801,7 @@
limit_cols -= 5 # anticipate the ", ..."

which = 0
fields = eachindex(data.array.contents)
fields = eachindex(getfield(data, :array).contents)

Check warning on line 4804 in src/all_implementations.jl

View check run for this annotation

Codecov / codecov/patch

src/all_implementations.jl#L4804

Added line #L4804 was not covered by tests
for field in fields
if which == 0
for_comma = 0
Expand Down Expand Up @@ -4916,7 +4919,7 @@
front = Vector{String}([]) # 1-indexed

which = 0
fields = keys(data.array.contents)
fields = keys(getfield(data, :array).contents)

Check warning on line 4922 in src/all_implementations.jl

View check run for this annotation

Codecov / codecov/patch

src/all_implementations.jl#L4922

Added line #L4922 was not covered by tests
for field in fields
key = Base.string(field)
if occursin(r"^[A-Za-z_][A-Za-z_0-9]*$", key)
Expand Down Expand Up @@ -4957,7 +4960,7 @@
front = Vector{String}([]) # 1-indexed

which = 0
fields = eachindex(data.array.contents)
fields = eachindex(getfield(data, :array).contents)

Check warning on line 4963 in src/all_implementations.jl

View check run for this annotation

Codecov / codecov/patch

src/all_implementations.jl#L4963

Added line #L4963 was not covered by tests
for field in fields
(_, strs) = _horizontal(data[field], limit_cols - 2)
push!(front, join(strs, ""))
Expand Down
Loading