(ctx ParserContext, _ *Policy, v *Variable, node *yaml.Node)
| 855 | } |
| 856 | |
| 857 | func (p *parserImpl) parseVariableInline(ctx ParserContext, _ *Policy, v *Variable, node *yaml.Node) *Variable { |
| 858 | iterations := 0 |
| 859 | p.RangeMap(node, func(key, val *yaml.Node) bool { |
| 860 | keyVal := ctx.NewString(key) |
| 861 | v.SetName(keyVal) |
| 862 | v.SetExpression(ctx.NewString(val)) |
| 863 | iterations++ |
| 864 | if iterations > 1 { |
| 865 | p.ReportErrorAtID(keyVal.ID, "only one variable may be defined inline") |
| 866 | return false |
| 867 | } |
| 868 | return true |
| 869 | }) |
| 870 | return v |
| 871 | } |
| 872 | |
| 873 | func (p *parserImpl) parseVariableObject(ctx ParserContext, policy *Policy, v *Variable, node *yaml.Node) *Variable { |
| 874 | p.RangeMap(node, func(key, val *yaml.Node) bool { |
no test coverage detected