StructValues provides the entries that make up the struct via label-value callback.
(cbCons func(Constant, Constant) error, cbNil func() error)
| 537 | |
| 538 | // StructValues provides the entries that make up the struct via label-value callback. |
| 539 | func (c Constant) StructValues(cbCons func(Constant, Constant) error, cbNil func() error) (error, error) { |
| 540 | if c.Type != StructShape { |
| 541 | return fmt.Errorf("not a struct constant %v", c), nil |
| 542 | } |
| 543 | for ; !c.IsStructNil(); c = *c.snd { |
| 544 | p := c.fst |
| 545 | if p.Type != PairShape { |
| 546 | return fmt.Errorf("not a map entry %v", p), nil |
| 547 | } |
| 548 | if err := cbCons(*p.fst, *p.snd); err != nil { |
| 549 | return nil, err |
| 550 | } |
| 551 | } |
| 552 | return nil, cbNil() |
| 553 | } |
| 554 | |
| 555 | func (c Constant) isBaseTerm() { |
| 556 | } |
no test coverage detected