Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
bufdev committed Feb 7, 2024
1 parent a207178 commit 89c0eec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion private/pkg/protosource/option_extension_descriptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func isDescendantPath(descendant, ancestor []int32) bool {
return true
}

func (o *optionExtensionDescriptor) ForEachFieldDescriptor(fn func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
func (o *optionExtensionDescriptor) ForEachPresentOption(fn func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
// Note: This does not bother to handle unrecognized fields.
// Should not be a problem since descriptors models in the buf CLI codebase should have them
// all correctly parsed and known.
Expand Down
10 changes: 6 additions & 4 deletions private/pkg/protosource/protosource.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,12 @@ type OptionExtensionDescriptor interface {
// have a set value on this descriptor.
PresentExtensionNumbers() []int32

// ForEachFieldDescriptor iterates through all fields present in the options message invoking
// the callback for each one. If the callback returns false, it terminates the
// iteration and returns immediately.
ForEachFieldDescriptor(fn func(protoreflect.FieldDescriptor, protoreflect.Value) bool)
// ForEachPresentOption iterates through all options that have a set value on this
// descriptor, invoking fn for each present option.
//
// If fn returns false, the iteration is terminated and ForEachPresentOption
// immediately returns.
ForEachPresentOption(fn func(protoreflect.FieldDescriptor, protoreflect.Value) bool)
}

// Location defines source code info location information.
Expand Down

0 comments on commit 89c0eec

Please sign in to comment.