AddChildren implements the interface StatementGenerator.
(children ...StatementGenerator)
| 288 | |
| 289 | // AddChildren implements the interface StatementGenerator. |
| 290 | func (v *VariableGen) AddChildren(children ...StatementGenerator) error { |
| 291 | children = removeNilGenerators(children) |
| 292 | if len(children) == 0 { |
| 293 | return nil |
| 294 | } |
| 295 | if len(children) > 1 { |
| 296 | return fmt.Errorf("attempting to give variable `%s` too many children", v.name) |
| 297 | } |
| 298 | if v.options != nil { |
| 299 | return fmt.Errorf("variable `%s` has already been assigned", v.name) |
| 300 | } |
| 301 | v.options = children[0].Copy() |
| 302 | return nil |
| 303 | } |
| 304 | |
| 305 | // Consume implements the interface StatementGenerator. |
| 306 | func (v *VariableGen) Consume() bool { |
nothing calls this directly
no test coverage detected