()
| 690 | } |
| 691 | |
| 692 | func (v rawValue) String() string { |
| 693 | if len(v.buf) == 2 || len(v.buf) == 4 || len(v.buf) == 8 { |
| 694 | // Format as a pointer if the entire buf is this pointer. |
| 695 | if v.buf[0] > 255 { |
| 696 | isPointer := true |
| 697 | for _, p := range v.buf { |
| 698 | if p != v.buf[0] { |
| 699 | isPointer = false |
| 700 | break |
| 701 | } |
| 702 | } |
| 703 | if isPointer { |
| 704 | return pointerValue{v.buf[0]}.String() |
| 705 | } |
| 706 | } |
| 707 | // Format as number if none of the buf is a pointer. |
| 708 | if !v.hasPointer() { |
| 709 | // Construct a fake runner, which is little endian. |
| 710 | // We only use String() for debugging, so this is is good enough |
| 711 | // (the printed value will just be slightly wrong when debugging the |
| 712 | // interp package with GOOS=mips for example). |
| 713 | r := &runner{byteOrder: binary.LittleEndian} |
| 714 | return strconv.FormatInt(v.Int(r), 10) |
| 715 | } |
| 716 | } |
| 717 | return "<[…" + strconv.Itoa(len(v.buf)) + "]>" |
| 718 | } |
| 719 | |
| 720 | func (v rawValue) clone() value { |
| 721 | newValue := v |
nothing calls this directly
no test coverage detected