(typ Type)
| 401 | } |
| 402 | |
| 403 | func (c *Context) LookupTypeValue(typ Type) Value { |
| 404 | c.mu.Lock() |
| 405 | if c.toValue != nil { |
| 406 | if bytes, ok := c.toValue[typ]; ok { |
| 407 | c.mu.Unlock() |
| 408 | return NewValue(TypeType, bytes) |
| 409 | } |
| 410 | } |
| 411 | c.mu.Unlock() |
| 412 | tv := EncodeTypeValue(typ) |
| 413 | typ, err := c.LookupByValue(tv) |
| 414 | if err != nil { |
| 415 | // This shouldn't happen. |
| 416 | return c.Missing() |
| 417 | } |
| 418 | return c.LookupTypeValue(typ) |
| 419 | } |
| 420 | |
| 421 | func (c *Context) DecodeTypeValue(tv scode.Bytes) (Type, scode.Bytes) { |
| 422 | if len(tv) == 0 { |