(b *buffer)
| 342 | } |
| 343 | |
| 344 | func (d *Decoder) readTypeUnion(b *buffer) error { |
| 345 | ntyp, err := readUvarintAsInt(b) |
| 346 | if err != nil { |
| 347 | return errBadFormat |
| 348 | } |
| 349 | if ntyp == 0 { |
| 350 | return errors.New("type union: zero types not allowed") |
| 351 | } |
| 352 | if ntyp > super.MaxUnionTypes { |
| 353 | return fmt.Errorf("type union: too many types (%d)", ntyp) |
| 354 | |
| 355 | } |
| 356 | types := make([]super.Type, 0, ntyp) |
| 357 | for range ntyp { |
| 358 | typ, err := d.readType(b) |
| 359 | if err != nil { |
| 360 | return err |
| 361 | } |
| 362 | types = append(types, typ) |
| 363 | } |
| 364 | d.enter(d.sctx.LookupTypeUnion(types)) |
| 365 | return nil |
| 366 | } |
| 367 | |
| 368 | func (d *Decoder) readTypeEnum(b *buffer) error { |
| 369 | nsym, err := readUvarintAsInt(b) |
no test coverage detected