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

Function variableDeclToExprDecl

common/decls/decls.go:1112–1118  ·  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

1110
1111// variableDeclToExprDecl converts a go-native variable declaration into a protobuf-type variable declaration.
1112func variableDeclToExprDecl(v *VariableDecl) (*exprpb.Decl, error) {
1113 varType, err := types.TypeToExprType(v.Type())
1114 if err != nil {
1115 return nil, err
1116 }
1117 return chkdecls.NewVarWithDoc(v.Name(), varType, v.doc), nil
1118}
1119
1120// FunctionDeclToExprDecl converts a go-native function declaration into a protobuf-typed function declaration.
1121func 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