Skip to content

Commit 99673b4

Browse files
committed
Don't actually generate let
1 parent 9ac6878 commit 99673b4

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/structural_transformation/codegen.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ function gen_nlsolve!(is_not_prepended_assignment, eqs, vars, u0map::AbstractDic
187187
[],
188188
Let(
189189
needed_assignments[inner_idxs],
190-
isscalar ? rhss[1] : MakeArray(rhss, SVector)
190+
isscalar ? rhss[1] : MakeArray(rhss, SVector),
191+
false
191192
)
192193
) |> SymbolicUtils.Code.toexpr
193194

@@ -307,7 +308,8 @@ function build_torn_function(
307308
[],
308309
pre(Let(
309310
[torn_expr; assignments[is_not_prepended_assignment]],
310-
funbody
311+
funbody,
312+
false
311313
))
312314
),
313315
sol_states
@@ -443,7 +445,8 @@ function build_observed_function(
443445
subs
444446
assignments[is_not_prepended_assignment]
445447
],
446-
isscalar ? ts[1] : MakeArray(ts, output_type)
448+
isscalar ? ts[1] : MakeArray(ts, output_type),
449+
false
447450
))
448451
), sol_states)
449452

src/systems/diffeqs/odesystem.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ function build_explicit_observed_function(
289289
args, [],
290290
pre(Let(
291291
obsexprs,
292-
isscalar ? ts[1] : MakeArray(ts, output_type)
292+
isscalar ? ts[1] : MakeArray(ts, output_type),
293+
false # don't actually use let
293294
))
294295
) |> toexpr
295296
expression ? ex : @RuntimeGeneratedFunction(ex)

src/utils.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ end
399399
function get_postprocess_fbody(sys)
400400
if has_preface(sys) && (pre = preface(sys); pre !== nothing)
401401
pre_ = let pre=pre
402-
ex -> Let(pre, ex)
402+
ex -> Let(pre, ex, false)
403403
end
404404
else
405405
pre_ = ex -> ex
@@ -441,10 +441,10 @@ function get_substitutions_and_solved_states(sys; no_postprocess=false)
441441
@unpack subs = get_substitutions(sys)
442442
sol_states = Code.NameState(Dict(eq.lhs => Symbol(eq.lhs) for eq in subs))
443443
if no_postprocess
444-
pre = ex -> Let(Assignment[Assignment(eq.lhs, eq.rhs) for eq in subs], ex)
444+
pre = ex -> Let(Assignment[Assignment(eq.lhs, eq.rhs) for eq in subs], ex, false)
445445
else
446446
process = get_postprocess_fbody(sys)
447-
pre = ex -> Let(Assignment[Assignment(eq.lhs, eq.rhs) for eq in subs], process(ex))
447+
pre = ex -> Let(Assignment[Assignment(eq.lhs, eq.rhs) for eq in subs], process(ex), false)
448448
end
449449
end
450450
return pre, sol_states

0 commit comments

Comments
 (0)