Skip to content

Commit

Permalink
Merge pull request #14 from JuliaDebug/teh/ccall
Browse files Browse the repository at this point in the history
Allow ccalls that hardcode 2 Symbols
  • Loading branch information
timholy authored Feb 10, 2019
2 parents 62bb82a + 43d6741 commit 45c5368
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ instantiate_type_in_env(arg, spsig, spvals) =

function resolvefc(@nospecialize expr)
(isa(expr, Symbol) || isa(expr, String) || isa(expr, QuoteNode)) && return expr
isa(expr, Tuple{Symbol,Symbol}) && return expr
if isexpr(expr, :call)
a = expr.args[1]
(isa(a, QuoteNode) && a.value == Core.tuple) || error("unexpected ccall to ", expr)
Expand Down
10 changes: 10 additions & 0 deletions test/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ fkw(x::Int8; y=0, z="hello") = y
frame = JuliaInterpreter.prepare_toplevel(Main, :(Vararg.body.body.name))
@test JuliaInterpreter.finish_and_return!(JuliaStackFrame[], frame, true) === Vararg.body.body.name

# issue #8
ex = quote
if sizeof(JLOptions) === ccall(:jl_sizeof_jl_options, Int, ())
else
Expand All @@ -47,3 +48,12 @@ ex = quote
end
frame = JuliaInterpreter.prepare_toplevel(Base, ex)
JuliaInterpreter.finish_and_return!(JuliaStackFrame[], frame, true)

# ccall with two Symbols
ex = quote
@testset "Some tests" begin
@test 2 > 1
end
end
frame = JuliaInterpreter.prepare_toplevel(Main, ex)
JuliaInterpreter.finish_and_return!(JuliaStackFrame[], frame, true)

0 comments on commit 45c5368

Please sign in to comment.