Skip to content

Commit

Permalink
rename T_old to T
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaensel committed Dec 12, 2024
1 parent cf22b24 commit 206b77f
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/Stipple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1020,10 +1020,10 @@ macro kwredef(expr)
n=1
end

T_old = t[n]
T = t[n]

if isa(T_old, Expr) && T_old.head == Symbol(".")
T_old = (split(string(T_old), '.')[end] |> Symbol)
if isa(T, Expr) && T.head == Symbol(".")
T = (split(string(T), '.')[end] |> Symbol)
end

# in the first run the datatype is not yet defined
Expand All @@ -1032,15 +1032,14 @@ macro kwredef(expr)
called_first_time = !isa(T_old, DataType)
t[n] = T_new = called_first_time ? Symbol(T_old, :def) : gensym(T_old)

esc(quote
quote
Base.@kwdef $expr
$T_old = $T_new
$T = $T_new
if Base.VERSION < v"1.8-"
$curly ? $T_new.body.name.name = $(QuoteNode(T_old)) : $T_new.name.name = $(QuoteNode(T_old)) # fix the name
$curly ? $T_new.body.name.name = $(QuoteNode(T)) : $T_new.name.name = $(QuoteNode(T)) # fix the name
end

$T_new
end)
end |> esc
end

"""
Expand Down

0 comments on commit 206b77f

Please sign in to comment.