@@ -139,6 +139,10 @@ _issubrange(i::Colon, j::ConcreteIndex) = true
139
139
140
140
A macro that returns an instance of `VarName` given the symbol or expression of a Julia variable,
141
141
e.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.
142
146
"""
143
147
macro varname (expr:: Union{Expr, Symbol} )
144
148
return esc (varname (expr))
177
181
"""
178
182
@vinds(expr)
179
183
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
181
185
`((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.
182
190
"""
183
191
macro vinds (expr:: Union{Expr, Symbol} )
184
192
return esc (vinds (expr))
@@ -188,7 +196,11 @@ vinds(expr::Symbol) = Expr(:tuple)
188
196
function vinds (expr:: Expr )
189
197
if Meta. isexpr (expr, :ref )
190
198
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
192
204
last = Expr (:tuple , ex. args[2 : end ]. .. )
193
205
init = vinds (ex. args[1 ]). args
194
206
return Expr (:tuple , init... , last)
@@ -197,7 +209,6 @@ function vinds(expr::Expr)
197
209
end
198
210
end
199
211
200
-
201
212
@generated function inargnames (:: VarName{s} , :: Model{_F, argnames} ) where {s, argnames, _F}
202
213
return s in argnames
203
214
end
0 commit comments