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

Function variableDeclToExprDecl

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

1198
1199// variableDeclToExprDecl converts a go-native variable declaration into a protobuf-type variable declaration.
1200func variableDeclToExprDecl(v *VariableDecl) (*exprpb.Decl, error) {
1201 varType, err := types.TypeToExprType(v.Type())
1202 if err != nil {
1203 return nil, err
1204 }
1205 return chkdecls.NewVarWithDoc(v.Name(), varType, v.doc), nil
1206}
1207
1208// FunctionDeclToExprDecl converts a go-native function declaration into a protobuf-typed function declaration.
1209func 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