(ctx ParserContext, policy *Policy, v *Variable, node *yaml.Node)
| 803 | } |
| 804 | |
| 805 | func (p *parserImpl) parseVariableInline(ctx ParserContext, policy *Policy, v *Variable, node *yaml.Node) *Variable { |
| 806 | iterations := 0 |
| 807 | p.RangeMap(node, func(key, val *yaml.Node) bool { |
| 808 | keyVal := ctx.NewString(key) |
| 809 | v.SetName(keyVal) |
| 810 | v.SetExpression(ctx.NewString(val)) |
| 811 | iterations++ |
| 812 | if iterations > 1 { |
| 813 | p.ReportErrorAtID(keyVal.ID, "only one variable may be defined inline") |
| 814 | return false |
| 815 | } |
| 816 | return true |
| 817 | }) |
| 818 | return v |
| 819 | } |
| 820 | |
| 821 | func (p *parserImpl) parseVariableObject(ctx ParserContext, policy *Policy, v *Variable, node *yaml.Node) *Variable { |
| 822 | p.RangeMap(node, func(key, val *yaml.Node) bool { |
no test coverage detected