Equal reports whether p and v have the same type and the same BSUP representation.
(p Value)
| 295 | // Equal reports whether p and v have the same type and the same BSUP |
| 296 | // representation. |
| 297 | func (v Value) Equal(p Value) bool { |
| 298 | if v.Type() != p.Type() { |
| 299 | return false |
| 300 | } |
| 301 | if x, ok := v.native(); ok { |
| 302 | if y, ok := p.native(); ok { |
| 303 | return x == y |
| 304 | } |
| 305 | } |
| 306 | return bytes.Equal(v.Bytes(), p.Bytes()) |
| 307 | } |
| 308 | |
| 309 | func (r Value) HasField(field string) bool { |
| 310 | return TypeRecordOf(r.Type()).HasField(field) |