1234567891011121314151617181920212223242526272829303132333435363738394041424344454647openCoreopen!ImportmoduleNode=Types.Nodetype'at='aTypes.Var.t={mutablevalue:'a;(* [value_set_during_stabilization] is only set to [Uopt.some] if the user calls
[Var.set] during stabilization, in which case it holds the (last) value set. At
the end of stabilization, all such variables are processed to do [t.value <-
t.value_set_during_stabilization]. *)mutablevalue_set_during_stabilization:'aUopt.t;(* [set_at] the stabilization number in effect the most recent time [t.value] changed.
This is not necessarily the same as the stabilization number in effect the most
recent time [Var.set t] was called, due to the effect of [Var.set] during
stabilization being delayed until after the stabilization. *)mutableset_at:Stabilization_num.t;watch:'aNode.t}[@@derivingfields~iterators:iter,sexp_of]letinvariantinvariant_at=Invariant.invariant[%here]t[%sexp_of:_t](fun()->letcheckf=Invariant.check_fieldtfinFields.iter~value:(checkinvariant_a)~value_set_during_stabilization:(check(Uopt.invariantinvariant_a))~set_at:(checkStabilization_num.invariant)~watch:(check(fun(watch:_Node.t)->matchwatch.kindwith|Invalid->()(* possible with [~use_current_scope:true] *)|Vart'->assert(phys_equaltt')|_->assertfalse)));;letincr_statet=t.watch.statemodulePacked=structtype'avar='at[@@derivingsexp_of]typet=Types.Var.Packed.t=T:_var->t[@@unboxed][@@derivingsexp_of]endletlatest_valuet=ifUopt.is_somet.value_set_during_stabilizationthenUopt.unsafe_valuet.value_set_during_stabilizationelset.value;;