Documentation ¶
Overview ¶
Package sourceloc contains some helpers for interacting with protoreflect.SourceLocation and protoreflect.SourcePath values.
Index ¶
- func ForExtendBlock(ext protoreflect.ExtensionDescriptor) protoreflect.SourceLocation
- func ForExtensionsStatement(msg protoreflect.MessageDescriptor, extensionRangeIndex int) protoreflect.SourceLocation
- func ForReservedNamesStatement(msg protoreflect.MessageDescriptor, reservedNameIndex int) protoreflect.SourceLocation
- func ForReservedRangesStatement(msg protoreflect.MessageDescriptor, reservedRangeIndex int) protoreflect.SourceLocation
- func IsSubpathOf(candidate, path protoreflect.SourcePath) bool
- func IsSubspanOf(candidate, loc protoreflect.SourceLocation) bool
- func IsZero(loc protoreflect.SourceLocation) bool
- func PathFor(desc protoreflect.Descriptor) protoreflect.SourcePath
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForExtendBlock ¶
func ForExtendBlock(ext protoreflect.ExtensionDescriptor) protoreflect.SourceLocation
ForExtendBlock returns the source code location of the "extend" block that contains the given extension.
func ForExtensionsStatement ¶
func ForExtensionsStatement(msg protoreflect.MessageDescriptor, extensionRangeIndex int) protoreflect.SourceLocation
ForExtensionsStatement returns the source code location of the "extensions" statement that defines the extension range at the given index. This corresponds to msg.ExtensionRanges().Get(extensionRangeIndex).
func ForReservedNamesStatement ¶
func ForReservedNamesStatement(msg protoreflect.MessageDescriptor, reservedNameIndex int) protoreflect.SourceLocation
ForReservedNamesStatement returns the source code location of the "reserved" statement that contains the reserved name at the given index. This corresponds to msg.ReservedNames().Get(reservedNameIndex).
func ForReservedRangesStatement ¶
func ForReservedRangesStatement(msg protoreflect.MessageDescriptor, reservedRangeIndex int) protoreflect.SourceLocation
ForReservedRangesStatement returns the source code location of the "reserved" statement that contains the reserved range at the given index. This corresponds to msg.ReservedRanges().Get(reservedRangeIndex).
func IsSubpathOf ¶
func IsSubpathOf(candidate, path protoreflect.SourcePath) bool
IsSubpathOf returns true if the given candidate is a subpath of the given path.
func IsSubspanOf ¶
func IsSubspanOf(candidate, loc protoreflect.SourceLocation) bool
IsSubspanOf returns true if the given candidate is a subspan (i.e. contained within) the given loc.
func IsZero ¶
func IsZero(loc protoreflect.SourceLocation) bool
IsZero returns true if loc is a zero-value SourceLocation.
func PathFor ¶
func PathFor(desc protoreflect.Descriptor) protoreflect.SourcePath
PathFor computes the source path for the given descriptor. It returns nil if the given descriptor is invalid and a path cannot be computed.
Types ¶
This section is empty.