577
577
function get_rxexpr (rx:: DSLReaction )
578
578
# Initiates the `Reaction` expression.
579
579
rate = recursive_escape_functions! (rx. rate)
580
- rx_constructor = :(Reaction ($ rate, nothing , nothing ; metadata = $ (rx. metadata)))
580
+ subs_init = isempty (rx. substrates) ? nothing : :([])
581
+ subs_stoich_init = deepcopy (subs_init)
582
+ prod_init = isempty (rx. products) ? nothing : :([])
583
+ prod_stoich_init = deepcopy (prod_init)
584
+ rx_constructor = :(Reaction ($ rate, $ subs_init, $ subs_stoich_init, $ prod_init,
585
+ $ prod_stoich_init; metadata = $ (rx. metadata)))
581
586
582
587
# Loops through all products and substrates, and adds them (and their stoichiometries)
583
588
# to the `Reaction` expression.
@@ -589,7 +594,6 @@ function get_rxexpr(rx::DSLReaction)
589
594
push! (rx_constructor. args[5 ]. args, prod. reactant)
590
595
push! (rx_constructor. args[7 ]. args, prod. stoichiometry)
591
596
end
592
-
593
597
return rx_constructor
594
598
end
595
599
@@ -731,7 +735,7 @@ function read_equations_options!(diffsexpr, options, syms_unavailable, tiv; requ
731
735
push! (diffsexpr. args, :(D = Differential ($ (tiv))))
732
736
end
733
737
734
- return vs_inferred, diffs_inferred, equations
738
+ return collect ( vs_inferred) , diffs_inferred, equations
735
739
end
736
740
737
741
# Searches an expression `expr` and returns true if it have any subexpression `D(...)` (where `...` can be anything).
0 commit comments