From 1c1a7b3aff0fa09cd6bc8dbe482f0d4d82f1731a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 13 Jul 2023 16:25:26 +0200 Subject: [PATCH] internal: remove a few unused APIs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit None of these four APIs has been used for over two years at this point. They are always available in the git history if needed. Signed-off-by: Daniel Martí Change-Id: I1c11e7c45227f792d2d4e4f3069765f271d1aded Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/556611 Reviewed-by: Roger Peppe Unity-Result: CUE porcuepine TryBot-Result: CUEcueckoo --- internal/core/adt/context.go | 8 -------- internal/internal.go | 27 --------------------------- internal/value/value.go | 9 --------- 3 files changed, 44 deletions(-) diff --git a/internal/core/adt/context.go b/internal/core/adt/context.go index d9ee22d3fae..57269551f21 100644 --- a/internal/core/adt/context.go +++ b/internal/core/adt/context.go @@ -111,14 +111,6 @@ func init() { log.SetFlags(log.Lshortfile) } -func Logf(format string, args ...interface{}) { - if Verbosity == 0 { - return - } - s := fmt.Sprintf(format, args...) - _ = log.Output(2, s) -} - var pMap = map[*Vertex]int{} func (c *OpContext) Logf(v *Vertex, format string, args ...interface{}) { diff --git a/internal/internal.go b/internal/internal.go index 7c91a93a32c..c944f88398f 100644 --- a/internal/internal.go +++ b/internal/internal.go @@ -325,33 +325,6 @@ func ToFile(n ast.Node) *ast.File { } } -// ToStruct gets the non-preamble declarations of a file and puts them in a -// struct. -func ToStruct(f *ast.File) *ast.StructLit { - start := 0 - for i, d := range f.Decls { - switch d.(type) { - case *ast.Package, *ast.ImportDecl: - start = i + 1 - case *ast.Attribute, *ast.CommentGroup: - default: - break - } - } - s := ast.NewStruct() - s.Elts = f.Decls[start:] - return s -} - -func IsBulkField(d ast.Decl) bool { - if f, ok := d.(*ast.Field); ok { - if _, ok := f.Label.(*ast.ListLit); ok { - return true - } - } - return false -} - func IsDef(s string) bool { return strings.HasPrefix(s, "#") || strings.HasPrefix(s, "_#") } diff --git a/internal/value/value.go b/internal/value/value.go index 5539475c5e9..5d4dc0426fb 100644 --- a/internal/value/value.go +++ b/internal/value/value.go @@ -20,7 +20,6 @@ import ( "strings" "cuelang.org/go/cue" - "cuelang.org/go/cue/errors" "cuelang.org/go/internal/core/adt" "cuelang.org/go/internal/core/convert" "cuelang.org/go/internal/core/eval" @@ -50,14 +49,6 @@ func Make(ctx *adt.OpContext, v adt.Value) cue.Value { return (*cue.Context)(ctx.Impl().(*runtime.Runtime)).Encode(v) } -func MakeError(r *runtime.Runtime, err errors.Error) cue.Value { - b := &adt.Bottom{Err: err} - node := &adt.Vertex{BaseValue: b} - node.ForceDone() - node.AddConjunct(adt.MakeRootConjunct(nil, b)) - return (*cue.Context)(r).Encode(node) -} - // UnifyBuiltin returns the given Value unified with the given builtin template. func UnifyBuiltin(v cue.Value, kind string) cue.Value { p := strings.Split(kind, ".")