cue: unexport NewInstance from api
Change-Id: Ic3fa2bdac484fc2340e4cf88254255b69f360501
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2543
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/build.go b/cue/build.go
index ae23393..c1a6b70 100644
--- a/cue/build.go
+++ b/cue/build.go
@@ -105,7 +105,7 @@
// FromExpr creates an instance from an expression.
// Any references must be resolved beforehand.
func (r *Runtime) FromExpr(expr ast.Expr) (*Instance, error) {
- i := r.index().NewInstance(nil)
+ i := r.index().newInstance(nil)
err := i.insertFile(&ast.File{
Decls: []ast.Decl{&ast.EmitDecl{Expr: expr}},
})
@@ -223,7 +223,7 @@
return inst
}
files := p.Files
- inst := idx.NewInstance(p)
+ inst := idx.newInstance(p)
if inst.Err == nil {
// inst.instance.index.state = s
// inst.instance.inst = p
diff --git a/cue/instance.go b/cue/instance.go
index 8df4cda..44a2ccb 100644
--- a/cue/instance.go
+++ b/cue/instance.go
@@ -64,8 +64,8 @@
return imp
}
-// NewInstance creates a new instance. Use Insert to populate the instance.
-func (x *index) NewInstance(p *build.Instance) *Instance {
+// newInstance creates a new instance. Use Insert to populate the instance.
+func (x *index) newInstance(p *build.Instance) *Instance {
st := &structLit{baseValue: baseValue{nil}}
i := x.addInst(&Instance{
rootStruct: st,
@@ -224,7 +224,7 @@
idx := inst.index
- i := idx.NewInstance(p)
+ i := idx.newInstance(p)
if i.Err != nil {
return i
}
diff --git a/cue/resolve_test.go b/cue/resolve_test.go
index 193a6ef..6125c7a 100644
--- a/cue/resolve_test.go
+++ b/cue/resolve_test.go
@@ -43,7 +43,7 @@
inst, err := r.Parse("test", body)
if err != nil {
- x := newIndex().NewInstance(nil)
+ x := newIndex().newInstance(nil)
ctx := x.newContext()
return ctx, x, err
}