From 8fd7201f87254da6bce8d9af4aaf9c4589ede5e5 Mon Sep 17 00:00:00 2001 From: TristonianJones Date: Fri, 12 Apr 2024 21:06:40 -0700 Subject: [PATCH] Remove the deprecated protobuf function and type declarations for the standard environment --- checker/BUILD.bazel | 1 - checker/standard.go | 35 --------------------------------- common/stdlib/BUILD.bazel | 2 -- common/stdlib/standard.go | 41 --------------------------------------- 4 files changed, 79 deletions(-) delete mode 100644 checker/standard.go diff --git a/checker/BUILD.bazel b/checker/BUILD.bazel index 997fa91d..678b412a 100644 --- a/checker/BUILD.bazel +++ b/checker/BUILD.bazel @@ -16,7 +16,6 @@ go_library( "options.go", "printer.go", "scopes.go", - "standard.go", "types.go", ], importpath = "github.com/google/cel-go/checker", diff --git a/checker/standard.go b/checker/standard.go deleted file mode 100644 index 11b35b80..00000000 --- a/checker/standard.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package checker - -import ( - "github.com/google/cel-go/common/stdlib" - - exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1" -) - -// StandardFunctions returns the Decls for all functions in the evaluator. -// -// Deprecated: prefer stdlib.FunctionExprDecls() -func StandardFunctions() []*exprpb.Decl { - return stdlib.FunctionExprDecls() -} - -// StandardTypes returns the set of type identifiers for standard library types. -// -// Deprecated: prefer stdlib.TypeExprDecls() -func StandardTypes() []*exprpb.Decl { - return stdlib.TypeExprDecls() -} diff --git a/common/stdlib/BUILD.bazel b/common/stdlib/BUILD.bazel index c130a93f..b55f4521 100644 --- a/common/stdlib/BUILD.bazel +++ b/common/stdlib/BUILD.bazel @@ -12,7 +12,6 @@ go_library( ], importpath = "github.com/google/cel-go/common/stdlib", deps = [ - "//checker/decls:go_default_library", "//common/decls:go_default_library", "//common/functions:go_default_library", "//common/operators:go_default_library", @@ -20,6 +19,5 @@ go_library( "//common/types:go_default_library", "//common/types/ref:go_default_library", "//common/types/traits:go_default_library", - "@org_golang_google_genproto_googleapis_api//expr/v1alpha1:go_default_library", ], ) \ No newline at end of file diff --git a/common/stdlib/standard.go b/common/stdlib/standard.go index d02cb64b..1550c178 100644 --- a/common/stdlib/standard.go +++ b/common/stdlib/standard.go @@ -23,15 +23,11 @@ import ( "github.com/google/cel-go/common/types" "github.com/google/cel-go/common/types/ref" "github.com/google/cel-go/common/types/traits" - - exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1" ) var ( stdFunctions []*decls.FunctionDecl - stdFnDecls []*exprpb.Decl stdTypes []*decls.VariableDecl - stdTypeDecls []*exprpb.Decl ) func init() { @@ -55,15 +51,6 @@ func init() { decls.TypeVariable(types.UintType), } - stdTypeDecls = make([]*exprpb.Decl, 0, len(stdTypes)) - for _, stdType := range stdTypes { - typeVar, err := decls.VariableDeclToExprDecl(stdType) - if err != nil { - panic(err) - } - stdTypeDecls = append(stdTypeDecls, typeVar) - } - stdFunctions = []*decls.FunctionDecl{ // Logical operators. Special-cased within the interpreter. // Note, the singleton binding prevents extensions from overriding the operator behavior. @@ -576,18 +563,6 @@ func init() { decls.MemberOverload(overloads.DurationToMilliseconds, argTypes(types.DurationType), types.IntType)), } - - stdFnDecls = make([]*exprpb.Decl, 0, len(stdFunctions)) - for _, fn := range stdFunctions { - if fn.IsDeclarationDisabled() { - continue - } - ed, err := decls.FunctionDeclToExprDecl(fn) - if err != nil { - panic(err) - } - stdFnDecls = append(stdFnDecls, ed) - } } // Functions returns the set of standard library function declarations and definitions for CEL. @@ -595,27 +570,11 @@ func Functions() []*decls.FunctionDecl { return stdFunctions } -// FunctionExprDecls returns the legacy style protobuf-typed declarations for all functions and overloads -// in the CEL standard environment. -// -// Deprecated: use Functions -func FunctionExprDecls() []*exprpb.Decl { - return stdFnDecls -} - // Types returns the set of standard library types for CEL. func Types() []*decls.VariableDecl { return stdTypes } -// TypeExprDecls returns the legacy style protobuf-typed declarations for all types in the CEL -// standard environment. -// -// Deprecated: use Types -func TypeExprDecls() []*exprpb.Decl { - return stdTypeDecls -} - func notStrictlyFalse(value ref.Val) ref.Val { if types.IsBool(value) { return value