Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/codeedges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ function add_links!(target::Pair{Union{SSAValue,SlotNumber,GlobalRef},Links}, @n
add_links!(target, stmt.args[i], cl)
end
end
elseif (@static @isdefined(EnterNode) ? stmt isa EnterNode : false)
isdefined(stmt, :scope) && add_links!(target, stmt.scope, cl)
elseif stmt isa GotoIfNot
add_links!(target, stmt.cond, cl)
elseif stmt isa ReturnNode
Expand Down
18 changes: 18 additions & 0 deletions test/codeedges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,24 @@ module ModSelective end
selective_eval_fromstart!(frame, isrequired, #=istoplevel=#true)
@test ModSelective.k != ModEval.k

@static if isdefined(Test, Symbol("@with_testset"))
let src = Meta.lower(@__MODULE__, :(@testset begin f() = 1 end)).args[1]
enteridx = findfirst(src.code) do stmt
stmt isa Core.EnterNode && isdefined(stmt, :scope)
end
@test enteridx !== nothing
if enteridx !== nothing
scope = (src.code[enteridx]::Core.EnterNode).scope
@test scope isa Core.SSAValue
if scope isa Core.SSAValue
links = LoweredCodeUtils.CodeLinks(@__MODULE__, src)
@test scope.id in links.ssapreds[enteridx].ssas
@test enteridx in links.ssasuccs[scope.id].ssas
end
end
end
end

# Control-flow
ex = quote
flag2 = true
Expand Down
Loading