Skip to content

Commit

Permalink
fix undef sparam in locals (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC authored Mar 20, 2019
1 parent 3bce6a9 commit 4976a36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,9 @@ function locals(frame::Frame)
if code.scope isa Method
syms = sparam_syms(code.scope)
for i in 1:length(syms)
push!(vars, Variable(data.sparams[i], syms[i], true))
if isassigned(data.sparams, i)
push!(vars, Variable(data.sparams[i], syms[i], true))
end
end
end
return vars
Expand Down
5 changes: 5 additions & 0 deletions test/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,8 @@ e = try
end
@test e isa UndefVarError
@test e.var == :S
# https://github.com/JuliaDebug/JuliaInterpreter.jl/issues/200
locs = JuliaInterpreter.locals(JuliaInterpreter.enter_call(foo, ""))
@test length(locs) == 3 # #self# + 2 variables
@test JuliaInterpreter.Variable("", :x, false) in locs
@test JuliaInterpreter.Variable(String, :T, true) in locs

0 comments on commit 4976a36

Please sign in to comment.