@@ -779,7 +779,7 @@ func (v Value) SetCap(n int) {
779779 if n < s .Get ("$length" ).Int () || n > s .Get ("$capacity" ).Int () {
780780 panic ("reflect: slice capacity out of range in SetCap" )
781781 }
782- newSlice := jsType ( v .typ ).New (s .Get ("$array" ))
782+ newSlice := v .typ (). JsType ( ).New (s .Get ("$array" ))
783783 newSlice .Set ("$offset" , s .Get ("$offset" ))
784784 newSlice .Set ("$length" , s .Get ("$length" ))
785785 newSlice .Set ("$capacity" , n )
@@ -793,7 +793,7 @@ func (v Value) SetLen(n int) {
793793 if n < 0 || n > s .Get ("$capacity" ).Int () {
794794 panic ("reflect: slice length out of range in SetLen" )
795795 }
796- newSlice := jsType ( v .typ ).New (s .Get ("$array" ))
796+ newSlice := v .typ (). JsType ( ).New (s .Get ("$array" ))
797797 newSlice .Set ("$offset" , s .Get ("$offset" ))
798798 newSlice .Set ("$length" , n )
799799 newSlice .Set ("$capacity" , s .Get ("$capacity" ))
@@ -803,21 +803,21 @@ func (v Value) SetLen(n int) {
803803func (v Value ) Slice (i , j int ) Value {
804804 var (
805805 cap int
806- typ Type
806+ typ * abi. Type
807807 s * js.Object
808808 )
809809 switch kind := v .kind (); kind {
810810 case Array :
811811 if v .flag & flagAddr == 0 {
812812 panic ("reflect.Value.Slice: slice of unaddressable array" )
813813 }
814- tt := ( * arrayType )( unsafe . Pointer ( v .typ ) )
815- cap = int (tt .len )
816- typ = SliceOf (tt .elem )
817- s = jsType ( typ ).New (v .object ())
814+ tt := v .typ (). ArrayType ( )
815+ cap = int (tt .Len )
816+ typ = SliceOf (toRType ( tt .Elem )). common ( )
817+ s = typ . JsType ( ).New (v .object ())
818818
819819 case Slice :
820- typ = v .typ
820+ typ = v .typ ()
821821 s = v .object ()
822822 cap = s .Get ("$capacity" ).Int ()
823823
@@ -829,7 +829,7 @@ func (v Value) Slice(i, j int) Value {
829829 return ValueOf (str [i :j ])
830830
831831 default :
832- panic (& ValueError {"reflect.Value.Slice" , kind })
832+ panic (& ValueError {Method : "reflect.Value.Slice" , Kind : kind })
833833 }
834834
835835 if i < 0 || j < i || j > cap {
@@ -842,26 +842,26 @@ func (v Value) Slice(i, j int) Value {
842842func (v Value ) Slice3 (i , j , k int ) Value {
843843 var (
844844 cap int
845- typ Type
845+ typ * abi. Type
846846 s * js.Object
847847 )
848848 switch kind := v .kind (); kind {
849849 case Array :
850850 if v .flag & flagAddr == 0 {
851851 panic ("reflect.Value.Slice: slice of unaddressable array" )
852852 }
853- tt := ( * arrayType )( unsafe . Pointer ( v .typ ) )
854- cap = int (tt .len )
855- typ = SliceOf (tt .elem )
856- s = jsType ( typ ).New (v .object ())
853+ tt := v .typ (). ArrayType ( )
854+ cap = int (tt .Len )
855+ typ = SliceOf (toRType ( tt .Elem )). common ( )
856+ s = typ . JsType ( ).New (v .object ())
857857
858858 case Slice :
859- typ = v .typ
859+ typ = v .typ ()
860860 s = v .object ()
861861 cap = s .Get ("$capacity" ).Int ()
862862
863863 default :
864- panic (& ValueError {"reflect.Value.Slice3" , kind })
864+ panic (& ValueError {Method : "reflect.Value.Slice3" , Kind : kind })
865865 }
866866
867867 if i < 0 || j < i || k < j || k > cap {
@@ -888,12 +888,12 @@ func typedslicecopy(t *abi.Type, dst, src unsafeheader.Slice) int
888888func growslice (t * abi.Type , old unsafeheader.Slice , num int ) unsafeheader.Slice
889889
890890//gopherjs:new
891- func keyFor (t * rtype , key unsafe.Pointer ) (* js.Object , * js.Object ) {
891+ func keyFor (t * abi. Type , key unsafe.Pointer ) (* js.Object , * js.Object ) {
892892 kv := js .InternalObject (key )
893893 if kv .Get ("$get" ) != js .Undefined {
894894 kv = kv .Call ("$get" )
895895 }
896- k := jsType ( t .Key ()).Call ("keyFor" , kv )
896+ k := t .Key (). JsType ( ).Call ("keyFor" , kv )
897897 return kv , k
898898}
899899
@@ -907,17 +907,17 @@ func mapaccess(t *abi.Type, m, key unsafe.Pointer) unsafe.Pointer {
907907 if entry == js .Undefined {
908908 return nil
909909 }
910- return unsafe .Pointer (js .Global .Call ("$newDataPointer" , entry .Get ("v" ), jsType ( PtrTo ( t .Elem ()) )).Unsafe ())
910+ return unsafe .Pointer (js .Global .Call ("$newDataPointer" , entry .Get ("v" ), t .Elem (). JsPtrTo ( )).Unsafe ())
911911}
912912
913913//gopherjs:replace
914914func mapassign (t * abi.Type , m , key , val unsafe.Pointer ) {
915915 kv , k := keyFor (t , key )
916916 jsVal := js .InternalObject (val ).Call ("$get" )
917917 et := t .Elem ()
918- if et .Kind () == Struct {
919- newVal := jsType ( et ).Call ("zero" )
920- copyStruct (newVal , jsVal , et )
918+ if et .Kind () == abi . Struct {
919+ newVal := et . JsType ( ).Call ("zero" )
920+ abi . CopyStruct (newVal , jsVal , et )
921921 jsVal = newVal
922922 }
923923 entry := js .Global .Get ("Object" ).New ()
@@ -959,7 +959,7 @@ func mapdelete_faststr(t *abi.Type, m unsafe.Pointer, key string) {
959959
960960//gopherjs:replace
961961type hiter struct {
962- t Type
962+ t * abi. Type
963963 m * js.Object // Underlying map object.
964964 keys * js.Object
965965 i int
@@ -1020,7 +1020,7 @@ func mapiterkey(it *hiter) unsafe.Pointer {
10201020 // Record the key-value pair for later accesses.
10211021 it .last = kv
10221022 }
1023- return unsafe .Pointer (js .Global .Call ("$newDataPointer" , kv .Get ("k" ), jsType ( PtrTo ( it .t .Key ()) )).Unsafe ())
1023+ return unsafe .Pointer (js .Global .Call ("$newDataPointer" , kv .Get ("k" ), it .t .Key (). JsPtrTo ( )).Unsafe ())
10241024}
10251025
10261026//gopherjs:replace
@@ -1037,7 +1037,7 @@ func mapiterelem(it *hiter) unsafe.Pointer {
10371037 kv = it .m .Call ("get" , k )
10381038 it .last = kv
10391039 }
1040- return unsafe .Pointer (js .Global .Call ("$newDataPointer" , kv .Get ("v" ), jsType ( PtrTo ( it .t .Elem ()) )).Unsafe ())
1040+ return unsafe .Pointer (js .Global .Call ("$newDataPointer" , kv .Get ("v" ), it .t .Elem (). JsPtrTo ( )).Unsafe ())
10411041}
10421042
10431043//gopherjs:replace
0 commit comments