Skip to content

Commit 6ce5e10

Browse files
committed
cleaned up substitute_broadcast
1 parent 4befd36 commit 6ce5e10

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/constructors.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,14 @@ function substitute_broadcast(
6666
_ciₙ = ci[n]
6767
syms[n] = Symbol('%', n)
6868

69-
local rhs
7069
if _ciₙ isa Core.SSAValue
71-
rhs = syms[_ciₙ.id]
70+
push!(lb.args, Expr(:(=), syms[n], syms[_ciₙ.id]))
7271

7372
elseif _ciₙ isa GlobalRef
7473
if _ciₙ.mod === Base || _ciₙ.mod === Core
75-
rhs = lv(_ciₙ.name)
74+
push!(lb.args, Expr(:(=), syms[n], lv(_ciₙ.name)))
7675
else
77-
rhs = _ciₙ.name
76+
push!(lb.args, Expr(:(=), syms[n], _ciₙ.name))
7877
end
7978

8079
elseif _ciₙ isa Expr && _ciₙ.head === :call
@@ -86,16 +85,17 @@ function substitute_broadcast(
8685
else
8786
add_ci_call!(lb, f, _ciₙ.args, syms, n)
8887
end
89-
continue
88+
9089
else
91-
rhs = _ciₙ
90+
push!(lb.args, Expr(:(=), syms[n], _ciₙ))
9291
end
93-
push!(lb.args, Expr(:(=), syms[n], rhs))
9492
end
93+
9594
ret::Expr = pop!(lb.args)::Expr
9695
if Meta.isexpr(ret, :(=), 2)
9796
ret = (ret.args[2])::Expr
9897
end
98+
9999
esc(Expr(:let, lb, Expr(:block, ret)))
100100
end
101101

0 commit comments

Comments
 (0)