sourceloc

package
v2.0.0-beta.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package sourceloc contains some helpers for interacting with protoreflect.SourceLocation and protoreflect.SourcePath values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForExtendBlock

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL