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

Method parseVariableObject

policy/parser.go:821–836  ·  view source on GitHub ↗
(ctx ParserContext, policy *Policy, v *Variable, node *yaml.Node)

Source from the content-addressed store, hash-verified

819}
820
821func (p *parserImpl) parseVariableObject(ctx ParserContext, policy *Policy, v *Variable, node *yaml.Node) *Variable {
822 p.RangeMap(node, func(key, val *yaml.Node) bool {
823 keyID := ctx.CollectMetadata(key)
824 fieldName := key.Value
825 switch fieldName {
826 case "name":
827 v.SetName(ctx.NewString(val))
828 case "expression":
829 v.SetExpression(ctx.NewString(val))
830 default:
831 p.visitor.VariableTag(ctx, keyID, fieldName, val, policy, v)
832 }
833 return true
834 })
835 return v
836}
837
838func (p *parserImpl) parseMatches(ctx ParserContext, policy *Policy, r *Rule, node *yaml.Node) {
839 id := ctx.CollectMetadata(node)

Callers 1

ParseVariableMethod · 0.95

Calls 6

RangeMapMethod · 0.80
SetExpressionMethod · 0.80
CollectMetadataMethod · 0.65
NewStringMethod · 0.65
VariableTagMethod · 0.65
SetNameMethod · 0.45

Tested by

no test coverage detected