Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[compat]
Catalyst = "15"
DiffEqBase = "6"
DiffEqBase = "6, 7"
MacroTools = "^0.5.5"
OrdinaryDiffEq = "6, 7"
Reexport = "1"
RuntimeGeneratedFunctions = "0.5"
SteadyStateDiffEq = "1, 2"
Sundials = "4, 5, 6"
julia = "1.10"

[extras]
Expand Down
19 changes: 19 additions & 0 deletions src/FiniteStateProjection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,25 @@ RuntimeGeneratedFunctions.init(@__MODULE__)

export FSPSystem, DefaultIndexHandler, SteadyState

# Julia 1.12 removed the `mt` field on `Base.MethodList`, breaking
# `MacroTools.prettify`'s `unresolve` step (FluxML/MacroTools.jl#216).
# Replicate `MacroTools.prettify` locally with a 1.12-safe `unresolve`
# so generated CME RHS expressions can still be tidied for display.
_unresolve1(x) = x
@static if VERSION >= v"1.12-"
_unresolve1(f::Function) = nameof(f)
else
_unresolve1(f::Function) = methods(f).mt.name
end
_unresolve(ex) = MacroTools.prewalk(_unresolve1, ex)
function _prettify(ex; lines = false, alias = true)
ex = lines ? ex : MacroTools.striplines(ex)
ex = MacroTools.flatten(ex)
ex = _unresolve(ex)
ex = MacroTools.resyntax(ex)
return alias ? MacroTools.alias_gensyms(ex) : ex
end

abstract type AbstractIndexHandler end

include("fspsystem.jl")
Expand Down
2 changes: 1 addition & 1 deletion src/build_rhs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function build_rhs_ex(sys::FSPSystem; striplines::Bool = false)

striplines && (ex = MacroTools.striplines(ex))

ex = ex |> MacroTools.flatten |> MacroTools.prettify
ex = ex |> MacroTools.flatten |> _prettify

return ex
end
Expand Down
2 changes: 1 addition & 1 deletion src/build_rhs_ss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function build_rhs_ex_ss(sys::FSPSystem; striplines::Bool = false)

striplines && (ex = MacroTools.striplines(ex))

ex = ex |> MacroTools.flatten |> MacroTools.prettify
ex = ex |> MacroTools.flatten |> _prettify

return ex
end
Expand Down
Loading