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