github.com/goplus/reflectx@v1.2.2/name_js.go (about) 1 //go:build js && !wasm 2 // +build js,!wasm 3 4 package reflectx 5 6 import ( 7 _ "unsafe" 8 ) 9 10 //go:linkname name_nameLen reflect.name.nameLen 11 func name_nameLen(name) int 12 13 //go:linkname name_isExported reflect.name.isExported 14 func name_isExported(name) bool 15 16 //go:linkname name_name reflect.name.name 17 func name_name(name) string 18 19 //go:linkname name_tag reflect.name.tag 20 func name_tag(name) string 21 22 //go:linkname name_pkgPath reflect.name.pkgPath 23 func name_pkgPath(name) string 24 25 //go:linkname name_setPkgPath reflect.name.setPkgPath 26 func name_setPkgPath(name, string) 27 28 type name struct { 29 bytes *byte 30 } 31 32 func (n name) isExported() bool { 33 return name_isExported(n) 34 } 35 36 func (n name) nameLen() int { 37 return name_nameLen(n) 38 } 39 40 func (n name) name() (s string) { 41 return name_name(n) 42 } 43 44 func (n name) tag() (s string) { 45 return name_tag(n) 46 } 47 48 func (n name) pkgPath() string { 49 return name_pkgPath(n) 50 } 51 52 func (n name) setPkgPath(pkgpath string) { 53 name_setPkgPath(n, pkgpath) 54 } 55 56 func newNameEx(n, tag string, exported bool, pkgpath bool) name { 57 return newName(n, tag, exported) 58 }