Skip to content

Commit 648112a

Browse files
committed
fixed reflect.MakeChan
1 parent f2a211d commit 648112a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/natives/reflect/reflect.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,8 @@ func loadScalar(p unsafe.Pointer, n uintptr) uintptr {
351351
}
352352

353353
func makechan(typ *rtype, size uint64) (ch unsafe.Pointer) {
354-
return unsafe.Pointer(js.Global.Get("$Chan").New(size).Unsafe())
354+
ctyp := (*chanType)(unsafe.Pointer(typ))
355+
return unsafe.Pointer(js.Global.Get("$Chan").New(jsType(ctyp.elem), size).Unsafe())
355356
}
356357

357358
func makemap(t *rtype) (m unsafe.Pointer) {

0 commit comments

Comments
 (0)