Skip to content

Commit

Permalink
Evaluating %new expressions: prepare args and ccall jl_new_structv
Browse files Browse the repository at this point in the history
Fixes breakage from JuliaLang/julia#34176
  • Loading branch information
timholy committed Dec 29, 2019
1 parent 5611e3c commit 8ea0ad7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,9 @@ function eval_rhs(@nospecialize(recurse), frame, node::Expr)
head = node.head
if head == :new
mod = moduleof(frame)
rhs = ccall(:jl_new_struct_uninit, Any, (Any,), @lookup(mod, frame, node.args[1]))
for i = 1:length(node.args) - 1
ccall(:jl_set_nth_field, Cvoid, (Any, Csize_t, Any), rhs, i-1, @lookup(mod, frame, node.args[i+1]))
end
args = [@lookup(mod, frame, arg) for arg in node.args]
T = popfirst!(args)
rhs = ccall(:jl_new_structv, Any, (Any, Ptr{Any}, UInt32), T, args, length(args))
return rhs
elseif head == :splatnew # Julia 1.2+
mod = moduleof(frame)
Expand Down

0 comments on commit 8ea0ad7

Please sign in to comment.