internal/core/adt: refactor node lookup
This change distinguish path for evaluating values (evalState)
versus evaluating nodes (new: unifyNode).
Goals:
1) allow evaluation state to pass to calls. This allwos for more
precise partial evaluation.
2) more control over when to use addNotify.
For instance: for for loops, it is necessary to evaluate to
the AllArcs state, as all arcs need to be known at the
time of iteration.
For looking up values in a struct, however, it is okay to
have partial evaluation of struct arcs when looking up
in mode Partial.
Issue #667
Issue #661
Change-Id: Ib456dffc9d0161e8899c55ffdbe48c7a4b51bc17
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/8321
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
diff --git a/internal/core/adt/adt.go b/internal/core/adt/adt.go
index d746190..f67f1cb 100644
--- a/internal/core/adt/adt.go
+++ b/internal/core/adt/adt.go
@@ -114,7 +114,7 @@
// a value.
type Resolver interface {
Node
- resolve(ctx *OpContext) *Vertex
+ resolve(ctx *OpContext, state VertexStatus) *Vertex
}
type YieldFunc func(env *Environment, s *StructLit)