MCPcopy Create free account
hub / github.com/cel-expr/cel-go / variableDeclToExprDecl

Function variableDeclToExprDecl

common/decls/decls.go:1016–1022  ·  view source on GitHub ↗

variableDeclToExprDecl converts a go-native variable declaration into a protobuf-type variable declaration.

(v *VariableDecl)

Source from the content-addressed store, hash-verified

1014
1015// variableDeclToExprDecl converts a go-native variable declaration into a protobuf-type variable declaration.
1016func variableDeclToExprDecl(v *VariableDecl) (*exprpb.Decl, error) {
1017 varType, err := types.TypeToExprType(v.Type())
1018 if err != nil {
1019 return nil, err
1020 }
1021 return chkdecls.NewVarWithDoc(v.Name(), varType, v.doc), nil
1022}
1023
1024// FunctionDeclToExprDecl converts a go-native function declaration into a protobuf-typed function declaration.
1025func FunctionDeclToExprDecl(f *FunctionDecl) (*exprpb.Decl, error) {

Callers 1

VariableDeclToExprDeclFunction · 0.85

Calls 3

TypeToExprTypeFunction · 0.92
TypeMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected