We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 823efce commit bc3906fCopy full SHA for bc3906f
2 files changed
Project.toml
@@ -3,6 +3,9 @@ uuid = "b9860ae5-e623-471e-878b-f6a53c775ea6"
3
authors = ["Takafumi Arakaki <aka.tkf@gmail.com> and contributors"]
4
version = "0.1.0"
5
6
+[deps]
7
+ContextVariablesX = "6add18c4-b38d-439d-96f6-d6bc489c04c5"
8
+
9
[compat]
10
julia = "1"
11
src/FLoopsBase.jl
@@ -1,5 +1,12 @@
1
module FLoopsBase
2
-# Write your package code here.
+using ContextVariablesX
+@contextvar EXTRA_STATE_VARIABLES::Union{Vector{Union{Symbol,Expr}},Nothing} = nothing
+function with_extra_state_variables(f, variables)
+ current_vars = copy(something(EXTRA_STATE_VARIABLES[], Union{Symbol,Expr}[]))
+ new_vars = append!(current_vars, variables)
+ with_context(f, EXTRA_STATE_VARIABLES => new_vars)
+end
12
end
0 commit comments