Skip to content

Commit e499dae

Browse files
committed
internal/core/adt: pass Conjunct to addVertexConjuncts
Change-Id: I1e2e691eb815a8c7586f2056124b6b554832d9f0 Signed-off-by: Marcel van Lohuizen <mpvl@golang.org> Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/532949 Unity-Result: CUEcueckoo <cueckoo@cuelang.org> Reviewed-by: Paul Jolly <paul@myitcv.io>
1 parent 975f57c commit e499dae

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

internal/core/adt/eval.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ func (n *nodeContext) addExprConjunct(v Conjunct) {
12241224
if x.IsData() {
12251225
n.addValueConjunct(env, x, id)
12261226
} else {
1227-
n.addVertexConjuncts(env, id, x, x, true)
1227+
n.addVertexConjuncts(v, x, true)
12281228
}
12291229

12301230
case Value:
@@ -1297,7 +1297,7 @@ func (n *nodeContext) evalExpr(v Conjunct) {
12971297
break
12981298
}
12991299

1300-
n.addVertexConjuncts(v.Env, v.CloseInfo, v.Expr(), arc, false)
1300+
n.addVertexConjuncts(v, arc, false)
13011301

13021302
case Evaluator:
13031303
// Interpolation, UnaryExpr, BinaryExpr, CallExpr
@@ -1340,7 +1340,8 @@ func (n *nodeContext) evalExpr(v Conjunct) {
13401340
}
13411341
}
13421342

1343-
func (n *nodeContext) addVertexConjuncts(env *Environment, closeInfo CloseInfo, x Expr, arc *Vertex, inline bool) {
1343+
func (n *nodeContext) addVertexConjuncts(c Conjunct, arc *Vertex, inline bool) {
1344+
closeInfo := c.CloseInfo
13441345

13451346
// We need to ensure that each arc is only unified once (or at least) a
13461347
// bounded time, witch each conjunct. Comprehensions, for instance, may
@@ -1368,6 +1369,7 @@ func (n *nodeContext) addVertexConjuncts(env *Environment, closeInfo CloseInfo,
13681369
}
13691370
n.arcMap = append(n.arcMap, key)
13701371

1372+
env := c.Env
13711373
// Pass detection of structural cycles from parent to children.
13721374
cyclic := false
13731375
if env != nil {
@@ -1427,6 +1429,7 @@ func (n *nodeContext) addVertexConjuncts(env *Environment, closeInfo CloseInfo,
14271429
// resulting form APIs. These tend to be fairly uninteresting.
14281430
// At the same time, this optimization may prevent considerable slowdown
14291431
// in case an API does many calls to Unify.
1432+
x := c.Expr()
14301433
if !inline || arc.IsClosedStruct() || arc.IsClosedList() {
14311434
closeInfo = closeInfo.SpawnRef(arc, IsDef(x), x)
14321435
}
@@ -1542,7 +1545,7 @@ func (n *nodeContext) addValueConjunct(env *Environment, v Value, id CloseInfo)
15421545
// TODO: this really shouldn't happen anymore.
15431546
if isComplexStruct(ctx, x) {
15441547
// This really shouldn't happen, but just in case.
1545-
n.addVertexConjuncts(env, id, x, x, true)
1548+
n.addVertexConjuncts(MakeConjunct(env, x, id), x, true)
15461549
return
15471550
}
15481551

0 commit comments

Comments
 (0)