stubs_latest.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //go:build go1.24
  2. // +build go1.24
  3. /*
  4. * Copyright 2021 ByteDance Inc.
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. package resolver
  19. import (
  20. _ `encoding/json`
  21. `reflect`
  22. _ `unsafe`
  23. )
  24. type StdField struct {
  25. name string
  26. nameBytes []byte
  27. nameNonEsc string
  28. nameEscHTML string
  29. tag bool
  30. index []int
  31. typ reflect.Type
  32. omitEmpty bool
  33. omitZero bool
  34. isZero func(reflect.Value) bool
  35. quoted bool
  36. encoder func()
  37. }
  38. type StdStructFields struct {
  39. list []StdField
  40. nameIndex map[string]*StdField
  41. byFoldedName map[string]*StdField
  42. }
  43. //go:noescape
  44. //go:linkname typeFields encoding/json.typeFields
  45. func typeFields(_ reflect.Type) StdStructFields
  46. func handleOmitZero(fv StdField, fm *FieldMeta) {
  47. if fv.omitZero {
  48. fm.Opts |= F_omitzero
  49. fm.IsZero = fv.isZero
  50. }
  51. }