Skip to content

Commit

Permalink
Remove the deprecated protobuf function and type declarations for the…
Browse files Browse the repository at this point in the history
… standard environment (#921)
  • Loading branch information
TristonianJones authored Apr 16, 2024
1 parent 148d29d commit 94cbc9d
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 79 deletions.
1 change: 0 additions & 1 deletion checker/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ go_library(
"options.go",
"printer.go",
"scopes.go",
"standard.go",
"types.go",
],
importpath = "github.com/google/cel-go/checker",
Expand Down
35 changes: 0 additions & 35 deletions checker/standard.go

This file was deleted.

2 changes: 0 additions & 2 deletions common/stdlib/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ 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",
"//common/overloads:go_default_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",
],
)
41 changes: 0 additions & 41 deletions common/stdlib/standard.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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.
Expand Down Expand Up @@ -576,46 +563,18 @@ 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.
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
Expand Down

0 comments on commit 94cbc9d

Please sign in to comment.