···63636464outer:
6565 for _, sel := range p.path {
6666- f := sel.sel.feature(v.idx.Runtime)
6666+ f := sel.sel.feature(v.idx)
6767 for _, a := range n.Arcs {
6868 if a.Label == f {
6969 n = a
+16-17
cue/types.go
···213213//
214214type Iterator struct {
215215 val Value
216216- idx *index
216216+ idx *runtime.Runtime
217217 ctx *adt.OpContext
218218 arcs []field
219219 p int
···551551 }
552552 a = append(a, label)
553553 default:
554554- a = append(a, f.SelectorString(v.idx.Runtime))
554554+ a = append(a, f.SelectorString(v.idx))
555555 }
556556 }
557557 return a
···560560// Value holds any value, which may be a Boolean, Error, List, Null, Number,
561561// Struct, or String.
562562type Value struct {
563563- idx *index
563563+ idx *runtime.Runtime
564564 v *adt.Vertex
565565}
566566···575575 return makeValue(v.idx, node)
576576}
577577578578-func newVertexRoot(idx *index, ctx *adt.OpContext, x *adt.Vertex) Value {
578578+func newVertexRoot(idx *runtime.Runtime, ctx *adt.OpContext, x *adt.Vertex) Value {
579579 if ctx != nil {
580580 // This is indicative of an zero Value. In some cases this is called
581581 // with an error value.
···586586 return makeValue(idx, x)
587587}
588588589589-func newValueRoot(idx *index, ctx *adt.OpContext, x adt.Expr) Value {
589589+func newValueRoot(idx *runtime.Runtime, ctx *adt.OpContext, x adt.Expr) Value {
590590 if n, ok := x.(*adt.Vertex); ok {
591591 return newVertexRoot(idx, ctx, n)
592592 }
···629629//
630630// For internal use only.
631631func MakeValue(ctx *adt.OpContext, v adt.Value) Value {
632632- runtime := ctx.Impl().(*runtime.Runtime)
633633- index := runtime.Data.(*index)
632632+ index := ctx.Impl().(*runtime.Runtime)
634633635634 return newValueRoot(index, newContext(index), v)
636635}
637636638638-func makeValue(idx *index, v *adt.Vertex) Value {
637637+func makeValue(idx *runtime.Runtime, v *adt.Vertex) Value {
639638 if v.Status() == 0 || v.BaseValue == nil {
640639 panic(fmt.Sprintf("not properly initialized (state: %v, value: %T)",
641640 v.Status(), v.BaseValue))
···969968 if o.concrete || o.final {
970969 // inst = v.instance()
971970 var expr ast.Expr
972972- expr, err = p.Value(v.idx.Runtime, pkgID, v.v)
971971+ expr, err = p.Value(v.idx, pkgID, v.v)
973972 if err != nil {
974973 return bad(`"cuelang.org/go/internal/core/export".Value`, err)
975974 }
···981980 }
982981 // return expr
983982 } else {
984984- f, err = p.Def(v.idx.Runtime, pkgID, v.v)
983983+ f, err = p.Def(v.idx, pkgID, v.v)
985984 if err != nil {
986985 return bad(`"cuelang.org/go/internal/core/export".Def`, err)
987986 }
···14911490 a[i] = Selector{indexSelector(f)}
1492149114931492 case adt.DefinitionLabel, adt.HiddenDefinitionLabel, adt.HiddenLabel:
14941494- a[i] = Selector{definitionSelector(f.SelectorString(v.idx.Runtime))}
14931493+ a[i] = Selector{definitionSelector(f.SelectorString(v.idx))}
1495149414961495 case adt.StringLabel:
14971497- a[i] = Selector{stringSelector(f.StringValue(v.idx.Runtime))}
14961496+ a[i] = Selector{stringSelector(f.StringValue(v.idx))}
14981497 }
14991498 }
15001499 return Path{path: a}
···18241823 case state.Flag('+'):
18251824 _, _ = io.WriteString(state, ctx.Str(v.v))
18261825 default:
18271827- n, _ := export.Raw.Expr(v.idx.Runtime, v.instance().ID(), v.v)
18261826+ n, _ := export.Raw.Expr(v.idx, v.instance().ID(), v.v)
18281827 b, _ := format.Node(n)
18291828 _, _ = state.Write(b)
18301829 }
···18521851 return reference(v.idx, ctx, c.Env, c.Expr())
18531852}
1854185318551855-func reference(rt *index, c *adt.OpContext, env *adt.Environment, r adt.Expr) (inst *Instance, path []string) {
18541854+func reference(rt *runtime.Runtime, c *adt.OpContext, env *adt.Environment, r adt.Expr) (inst *Instance, path []string) {
18561855 ctx := c
18571856 defer ctx.PopState(ctx.PushState(env, r.Source()))
18581857···19001899 return inst, path
19011900}
1902190119031903-func mkPath(ctx *index, a []string, v *adt.Vertex) (inst *Instance, path []string) {
19021902+func mkPath(ctx *runtime.Runtime, a []string, v *adt.Vertex) (inst *Instance, path []string) {
19041903 if v.Parent == nil {
19051904 return getImportFromNode(ctx, v), a
19061905 }
···23902389 a.AddConjunct(adt.MakeRootConjunct(env, n.Val))
23912390 b.AddConjunct(adt.MakeRootConjunct(env, disjunct.Val))
2392239123932393- ctx := eval.NewContext(v.idx.Runtime, nil)
23922392+ ctx := eval.NewContext(v.idx, nil)
23942393 ctx.Unify(&a, adt.Finalized)
23952394 ctx.Unify(&b, adt.Finalized)
23962395 if allowed(ctx, v.v, &b) != nil {
···24342433 a = append(a, remakeValue(v, env, x.X))
24352434 // A string selector is quoted.
24362435 a = append(a, remakeValue(v, env, &adt.String{
24372437- Str: x.Sel.SelectorString(v.idx.Runtime),
24362436+ Str: x.Sel.SelectorString(v.idx),
24382437 }))
24392438 op = SelectorOp
24402439
-3
internal/core/runtime/runtime.go
···2222type Runtime struct {
2323 index *index
24242525- // Data holds the legacy index strut. It is for transitional purposes only.
2626- Data interface{}
2727-2825 loaded map[*build.Instance]interface{}
2926}
3027