Skip to content

Commit 43a313a

Browse files
committed
internal/core/adt: rename cc to dst
This makes it clearer what the destination closeContext is, versus to source, for dependencies. Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I2ce1968e5083f8eccce9c7862e36f8728c279998 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1207450 Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Daniel Martí <[email protected]>
1 parent 06f5289 commit 43a313a

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

internal/core/adt/dep.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func (c *closeContext) addArcDependency(ctx *OpContext, matched bool, key, child
150150
c.arcs = append(c.arcs, ccArc{
151151
matched: matched,
152152
key: key,
153-
cc: child,
153+
dst: child,
154154
})
155155

156156
// TODO: this tests seems sensible, but panics. Investigate what could
@@ -192,7 +192,7 @@ func (c *closeContext) addNotificationDependency(ctx *OpContext, matched bool, k
192192
c.notify = append(c.notify, ccArc{
193193
matched: matched,
194194
key: key,
195-
cc: child,
195+
dst: child,
196196
})
197197

198198
// TODO: this tests seems sensible, but panics. Investigate what could
@@ -287,7 +287,7 @@ func (c *closeContext) decDependent(ctx *OpContext, kind depKind, dependant *clo
287287
c.done = true
288288

289289
for i, a := range c.arcs {
290-
cc := a.cc
290+
cc := a.dst
291291
if a.decremented {
292292
continue
293293
}
@@ -296,7 +296,7 @@ func (c *closeContext) decDependent(ctx *OpContext, kind depKind, dependant *clo
296296
}
297297

298298
for i, a := range c.notify {
299-
cc := a.cc
299+
cc := a.dst
300300
if a.decremented {
301301
continue
302302
}

internal/core/adt/disjunct2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ outer:
741741
if a.key.src.Label != b.key.src.Label {
742742
continue
743743
}
744-
if !equalPartialNode(ctx, a.cc, b.cc) {
744+
if !equalPartialNode(ctx, a.dst, b.dst) {
745745
return false
746746
}
747747
continue outer

internal/core/adt/fields.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,9 @@ type ccArc struct {
332332
// key is the closeContext is used to find the destination of the arc, which
333333
// is the root context.
334334
key *closeContext
335-
// cc is the closeContext for which the counters are incremented and
335+
// dst is the closeContext for which the counters are incremented and
336336
// decremented and which is the actual destination of the dependency.
337-
cc *closeContext
337+
dst *closeContext
338338
}
339339

340340
// A ccArcRef x refers to the x.src.arcs[x.index].
@@ -416,8 +416,8 @@ func (cc *closeContext) getKeyedCC(ctx *OpContext, key *closeContext, c CycleInf
416416
a := &cc.arcs[i]
417417
if a.key == key {
418418
a.matched = a.matched && !checkClosed
419-
a.cc.updateArcType(ctx, mode)
420-
return a.cc
419+
a.dst.updateArcType(ctx, mode)
420+
return a.dst
421421
}
422422
}
423423

@@ -892,7 +892,7 @@ func isTotal(p Value) bool {
892892
// this is not the case.
893893
func injectClosed(ctx *OpContext, closed, dst *closeContext) {
894894
for _, a := range dst.arcs {
895-
ca := a.cc
895+
ca := a.dst
896896
switch f := ca.Label(); {
897897
case ca.src.ArcType == ArcOptional,
898898
// Without this continue, an evaluation error may be propagated to
@@ -924,7 +924,7 @@ func (c *closeContext) allows(ctx *OpContext, f Feature) bool {
924924
ctx.Assertf(token.NoPos, c.conjunctCount == 0, "unexpected 0 conjunctCount")
925925

926926
for _, b := range c.arcs {
927-
cb := b.cc
927+
cb := b.dst
928928
if b.matched || f != cb.Label() {
929929
continue
930930
}

internal/core/adt/overlay.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ func (ctx *overlayContext) allocCC(cc *closeContext) *closeContext {
318318
// We only explicitly tag dependencies of type ARC. Notifications that
319319
// point within the disjunct overlay will be tagged elsewhere.
320320
for _, a := range cc.arcs {
321-
ctx.allocCC(a.cc)
321+
ctx.allocCC(a.dst)
322322
}
323323

324324
return o
@@ -438,26 +438,26 @@ func (ctx *overlayContext) initCloneCC(x *closeContext) {
438438
for _, a := range x.arcs {
439439
// If an arc does not have an overlay, we should not decrement the
440440
// dependency counter. We simply remove the dependency in that case.
441-
if a.cc.overlay == nil {
441+
if a.dst.overlay == nil {
442442
continue
443443
}
444444
if a.key.overlay != nil {
445445
a.key = a.key.overlay // TODO: is this necessary?
446446
}
447-
a.cc = a.cc.overlay
447+
a.dst = a.dst.overlay
448448
o.arcs = append(o.arcs, a)
449449
}
450450

451451
for _, a := range x.notify {
452452
// If an arc does not have an overlay, we should not decrement the
453453
// dependency counter. We simply remove the dependency in that case.
454-
if a.cc.overlay == nil {
454+
if a.dst.overlay == nil {
455455
continue
456456
}
457457
if a.key.overlay != nil {
458458
a.key = a.key.overlay // TODO: is this necessary?
459459
}
460-
a.cc = a.cc.overlay
460+
a.dst = a.dst.overlay
461461
o.notify = append(o.notify, a)
462462
}
463463

internal/core/adt/unify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ func (n *nodeContext) completeAllArcs(needs condition, mode runMode) bool {
572572
a.decremented = true
573573

574574
src.src.unify(n.ctx, needTasksDone, attemptOnly)
575-
a.cc.decDependent(n.ctx, r.kind, src)
575+
a.dst.decDependent(n.ctx, r.kind, src)
576576
}
577577

578578
n.incDepth()

0 commit comments

Comments
 (0)