Skip to content

Commit

Permalink
Use recursive_add for getindex (#1218)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Dec 19, 2023
1 parent bd42b76 commit 8fb0f10
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/rules/typeunstablerules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,11 @@ function rt_jl_getfield_rev(dptr::T, dret, ::Type{Val{symname}}, ::Val{isconst},
RT = Core.Typeof(cur)
if active_reg(RT) && !isconst
if length(dptrs) == 0
setfield!(dptr, symname, cur+dret[])
setfield!(dptr, symname, recursive_add(cur, dret[]))
else
setfield!(dptr, symname, cur+dret[1][])
setfield!(dptr, symname, recursive_add(cur, dret[1][]))
for i in 1:length(dptrs)
setfield!(dptrs[i], symname, cur+dret[1+i][])
setfield!(dptrs[i], symname, recursive_add(cur, dret[1+i][]))
end
end
end
Expand All @@ -270,11 +270,11 @@ function idx_jl_getfield_rev(dptr::T, dret, ::Type{Val{symname}}, ::Val{isconst}
RT = Core.Typeof(cur)
if active_reg(RT) && !isconst
if length(dptrs) == 0
setfield_idx(dptr, symname, cur+dret[])
setfield_idx(dptr, symname, recursive_add(cur, dret[]))
else
setfield_idx(dptr, symname, cur+dret[1][])
setfield_idx(dptr, symname, recursive_add(cur, dret[1][]))
for i in 1:length(dptrs)
setfield_idx(dptrs[i], symname, cur+dret[1+i][])
setfield_idx(dptrs[i], symname, recursive_add(cur, dret[1+i][]))
end
end
end
Expand Down

0 comments on commit 8fb0f10

Please sign in to comment.