Skip to content

Commit fb88beb

Browse files
committed
internal/core/adt: changes needed for new evaluator
These changes prepare for changes in the new evaluator implementation. Submitting these in a separate CL will allow us to bisect to this CL in case these cause errors in the old evaluator. The new evaluator may set the value when the cycle placeholder has not removed yet. Treat this case. The new evaluator cannot use getNodeContext. In these use cases, the nodeContext is always available. So by avoiding calling getNodeContext, we can use this code for both the old and new evaluator. Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I0acd9ff5a0b2225b54ffcf0db362f74e417d323f Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1167921 TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Daniel Martí <[email protected]>
1 parent 9dd0f82 commit fb88beb

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

internal/core/adt/composite.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ func (v *Vertex) Source() ast.Node {
928928

929929
// AddConjunct adds the given Conjuncts to v if it doesn't already exist.
930930
func (v *Vertex) AddConjunct(c Conjunct) *Bottom {
931-
if v.BaseValue != nil {
931+
if v.BaseValue != nil && !isCyclePlaceholder(v.BaseValue) {
932932
// TODO: investigate why this happens at all. Removing it seems to
933933
// change the order of fields in some cases.
934934
//

internal/core/adt/eval.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,7 @@ func (n *nodeContext) incompleteErrors(final bool) *Bottom {
671671
// n := d.node.getNodeContext(ctx)
672672
// n.addBottom(err)
673673
if final && c.vertex != nil && c.vertex.status != finalized {
674-
n := c.vertex.getNodeContext(n.ctx, 0)
675-
n.addBottom(err)
674+
c.vertex.state.addBottom(err)
676675
c.vertex = nil
677676
}
678677
}
@@ -700,8 +699,7 @@ func (n *nodeContext) incompleteErrors(final bool) *Bottom {
700699
// n := d.node.getNodeContext(ctx)
701700
// n.addBottom(err)
702701
if c.vertex != nil && c.vertex.status != finalized {
703-
n := c.vertex.getNodeContext(n.ctx, 0)
704-
n.addBottom(err)
702+
c.vertex.state.addBottom(err)
705703
c.vertex = nil
706704
}
707705
}

0 commit comments

Comments
 (0)