This commit is contained in:
6
vendor/google.golang.org/protobuf/internal/filedesc/editions.go
generated
vendored
6
vendor/google.golang.org/protobuf/internal/filedesc/editions.go
generated
vendored
@ -69,6 +69,12 @@ func unmarshalFeatureSet(b []byte, parent EditionFeatures) EditionFeatures {
|
||||
parent.IsDelimitedEncoded = v == genid.FeatureSet_DELIMITED_enum_value
|
||||
case genid.FeatureSet_JsonFormat_field_number:
|
||||
parent.IsJSONCompliant = v == genid.FeatureSet_ALLOW_enum_value
|
||||
case genid.FeatureSet_EnforceNamingStyle_field_number:
|
||||
// EnforceNamingStyle is enforced in protoc, languages other than C++
|
||||
// are not supposed to do anything with this feature.
|
||||
case genid.FeatureSet_DefaultSymbolVisibility_field_number:
|
||||
// DefaultSymbolVisibility is enforced in protoc, runtimes should not
|
||||
// inspect this value.
|
||||
default:
|
||||
panic(fmt.Sprintf("unkown field number %d while unmarshalling FeatureSet", num))
|
||||
}
|
||||
|
33
vendor/google.golang.org/protobuf/internal/filedesc/presence.go
generated
vendored
Normal file
33
vendor/google.golang.org/protobuf/internal/filedesc/presence.go
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright 2025 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package filedesc
|
||||
|
||||
import "google.golang.org/protobuf/reflect/protoreflect"
|
||||
|
||||
// UsePresenceForField reports whether the presence bitmap should be used for
|
||||
// the specified field.
|
||||
func UsePresenceForField(fd protoreflect.FieldDescriptor) (usePresence, canBeLazy bool) {
|
||||
switch {
|
||||
case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic():
|
||||
// Oneof fields never use the presence bitmap.
|
||||
//
|
||||
// Synthetic oneofs are an exception: Those are used to implement proto3
|
||||
// optional fields and hence should follow non-oneof field semantics.
|
||||
return false, false
|
||||
|
||||
case fd.IsMap():
|
||||
// Map-typed fields never use the presence bitmap.
|
||||
return false, false
|
||||
|
||||
case fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind:
|
||||
// Lazy fields always use the presence bitmap (only messages can be lazy).
|
||||
isLazy := fd.(interface{ IsLazy() bool }).IsLazy()
|
||||
return isLazy, isLazy
|
||||
|
||||
default:
|
||||
// If the field has presence, use the presence bitmap.
|
||||
return fd.HasPresence(), false
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user