Skip to content

Commit 9198123

Browse files
authored
Pass the native interpreter to Cthulhu. (#258)
1 parent fc9b877 commit 9198123

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/reflection.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ function code_typed(@nospecialize(job::CompilerJob); interactive::Bool=false, kw
4949
# call Cthulhu without introducing a dependency on Cthulhu
5050
mod = get(Base.loaded_modules, Cthulhu, nothing)
5151
mod===nothing && error("Interactive code reflection requires Cthulhu; please install and load this package first.")
52+
interp = get_interpreter(job)
5253
descend_code_typed = getfield(mod, :descend_code_typed)
53-
descend_code_typed(job.source.f, job.source.tt; kwargs...)
54+
descend_code_typed(job.source.f, job.source.tt; interp, kwargs...)
5455
elseif VERSION >= v"1.7-"
5556
interp = get_interpreter(job)
5657
InteractiveUtils.code_typed(job.source.f, job.source.tt; interp, kwargs...)
@@ -66,8 +67,9 @@ function code_warntype(io::IO, @nospecialize(job::CompilerJob); interactive::Boo
6667
# call Cthulhu without introducing a dependency on Cthulhu
6768
mod = get(Base.loaded_modules, Cthulhu, nothing)
6869
mod===nothing && error("Interactive code reflection requires Cthulhu; please install and load this package first.")
70+
interp = get_interpreter(job)
6971
descend_code_warntype = getfield(mod, :descend_code_warntype)
70-
descend_code_warntype(job.source.f, job.source.tt; kwargs...)
72+
descend_code_warntype(job.source.f, job.source.tt; interp, kwargs...)
7173
elseif VERSION >= v"1.7-"
7274
interp = get_interpreter(job)
7375
InteractiveUtils.code_warntype(io, job.source.f, job.source.tt; interp, kwargs...)
@@ -187,8 +189,8 @@ See also: `InteractiveUtils.@code_typed`
187189
macro device_code_typed(ex...)
188190
quote
189191
output = Dict{CompilerJob,Any}()
190-
function hook(job::CompilerJob)
191-
output[job] = code_typed(job)
192+
function hook(job::CompilerJob; kwargs...)
193+
output[job] = code_typed(job; kwargs...)
192194
end
193195
$(emit_hooked_compilation(:hook, ex...))
194196
output

0 commit comments

Comments
 (0)