gopherjs:replace
(dst, src Value)
| 659 | |
| 660 | //gopherjs:replace |
| 661 | func Copy(dst, src Value) int { |
| 662 | dk := dst.kind() |
| 663 | if dk != Array && dk != Slice { |
| 664 | panic(&ValueError{"reflect.Copy", dk}) |
| 665 | } |
| 666 | if dk == Array { |
| 667 | dst.mustBeAssignable() |
| 668 | } |
| 669 | dst.mustBeExported() |
| 670 | |
| 671 | sk := src.kind() |
| 672 | var stringCopy bool |
| 673 | if sk != Array && sk != Slice { |
| 674 | stringCopy = sk == String && dst.typ().Elem().Kind() == abi.Uint8 |
| 675 | if !stringCopy { |
| 676 | panic(&ValueError{"reflect.Copy", sk}) |
| 677 | } |
| 678 | } |
| 679 | src.mustBeExported() |
| 680 | |
| 681 | if !stringCopy { |
| 682 | typesMustMatch("reflect.Copy", toRType(dst.typ().Elem()), toRType(src.typ().Elem())) |
| 683 | } |
| 684 | |
| 685 | dstVal := dst.object() |
| 686 | if dk == Array { |
| 687 | dstVal = jsType(SliceOf(toRType(dst.typ().Elem()))).New(dstVal) |
| 688 | } |
| 689 | |
| 690 | srcVal := src.object() |
| 691 | if sk == Array { |
| 692 | srcVal = jsType(SliceOf(toRType(src.typ().Elem()))).New(srcVal) |
| 693 | } |
| 694 | |
| 695 | if stringCopy { |
| 696 | return js.Global.Call("$copyString", dstVal, srcVal).Int() |
| 697 | } |
| 698 | return js.Global.Call("$copySlice", dstVal, srcVal).Int() |
| 699 | } |
| 700 | |
| 701 | //gopherjs:replace |
| 702 | func methodReceiver(op string, v Value, methodIndex int) (rcvrtype *abi.Type, t *funcType, fn unsafe.Pointer) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…