@@ -689,6 +689,26 @@ func (c *closeContext) decDependent(ctx *OpContext, kind depKind, dependant *clo
689
689
cc .decDependent (ctx , NOTIFY , c )
690
690
}
691
691
692
+ if ! c .updateClosedInfo (ctx ) {
693
+ return
694
+ }
695
+
696
+ p := c .parent
697
+
698
+ p .decDependent (ctx , PARENT , c ) // REF(decrement: spawn)
699
+
700
+ // If we have started decrementing a child closeContext, the parent started
701
+ // as well. If it is still marked as needing an EVAL decrement, which can
702
+ // happen if processing started before the node was added, it is safe to
703
+ // decrement it now. In this case the NOTIFY and ARC dependencies will keep
704
+ // the nodes alive until they can be completed.
705
+ if dep := p .needsCloseInSchedule ; dep != nil {
706
+ p .needsCloseInSchedule = nil
707
+ p .decDependent (ctx , EVAL , dep )
708
+ }
709
+ }
710
+
711
+ func (c * closeContext ) updateClosedInfo (ctx * OpContext ) bool {
692
712
p := c .parent
693
713
694
714
if c .isDef && ! c .isTotal && (! c .hasTop || c .hasNonTop ) {
@@ -708,6 +728,7 @@ func (c *closeContext) decDependent(ctx *OpContext, kind depKind, dependant *clo
708
728
c .finalizePattern ()
709
729
710
730
if p == nil {
731
+ v := c .src
711
732
// Root pattern, set allowed patterns.
712
733
if pcs := v .PatternConstraints ; pcs != nil {
713
734
if pcs .Allowed != nil {
@@ -716,9 +737,9 @@ func (c *closeContext) decDependent(ctx *OpContext, kind depKind, dependant *clo
716
737
// panic("unexpected allowed set")
717
738
}
718
739
pcs .Allowed = c .Expr
719
- return
740
+ return false
720
741
}
721
- return
742
+ return false
722
743
}
723
744
724
745
if c .hasTop {
@@ -745,17 +766,7 @@ func (c *closeContext) decDependent(ctx *OpContext, kind depKind, dependant *clo
745
766
p .linkPatterns (c )
746
767
}
747
768
748
- p .decDependent (ctx , PARENT , c ) // REF(decrement: spawn)
749
-
750
- // If we have started decrementing a child closeContext, the parent started
751
- // as well. If it is still marked as needing an EVAL decrement, which can
752
- // happen if processing started before the node was added, it is safe to
753
- // decrement it now. In this case the NOTIFY and ARC dependencies will keep
754
- // the nodes alive until they can be completed.
755
- if dep := p .needsCloseInSchedule ; dep != nil {
756
- p .needsCloseInSchedule = nil
757
- p .decDependent (ctx , EVAL , dep )
758
- }
769
+ return true
759
770
}
760
771
761
772
// incDisjunct increases disjunction-related counters. We require kind to be
0 commit comments