under contains logic for Under that the compiler won't inline.
()
| 461 | |
| 462 | // under contains logic for Under that the compiler won't inline. |
| 463 | func (v Value) under() Value { |
| 464 | typ, bytes := v.Type(), v.Bytes() |
| 465 | for { |
| 466 | switch under := TypeUnder(typ).(type) { |
| 467 | case *TypeUnion: |
| 468 | typ, bytes = under.Untag(bytes) |
| 469 | case *TypeFusion: |
| 470 | typ, bytes = under.DerefFusion(bytes) |
| 471 | default: |
| 472 | return NewValue(under, bytes) |
| 473 | } |
| 474 | } |
| 475 | } |
| 476 | |
| 477 | // Validate checks that v.Bytes is structurally consistent |
| 478 | // with v.Type. It does not check that the actual leaf |