Skip to content

Fix for change in CodeInfo.slotnames type on julia master #251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2019
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/JuliaInterpreter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ if VERSION < v"1.2.0-DEV.572"
Base.convert(::Type{Some{T}}, x::Some{T}) where {T} = x
end

const SlotNamesType = VERSION < v"1.2.0-DEV.606" ? Vector{Any} : Vector{Symbol}

include("types.jl")
include("utils.jl")
include("construct.jl")
Expand Down
2 changes: 1 addition & 1 deletion src/construct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ end
function prepare_framedata(framecode, argvals::Vector{Any}, caller_will_catch_err::Bool=false)
if isa(framecode.scope, Method)
meth, src = framecode.scope::Method, framecode.src
slotnames = src.slotnames::Vector{Any} # this is more strongly typed in julia.h than in jltypes.c
slotnames = src.slotnames::SlotNamesType
ssavt = src.ssavaluetypes
ng = isa(ssavt, Int) ? ssavt : length(ssavt::Vector{Any})
nargs, meth_nargs = length(argvals), Int(meth.nargs)
Expand Down
2 changes: 1 addition & 1 deletion src/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ function do_assignment!(frame, @nospecialize(lhs), @nospecialize(rhs))
data.ssavalues[lhs.id] = rhs
elseif isa(lhs, SlotNumber)
data.locals[lhs.id] = Some{Any}(rhs)
slotnames = code.src.slotnames::Vector{Any}
slotnames = code.src.slotnames::SlotNamesType
data.last_reference[slotnames[lhs.id]::Symbol] = lhs.id
elseif isa(lhs, GlobalRef)
Core.eval(lhs.mod, :($(lhs.name) = $(QuoteNode(rhs))))
Expand Down
2 changes: 1 addition & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ function locals(frame::Frame)
vars = Variable[]
data, code = frame.framedata, frame.framecode
added = Set{Symbol}()
slotnames = code.src.slotnames::Vector{Any}
slotnames = code.src.slotnames::SlotNamesType
for sym in slotnames
sym ∈ added && continue
idx = get(data.last_reference, sym, 0)
Expand Down