Skip to content

Commit 2206425

Browse files
committed
Remove ComponentArrays dep, cleanup handling of skip_checks
1 parent c940e5e commit 2206425

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

Project.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
99
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
1010
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
1111
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
12-
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
1312
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
1413
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
1514
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"

src/systems/callbacks.jl

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,26 +1024,27 @@ function compile_user_affect(affect::MutatingFunctionalAffect, cb, sys, dvs, ps;
10241024
end
10251025

10261026
obs_exprs = observed(affect)
1027-
for oexpr in obs_exprs
1028-
invalid_vars = invalid_variables(sys, oexpr)
1029-
if length(invalid_vars) > 0 && !affect.skip_checks
1030-
error("Observed equation $(oexpr) in affect refers to missing variable(s) $(invalid_vars); the variables may not have been added (e.g. if a component is missing).")
1027+
if !affect.skip_checks
1028+
for oexpr in obs_exprs
1029+
invalid_vars = invalid_variables(sys, oexpr)
1030+
if length(invalid_vars) > 0
1031+
error("Observed equation $(oexpr) in affect refers to missing variable(s) $(invalid_vars); the variables may not have been added (e.g. if a component is missing).")
1032+
end
10311033
end
10321034
end
10331035
obs_syms = observed_syms(affect)
10341036
obs_syms, obs_exprs = check_dups(obs_syms, obs_exprs)
10351037

10361038
mod_exprs = modified(affect)
1037-
for mexpr in mod_exprs
1038-
if affect.skip_checks
1039-
continue
1040-
end
1041-
if !is_variable(sys, mexpr) && parameter_index(sys, mexpr) === nothing && !affect.skip_checks
1042-
@warn ("Expression $mexpr cannot be assigned to; currently only unknowns and parameters may be updated by an affect.")
1043-
end
1044-
invalid_vars = unassignable_variables(sys, mexpr)
1045-
if length(invalid_vars) > 0 && !affect.skip_checks
1046-
error("Modified equation $(mexpr) in affect refers to missing variable(s) $(invalid_vars); the variables may not have been added (e.g. if a component is missing) or they may have been reduced away.")
1039+
if !affect.skip_checks
1040+
for mexpr in mod_exprs
1041+
if !is_variable(sys, mexpr) && parameter_index(sys, mexpr) === nothing
1042+
@warn ("Expression $mexpr cannot be assigned to; currently only unknowns and parameters may be updated by an affect.")
1043+
end
1044+
invalid_vars = unassignable_variables(sys, mexpr)
1045+
if length(invalid_vars) > 0
1046+
error("Modified equation $(mexpr) in affect refers to missing variable(s) $(invalid_vars); the variables may not have been added (e.g. if a component is missing) or they may have been reduced away.")
1047+
end
10471048
end
10481049
end
10491050
mod_syms = modified_syms(affect)

0 commit comments

Comments
 (0)