@@ -139,6 +139,10 @@ _issubrange(i::Colon, j::ConcreteIndex) = true
139139
140140A macro that returns an instance of `VarName` given the symbol or expression of a Julia variable,
141141e.g. `@varname x[1,2][1+5][45][3]` returns `VarName{:x}(((1, 2), (6,), (45,), (3,)))`.
142+
143+ !!! compat "Julia 1.5"
144+ Using `begin` in an indexing expression to refer to the first index requires at least
145+ Julia 1.5.
142146"""
143147macro varname (expr:: Union{Expr, Symbol} )
144148 return esc (varname (expr))
177181"""
178182 @vinds(expr)
179183
180- Returns a tuple of tuples of the indices in `expr`. For example, `@vinds x[1, :][2]` returns
184+ Returns a tuple of tuples of the indices in `expr`. For example, `@vinds x[1, :][2]` returns
181185`((1, Colon()), (2,))`.
186+
187+ !!! compat "Julia 1.5"
188+ Using `begin` in an indexing expression to refer to the first index requires at least
189+ Julia 1.5.
182190"""
183191macro vinds (expr:: Union{Expr, Symbol} )
184192 return esc (vinds (expr))
@@ -188,7 +196,11 @@ vinds(expr::Symbol) = Expr(:tuple)
188196function vinds (expr:: Expr )
189197 if Meta. isexpr (expr, :ref )
190198 ex = copy (expr)
191- Base. replace_ref_end! (ex)
199+ @static if VERSION < v " 1.5.0-DEV.666"
200+ Base. replace_ref_end! (ex)
201+ else
202+ Base. replace_ref_begin_end! (ex)
203+ end
192204 last = Expr (:tuple , ex. args[2 : end ]. .. )
193205 init = vinds (ex. args[1 ]). args
194206 return Expr (:tuple , init... , last)
@@ -197,7 +209,6 @@ function vinds(expr::Expr)
197209 end
198210end
199211
200-
201212@generated function inargnames (:: VarName{s} , :: Model{_F, argnames} ) where {s, argnames, _F}
202213 return s in argnames
203214end
0 commit comments