@@ -149,6 +149,8 @@ py_macro_assign(body, ans, ex) = push!(body, :($ans = $ex))
149
149
150
150
py_macro_del (body, var, tmp) = if tmp; push! (body, :($ pydel! ($ var))); end
151
151
152
+ ismacroexpr (ex, name) = isexpr (ex, :macrocall ) && (ex. args[1 ] === Symbol (name) || ex. args[1 ] === GlobalRef (Core, Symbol (name)))
153
+
152
154
function py_macro_lower (st, body, ans, ex; flavour= :expr )
153
155
154
156
# scalar literals
@@ -158,21 +160,21 @@ function py_macro_lower(st, body, ans, ex; flavour=:expr)
158
160
return false
159
161
160
162
# Int128 literals
161
- elseif isexpr (ex, :macrocall ) && ex . args[ 1 ] === GlobalRef (Core, Symbol ( " @int128_str" ) )
163
+ elseif ismacroexpr (ex, " @int128_str" )
162
164
value = parse (Int128, ex. args[3 ])
163
165
x = get! (pynew, st. consts, value)
164
166
py_macro_assign (body, ans, x)
165
167
return false
166
168
167
169
# UInt128 literals
168
- elseif isexpr (ex, :macrocall ) && ex . args[ 1 ] === GlobalRef (Core, Symbol ( " @uint128_str" ) )
170
+ elseif ismacroexpr (ex, " @uint128_str" )
169
171
value = parse (UInt128, ex. args[3 ])
170
172
x = get! (pynew, st. consts, value)
171
173
py_macro_assign (body, ans, x)
172
174
return false
173
175
174
176
# big integer literals
175
- elseif isexpr (ex, :macrocall ) && ex . args[ 1 ] === GlobalRef (Core, Symbol ( " @big_str" ) )
177
+ elseif ismacroexpr (ex, " @big_str" )
176
178
value = parse (BigInt, ex. args[3 ])
177
179
x = get! (pynew, st. consts, value)
178
180
py_macro_assign (body, ans, x)
0 commit comments