Skip to content

Commit 7c4b66d

Browse files
committed
internal/core/adt: clean up "withinLet"
Now we have a different mechanism for forcing evaluation of a field, we no longer need to special-case let values introduced in https://cuelang.org/cl/1211827 We remove this mechanism. Issue #3763 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I76d020dda5a6e80d8191f96fdad270829d534d6a Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1211977 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Matthew Sackman <[email protected]>
1 parent 1eccc46 commit 7c4b66d

File tree

4 files changed

+2
-8
lines changed

4 files changed

+2
-8
lines changed

internal/core/adt/composite.go

-4
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,6 @@ type Vertex struct {
226226
// the for source of comprehensions and let fields or let clauses.
227227
anonymous bool
228228

229-
// withinLet indicate that this vertex is a let value.
230-
withinLet bool
231-
232229
// hasPendingArc is set if this Vertex has a void arc (e.g. for comprehensions)
233230
hasPendingArc bool
234231

@@ -1359,7 +1356,6 @@ func (v *Vertex) GetArc(c *OpContext, f Feature, t ArcType) (arc *Vertex, isNew
13591356
ArcType: t,
13601357
nonRooted: v.IsDynamic || v.Label.IsLet() || v.nonRooted,
13611358
anonymous: v.anonymous || v.Label.IsLet(),
1362-
withinLet: v.withinLet || v.Label.IsLet(),
13631359
}
13641360
v.Arcs = append(v.Arcs, arc)
13651361
if t == ArcPending {

internal/core/adt/cycle.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ func (n *nodeContext) detectCycleV3(arc *Vertex, env *Environment, x Resolver, c
700700

701701
return n.markCyclicPathV3(arc, env, x, ci)
702702
}
703-
if equalDeref(r.Node, n.node) && r.Ref == x && (arc.nonRooted || arc.withinLet) {
703+
if equalDeref(r.Node, n.node) && r.Ref == x && arc.nonRooted {
704704
return n.markCyclicPathV3(arc, env, x, ci)
705705
}
706706
}

internal/core/adt/fields.go

-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ func (n *nodeContext) getArc(f Feature, mode ArcType) (arc *Vertex, isNew bool)
169169
ArcType: mode,
170170
nonRooted: v.IsDynamic || v.nonRooted,
171171
anonymous: v.anonymous || v.Label.IsLet(),
172-
withinLet: v.withinLet || v.Label.IsLet(),
173172
}
174173
if n.scheduler.frozen&fieldSetKnown != 0 {
175174
b := n.ctx.NewErrf("adding field %v not allowed as field set was already referenced", f)

internal/core/adt/unify.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -868,8 +868,7 @@ func (v *Vertex) lookup(c *OpContext, pos token.Pos, f Feature, flags combinedFl
868868
// not trigger the usual unblocking. Force unblocking may cause
869869
// some values to be remain unevaluated.
870870
switch {
871-
case arc.withinLet,
872-
needs == arcTypeKnown|fieldSetKnown:
871+
case needs == arcTypeKnown|fieldSetKnown:
873872
arc.unify(c, needs, finalize, false)
874873
default:
875874
// Now we can't finalize, at least try to get as far as we

0 commit comments

Comments
 (0)