@@ -1224,7 +1224,7 @@ func (n *nodeContext) addExprConjunct(v Conjunct) {
1224
1224
if x .IsData () {
1225
1225
n .addValueConjunct (env , x , id )
1226
1226
} else {
1227
- n .addVertexConjuncts (env , id , x , x , true )
1227
+ n .addVertexConjuncts (v , x , true )
1228
1228
}
1229
1229
1230
1230
case Value :
@@ -1297,7 +1297,7 @@ func (n *nodeContext) evalExpr(v Conjunct) {
1297
1297
break
1298
1298
}
1299
1299
1300
- n .addVertexConjuncts (v . Env , v . CloseInfo , v . Expr () , arc , false )
1300
+ n .addVertexConjuncts (v , arc , false )
1301
1301
1302
1302
case Evaluator :
1303
1303
// Interpolation, UnaryExpr, BinaryExpr, CallExpr
@@ -1340,7 +1340,8 @@ func (n *nodeContext) evalExpr(v Conjunct) {
1340
1340
}
1341
1341
}
1342
1342
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
1344
1345
1345
1346
// We need to ensure that each arc is only unified once (or at least) a
1346
1347
// bounded time, witch each conjunct. Comprehensions, for instance, may
@@ -1368,6 +1369,7 @@ func (n *nodeContext) addVertexConjuncts(env *Environment, closeInfo CloseInfo,
1368
1369
}
1369
1370
n .arcMap = append (n .arcMap , key )
1370
1371
1372
+ env := c .Env
1371
1373
// Pass detection of structural cycles from parent to children.
1372
1374
cyclic := false
1373
1375
if env != nil {
@@ -1427,6 +1429,7 @@ func (n *nodeContext) addVertexConjuncts(env *Environment, closeInfo CloseInfo,
1427
1429
// resulting form APIs. These tend to be fairly uninteresting.
1428
1430
// At the same time, this optimization may prevent considerable slowdown
1429
1431
// in case an API does many calls to Unify.
1432
+ x := c .Expr ()
1430
1433
if ! inline || arc .IsClosedStruct () || arc .IsClosedList () {
1431
1434
closeInfo = closeInfo .SpawnRef (arc , IsDef (x ), x )
1432
1435
}
@@ -1542,7 +1545,7 @@ func (n *nodeContext) addValueConjunct(env *Environment, v Value, id CloseInfo)
1542
1545
// TODO: this really shouldn't happen anymore.
1543
1546
if isComplexStruct (ctx , x ) {
1544
1547
// 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 )
1546
1549
return
1547
1550
}
1548
1551
0 commit comments