Skip to content

Commit b7fd95f

Browse files
committed
fix for Julia versions before introduction of public
1 parent 2419e24 commit b7fd95f

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/pkgdefaults.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,12 @@ for (k,v) in prefixdict
347347
See also: [`Unitful.L`](@ref).
348348
"""
349349
expr1 = quote @doc $docstring ((const $sym_l = $sym_L), $sym_L) end
350-
expr2 = Expr(:public, sym_L, sym_l)
351-
run = Expr(:block, expr1, expr2, nothing)
350+
if VERSION >= v"1.11.0-DEV.469"
351+
expr2 = Expr(:public, sym_L, sym_l)
352+
run = Expr(:block, expr1, expr2, nothing)
353+
else
354+
run = Expr(:block, expr1, nothing)
355+
end
352356
eval(run)
353357
end
354358
end

src/user.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ macro dimension(symb, abbr, name, autodocs=false, makepublic=autodocs)
108108
end
109109
$s
110110
end
111-
makepublic || return esc(expr1)
111+
(VERSION >= v"1.11.0-DEV.469" && makepublic) || return esc(expr1)
112112
expr2 = Expr(:public, Symbol(abbr), name, uname, funame)
113113
esc(Expr(:block, expr1, expr2, s))
114114
end
@@ -174,7 +174,7 @@ macro derived_dimension(name, dims, autodocs=false, makepublic=autodocs)
174174
nothing
175175
end
176176

177-
makepublic || return esc(expr1)
177+
(VERSION >= v"1.11.0-DEV.469" && makepublic) || return esc(expr1)
178178
expr2 = Expr(:public, name, uname, funame)
179179
esc(Expr(:block, expr1, expr2, nothing))
180180
end
@@ -233,7 +233,7 @@ macro refunit(symb, abbr, name, dimension, tf, autodocs=false, makepublic=autodo
233233
end)
234234
end
235235

236-
makepublic && push!(expr.args, Expr(:public, symb))
236+
VERSION >= v"1.11.0-DEV.469" && makepublic && push!(expr.args, Expr(:public, symb))
237237

238238
push!(expr.args, quote
239239
$preferunits($symb)
@@ -284,7 +284,7 @@ macro unit(symb, abbr, name, equals, tf, autodocs=false, makepublic=autodocs)
284284
end)
285285
end
286286

287-
makepublic && push!(expr.args, Expr(:public, symb))
287+
VERSION >= v"1.11.0-DEV.469" && makepublic && push!(expr.args, Expr(:public, symb))
288288

289289
push!(expr.args, quote
290290
$symb
@@ -310,7 +310,7 @@ macro affineunit(symb, abbr, offset, makepublic=true)
310310
Base.@__doc__ const global $s = $affineunit($offset)
311311
$Base.show(io::$IO, ::$genericunit($s)) = $print(io, $abbr)
312312
end
313-
makepublic || return esc(expr1)
313+
(VERSION >= v"1.11.0-DEV.469" && makepublic) || return esc(expr1)
314314
expr2 = Expr(:public, s)
315315
esc(Expr(:block, expr1, expr2, s))
316316
end
@@ -372,7 +372,7 @@ macro prefixed_unit_symbols(symb, name, user_dimension, basefactor, autodocs=fal
372372
end
373373
end
374374
end
375-
makepublic && push!(expr.args, Expr(:public, s))
375+
VERSION >= v"1.11.0-DEV.469" && makepublic && push!(expr.args, Expr(:public, s))
376376
push!(expr.args, ea)
377377
end
378378

@@ -400,7 +400,7 @@ macro unit_symbols(symb, name, user_dimension, basefactor, makepublic=false)
400400
$(basefactors_expr(__module__, n, basefactor))
401401
Base.@__doc__ const global $s = $FreeUnits{($u,), $dimension($u), $nothing}()
402402
end
403-
makepublic || return esc(expr1)
403+
(VERSION >= v"1.11.0-DEV.469" && makepublic) || return esc(expr1)
404404
expr2 = Expr(:public, s)
405405
esc(Expr(:block, expr1, expr2, s))
406406
end

0 commit comments

Comments
 (0)