mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-29 18:32:46 +00:00
encoding/protojson: use fd.HasPresence() for editions compatibility
This change was originally done by Mike Kruskal in Google-internal cl/515091827. Change-Id: I5d1588193663249964cf8bc9b9fe9f61d29c98a6 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/606756 Reviewed-by: Christian Höppner <hoeppi@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
94ecbc2616
commit
b643888146
@ -216,9 +216,7 @@ func (m unpopulatedFieldRanger) Range(f func(protoreflect.FieldDescriptor, proto
|
||||
}
|
||||
|
||||
v := m.Get(fd)
|
||||
isProto2Scalar := fd.Syntax() == protoreflect.Proto2 && fd.Default().IsValid()
|
||||
isSingularMessage := fd.Cardinality() != protoreflect.Repeated && fd.Message() != nil
|
||||
if isProto2Scalar || isSingularMessage {
|
||||
if fd.HasPresence() {
|
||||
if m.skipNull {
|
||||
continue
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user