go_above_118.go 552 B

1234567891011121314151617181920212223
  1. //+build go1.18
  2. package reflect2
  3. import (
  4. "unsafe"
  5. )
  6. // m escapes into the return value, but the caller of mapiterinit
  7. // doesn't let the return value escape.
  8. //go:noescape
  9. //go:linkname mapiterinit reflect.mapiterinit
  10. func mapiterinit(rtype unsafe.Pointer, m unsafe.Pointer, it *hiter)
  11. func (type2 *UnsafeMapType) UnsafeIterate(obj unsafe.Pointer) MapIterator {
  12. var it hiter
  13. mapiterinit(type2.rtype, *(*unsafe.Pointer)(obj), &it)
  14. return &UnsafeMapIterator{
  15. hiter: &it,
  16. pKeyRType: type2.pKeyRType,
  17. pElemRType: type2.pElemRType,
  18. }
  19. }