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

Method parseVariableObject

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

Source from the content-addressed store, hash-verified

871}
872
873func (p *parserImpl) parseVariableObject(ctx ParserContext, policy *Policy, v *Variable, node *yaml.Node) *Variable {
874 p.RangeMap(node, func(key, val *yaml.Node) bool {
875 keyID := ctx.CollectMetadata(key)
876 fieldName := key.Value
877 switch fieldName {
878 case "name":
879 v.SetName(ctx.NewString(val))
880 case "expression":
881 v.SetExpression(ctx.NewString(val))
882 default:
883 p.visitor.VariableTag(ctx, keyID, fieldName, val, policy, v)
884 }
885 return true
886 })
887 return v
888}
889
890func (p *parserImpl) parseMatches(ctx ParserContext, policy *Policy, r *Rule, node *yaml.Node) {
891 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