Skip to content

Commit

Permalink
cue: get rid of NewRuntime
Browse files Browse the repository at this point in the history
It exposes an internal type that is no longer necessary.

Change-Id: Ia683a0986bc43a39bef751406f9e9e8529fc3b70
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/9422
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
  • Loading branch information
mpvl committed Apr 21, 2021
1 parent 64ede63 commit 790bed3
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 16 deletions.
6 changes: 0 additions & 6 deletions cue/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,6 @@ func (r *Runtime) FromExpr(expr ast.Expr) (*Instance, error) {
})
}

// NewRuntime creates a *runtime.Runtime with builtins preloaded.
func NewRuntime() *runtime.Runtime {
i := newIndex()
return i
}

// newIndex creates a new index.
func newIndex() *runtime.Runtime {
return runtime.New()
Expand Down
6 changes: 3 additions & 3 deletions internal/core/adt/eval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import (

"github.com/rogpeppe/go-internal/txtar"

"cuelang.org/go/cue"
"cuelang.org/go/internal/core/adt"
"cuelang.org/go/internal/core/debug"
"cuelang.org/go/internal/core/eval"
"cuelang.org/go/internal/core/runtime"
"cuelang.org/go/internal/core/validate"
"cuelang.org/go/internal/cuetest"
"cuelang.org/go/internal/cuetxtar"
Expand All @@ -49,7 +49,7 @@ func TestEval(t *testing.T) {
test.ToDo = nil
}

r := cue.NewRuntime()
r := runtime.New()

test.Run(t, func(t *cuetxtar.Test) {
a := t.ValidInstances()
Expand Down Expand Up @@ -115,7 +115,7 @@ module: "example.com"
t.Fatal(instance.Err)
}

r := cue.NewRuntime()
r := runtime.New()

v, err := r.Build(instance)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/core/export/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestDefinition(t *testing.T) {
Update: cuetest.UpdateGoldenFiles,
}

r := cue.NewRuntime()
r := runtime.New()

test.Run(t, func(t *cuetxtar.Test) {
a := t.ValidInstances()
Expand Down
4 changes: 2 additions & 2 deletions internal/core/export/extract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import (
"fmt"
"testing"

"cuelang.org/go/cue"
"cuelang.org/go/internal/core/adt"
"cuelang.org/go/internal/core/compile"
"cuelang.org/go/internal/core/eval"
"cuelang.org/go/internal/core/export"
"cuelang.org/go/internal/core/runtime"
"cuelang.org/go/internal/cuetest"
"cuelang.org/go/internal/cuetxtar"
)
Expand All @@ -34,7 +34,7 @@ func TestExtract(t *testing.T) {
Update: cuetest.UpdateGoldenFiles,
}

r := cue.NewRuntime()
r := runtime.New()

test.Run(t, func(t *cuetxtar.Test) {
a := t.ValidInstances()
Expand Down
3 changes: 1 addition & 2 deletions internal/core/export/value_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"fmt"
"testing"

"cuelang.org/go/cue"
"cuelang.org/go/cue/ast"
"cuelang.org/go/cue/errors"
"cuelang.org/go/internal/core/adt"
Expand All @@ -43,7 +42,7 @@ func TestValue(t *testing.T) {
Skip: exclude,
}

r := cue.NewRuntime()
r := runtime.New()

test.Run(t, func(t *cuetxtar.Test) {
a := t.ValidInstances()
Expand Down
4 changes: 2 additions & 2 deletions pkg/internal/builtintest/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (
"fmt"
"testing"

"cuelang.org/go/cue"
"cuelang.org/go/cue/format"
"cuelang.org/go/internal/core/eval"
"cuelang.org/go/internal/core/export"
"cuelang.org/go/internal/core/runtime"
"cuelang.org/go/internal/core/validate"
"cuelang.org/go/internal/cuetxtar"
)
Expand All @@ -32,7 +32,7 @@ func Run(name string, t *testing.T) {
Name: name,
}

r := cue.NewRuntime()
r := runtime.New()

test.Run(t, func(t *cuetxtar.Test) {
a := t.ValidInstances()
Expand Down

0 comments on commit 790bed3

Please sign in to comment.