Skip to content

Commit fee2336

Browse files
authored
Recognize Core.declare_const in get_lhs_rhs (#129)
This is the minimal change to get Revise working with JuliaLang/julia#57470. Comparison of lowering of `const foo = 1`: 1.11: Expr(:const, :foo), Expr(:(=), :foo, 1) (with edge 2 -> 1) 1.12: Expr(:const, :foo, 1) 1.13: Expr(:call, Core.declare_const, :foo, 1)
1 parent d821711 commit fee2336

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/codeedges.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,12 @@ function get_lhs_rhs(@nospecialize stmt)
203203
if isexpr(stmt, :(=))
204204
return Pair{Any,Any}(stmt.args[1], stmt.args[2])
205205
elseif isexpr(stmt, :const) && length(stmt.args) == 2
206+
# TODO: remove lowered :const when Julia min compat >= 1.13
206207
return Pair{Any,Any}(stmt.args[1], stmt.args[2])
207208
elseif isexpr(stmt, :call) && length(stmt.args) == 4
208209
f = stmt.args[1]
209-
if is_global_ref_egal(f, :setglobal!, Core.setglobal!)
210+
# TODO: remove isdefined when Julia min compat >= 1.13
211+
if is_global_ref_egal(f, :setglobal!, Core.setglobal!) || @static isdefined(Core, :declare_const) && is_global_ref_egal(f, :declare_const, Core.declare_const)
210212
mod = stmt.args[2]
211213
mod isa Module || return nothing
212214
name = stmt.args[3]

0 commit comments

Comments
 (0)