Skip to content

Commit

Permalink
Remove unused "deps" mechanism in internal sorting keywords [NFC] (#4…
Browse files Browse the repository at this point in the history
  • Loading branch information
LilithHafner authored Feb 12, 2023
1 parent ecfaef3 commit b9b47af
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions base/sort.jl
Original file line number Diff line number Diff line change
Expand Up @@ -429,19 +429,18 @@ macro getkw(syms...)
Expr(:block, (:($(esc(:((kw, $sym) = $getter(v, o, kw))))) for (sym, getter) in zip(syms, getters))...)
end

for (sym, deps, exp, type) in [
(:lo, (), :(firstindex(v)), Integer),
(:hi, (), :(lastindex(v)), Integer),
(:mn, (), :(throw(ArgumentError("mn is needed but has not been computed"))), :(eltype(v))),
(:mx, (), :(throw(ArgumentError("mx is needed but has not been computed"))), :(eltype(v))),
(:scratch, (), nothing, :(Union{Nothing, Vector})), # could have different eltype
(:allow_legacy_dispatch, (), true, Bool)]
for (sym, exp, type) in [
(:lo, :(firstindex(v)), Integer),
(:hi, :(lastindex(v)), Integer),
(:mn, :(throw(ArgumentError("mn is needed but has not been computed"))), :(eltype(v))),
(:mx, :(throw(ArgumentError("mx is needed but has not been computed"))), :(eltype(v))),
(:scratch, nothing, :(Union{Nothing, Vector})), # could have different eltype
(:allow_legacy_dispatch, true, Bool)]
usym = Symbol(:_, sym)
@eval function $usym(v, o, kw)
# using missing instead of nothing because scratch could === nothing.
res = get(kw, $(Expr(:quote, sym)), missing)
res !== missing && return kw, res::$type
@getkw $(deps...)
$sym = $exp
(;kw..., $sym), $sym::$type
end
Expand Down

0 comments on commit b9b47af

Please sign in to comment.