Skip to content

Commit de83f70

Browse files
fix: handle extra constants in build_function_wrapper
1 parent 0bc240d commit de83f70

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/systems/codegen_utils.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@ function build_function_wrapper(sys::AbstractSystem, expr, args...; p_start = 2,
5252
pdeps = parameter_dependencies(sys)
5353

5454
cmap, _ = get_cmap(sys)
55-
obsidxs = observed_equations_used_by(sys, expr)
55+
extra_constants = collect_constants(expr)
56+
filter!(extra_constants) do c
57+
!any(x -> isequal(c, x.lhs), cmap)
58+
end
59+
for c in extra_constants
60+
push!(cmap, c ~ getdefault(c))
61+
end
5662
pdepidxs = observed_equations_used_by(sys, expr; obs = pdeps)
5763

5864
assignments = array_variable_assignments(args...)

0 commit comments

Comments
 (0)