@@ -455,20 +455,20 @@ julia> @varname(x[1,2][1+5][45][3]).indexing
455
455
Using `begin` in an indexing expression to refer to the first index requires at least
456
456
Julia 1.5.
457
457
"""
458
- macro varname (expr:: Union{Expr, Symbol} , concretize= false )
458
+ macro varname (expr:: Union{Expr, Symbol} , concretize:: Bool = false )
459
459
return varname (expr, concretize)
460
460
end
461
461
462
- varname (sym:: Symbol , concretize= false ) = :($ (AbstractPPL. VarName){$ (QuoteNode (sym))}())
463
- function varname (expr:: Expr , concretize= false )
462
+ varname (sym:: Symbol , concretize:: Bool = false ) = :($ (AbstractPPL. VarName){$ (QuoteNode (sym))}())
463
+ function varname (expr:: Expr , concretize:: Bool = false )
464
464
if Meta. isexpr (expr, :ref ) || Meta. isexpr (expr, :.)
465
465
# Split into object/base symbol and lens.
466
466
sym_escaped, lens = Setfield. parse_obj_lens (expr)
467
467
# Setfield.jl escapes the return symbol, so we need to unescape
468
468
# to call `QuoteNode` on it.
469
469
sym = drop_escape (sym_escaped)
470
470
471
- return if Setfield. need_dynamic_lens (expr)
471
+ return if concretize && Setfield. need_dynamic_lens (expr)
472
472
:($ (AbstractPPL. concretize)($ (AbstractPPL. VarName){$ (QuoteNode (sym))}($ lens), $ sym_escaped))
473
473
else
474
474
:($ (AbstractPPL. VarName){$ (QuoteNode (sym))}($ lens))
0 commit comments