this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

internal/core/adt: change slice type of notify

This is to accomodate the new closedness algorithm.
Doing this now makes upcoming diffs smaller.

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: I786318a39635dfeb7dd1dd1fc854521e474ffe03
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1167912
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+15 -7
+2 -1
internal/core/adt/composite.go
··· 999 999 } 1000 1000 1001 1001 func (n *nodeContext) notifyConjunct(c Conjunct) { 1002 - for _, arc := range n.notify { 1002 + for _, rec := range n.notify { 1003 + arc := rec.v 1003 1004 if !arc.hasConjunct(c) { 1004 1005 if arc.state == nil { 1005 1006 // TODO: continuing here is likely to result in a faulty
+13 -6
internal/core/adt/eval.go
··· 138 138 // relax this again once we have proper tests to prevent regressions of 139 139 // that issue. 140 140 if !v.state.done() || v.state.errs != nil { 141 - v.state.addNotify(c.vertex) 141 + v.state.addNotify(c.vertex, nil) 142 142 } 143 143 } 144 144 ··· 444 444 if n.errs == nil || len(n.notify) == 0 { 445 445 return 446 446 } 447 - for _, v := range n.notify { 447 + for _, rec := range n.notify { 448 + v := rec.v 448 449 if v.state == nil { 449 450 if b, ok := v.BaseValue.(*Bottom); ok { 450 451 v.BaseValue = CombineErrors(nil, b, n.errs) ··· 974 975 975 976 // notify is used to communicate errors in cyclic dependencies. 976 977 // TODO: also use this to communicate increasingly more concrete values. 977 - notify []*Vertex 978 + notify []receiver 978 979 979 980 // Conjuncts holds a reference to the Vertex Arcs that still need 980 981 // processing. It does NOT need to be copied. ··· 1062 1063 conjunctsPartialPos int 1063 1064 } 1064 1065 1066 + // A receiver receives notifications. 1067 + type receiver struct { 1068 + v *Vertex 1069 + cc *closeContext 1070 + } 1071 + 1065 1072 // Logf substitutes args in format. Arguments of type Feature, Value, and Expr 1066 1073 // are printed in human-friendly formats. The printed string is prefixed and 1067 1074 // indented with the path associated with the current nodeContext. ··· 1080 1087 origMode defaultMode 1081 1088 } 1082 1089 1083 - func (n *nodeContext) addNotify(v *Vertex) { 1090 + func (n *nodeContext) addNotify(v *Vertex, cc *closeContext) { 1084 1091 if v != nil && !n.node.hasAllConjuncts { 1085 - n.notify = append(n.notify, v) 1092 + n.notify = append(n.notify, receiver{v, cc}) 1086 1093 } 1087 1094 } 1088 1095 ··· 1693 1700 } 1694 1701 1695 1702 if arc.state != nil { 1696 - arc.state.addNotify(n.node) 1703 + arc.state.addNotify(n.node, nil) 1697 1704 } 1698 1705 1699 1706 for _, c := range arc.Conjuncts {