MCPcopy
hub / github.com/gopherjs/gopherjs / MakeSlice

Function MakeSlice

compiler/natives/src/reflect/reflect.go:144–159  ·  view source on GitHub ↗

gopherjs:replace

(typ Type, len, cap int)

Source from the content-addressed store, hash-verified

142
143//gopherjs:replace
144func MakeSlice(typ Type, len, cap int) Value {
145 if typ.Kind() != Slice {
146 panic("reflect.MakeSlice of non-slice type")
147 }
148 if len < 0 {
149 panic("reflect.MakeSlice: negative len")
150 }
151 if cap < 0 {
152 panic("reflect.MakeSlice: negative cap")
153 }
154 if len > cap {
155 panic("reflect.MakeSlice: len > cap")
156 }
157
158 return makeValue(toAbiType(typ), js.Global.Call("$makeSlice", jsType(typ), len, cap, js.InternalObject(func() *js.Object { return jsType(typ.Elem()).Call("zero") })), 0)
159}
160
161//gopherjs:replace
162func TypeOf(i any) Type {

Callers 2

cvtSliceArrayFunction · 0.85
callMethod · 0.85

Calls 7

InternalObjectFunction · 0.92
toAbiTypeFunction · 0.85
makeValueFunction · 0.70
jsTypeFunction · 0.70
KindMethod · 0.65
CallMethod · 0.45
ElemMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…