Documentation
¶
Overview ¶
Package ir defines the intermediate representation used by Protocompile.
This package provides both the IR, and the lowering machinery for that IR. The IR is intended to provide a richer and easier to manipulate structure compared to a FileDescriptorProto. This structure is used for name resolution, type checking, tag number validation, and other semantic operations.
Index ¶
- Constants
- func CanonicalizeFilePath(path string) string
- func DedupExportedSymbols(r *report.Report, files ...*File)
- func DedupExtensions(r *report.Report, files ...*File)
- func GetRef[T ~id.Node[T, *File, Raw], Raw any](base *File, r Ref[T]) T
- func NeedsNullMask(ty Type) bool
- func OptionTargets() iter.Seq[OptionTarget]
- func TopoSort(files []*File) iter.Seq[*File]
- type Annotation
- func (a Annotation) AST() ast.DeclAnnotation
- func (a Annotation) Annotations() seq.Indexer[AnnotationUse]
- func (a Annotation) FullName() FullName
- func (a Annotation) InternedFullName() intern.ID
- func (a Annotation) InternedName() intern.ID
- func (a Annotation) Name() string
- func (a Annotation) Params() seq.Indexer[AnnotationParam]
- func (a Annotation) ResolveEnumValueDefault(path ast.Path) Member
- type AnnotationArgBinding
- type AnnotationEnumValue
- type AnnotationFunctionCall
- type AnnotationParam
- func (p AnnotationParam) AST() ast.DeclAnnotationParam
- func (p AnnotationParam) Annotation() Annotation
- func (p AnnotationParam) Default() ast.ExprAny
- func (p AnnotationParam) DefaultCalls() []AnnotationFunctionCall
- func (p AnnotationParam) DefaultEnumValues() []AnnotationEnumValue
- func (p AnnotationParam) DefaultSpan() source.Span
- func (p AnnotationParam) HasDefault() bool
- func (p AnnotationParam) InternedName() intern.ID
- func (p AnnotationParam) IsAny() bool
- func (p AnnotationParam) IsExpression() bool
- func (p AnnotationParam) IsScalar() bool
- func (p AnnotationParam) Name() string
- func (p AnnotationParam) Scalar() predeclared.Name
- func (p AnnotationParam) TypeName() string
- func (p AnnotationParam) UserType() Type
- type AnnotationUse
- func (u AnnotationUse) AST() ast.DeclAnnotationUse
- func (u AnnotationUse) ArgBindings() []AnnotationArgBinding
- func (u AnnotationUse) ExtractCalls(arg ast.AnnotationUseArg) []AnnotationFunctionCall
- func (u AnnotationUse) ExtractEnumValues(arg ast.AnnotationUseArg) []AnnotationEnumValue
- func (u AnnotationUse) MessageLiteralArg(arg ast.AnnotationUseArg) MessageValue
- func (u AnnotationUse) MessageLiteralElem(elem ast.ExprAny) MessageValue
- func (u AnnotationUse) ResolveEnumValueArg(path ast.Path) Member
- func (u AnnotationUse) Target() Annotation
- func (u AnnotationUse) TargetRef() Ref[Symbol]
- type ArgLiteralKind
- type ArgMember
- type Element
- func (e Element) AST() ast.ExprAny
- func (e Element) AsBool() (value, ok bool)
- func (e Element) AsEnum() Member
- func (e Element) AsFloat() (float64, bool)
- func (e Element) AsInt() (int64, bool)
- func (e Element) AsMessage() MessageValue
- func (e Element) AsString() (string, bool)
- func (e Element) AsUInt() (uint64, bool)
- func (e Element) Field() Member
- func (e Element) IsZeroValue() bool
- func (e Element) Type() Type
- func (e Element) Value() Value
- func (e Element) ValueNodeIndex() int
- type ErrCycle
- type Extend
- type Feature
- type FeatureInfo
- func (f FeatureInfo) Default(edition syntax.Syntax) Value
- func (f FeatureInfo) Deprecated() syntax.Syntax
- func (f FeatureInfo) DeprecationWarning() string
- func (f FeatureInfo) Introduced() syntax.Syntax
- func (f FeatureInfo) IsDeprecated(in syntax.Syntax) bool
- func (f FeatureInfo) IsIntroduced(in syntax.Syntax) bool
- func (f FeatureInfo) IsRemoved(in syntax.Syntax) bool
- func (f FeatureInfo) Removed() syntax.Syntax
- type FeatureSet
- type File
- func (f *File) AST() *ast.File
- func (f *File) AllExtends() seq.Indexer[Extend]
- func (f *File) AllExtensions() seq.Indexer[Member]
- func (f *File) AllMembers() iter.Seq[Member]
- func (f *File) AllTypes() seq.Indexer[Type]
- func (f *File) Annotations() seq.Indexer[Annotation]
- func (f *File) Deprecated() Value
- func (f *File) ExportedSymbols() seq.Indexer[Symbol]
- func (f *File) Extends() seq.Indexer[Extend]
- func (f *File) Extensions() seq.Indexer[Member]
- func (f *File) FeatureSet() FeatureSet
- func (f *File) FindSymbol(fqn FullName) Symbol
- func (f *File) FromID(id uint64, want any) any
- func (f *File) Functions() seq.Indexer[Function]
- func (f *File) ImportFor(that *File) Import
- func (f *File) Imports() seq.Indexer[Import]
- func (f *File) InternedPackage() intern.ID
- func (f *File) InternedPath() intern.ID
- func (f *File) IsDescriptorProto() bool
- func (f *File) NullMaskImport() *File
- func (f *File) NullMasks() bool
- func (f *File) Options() MessageValue
- func (f *File) Package() FullName
- func (f *File) Path() string
- func (f *File) Services() seq.Indexer[Service]
- func (f *File) Symbols() seq.Indexer[Symbol]
- func (f *File) Syntax() syntax.Syntax
- func (f *File) TransitiveImports() seq.Indexer[Import]
- func (f *File) TypeAliases() seq.Indexer[TypeAlias]
- func (f *File) Types() seq.Indexer[Type]
- type FullName
- func (n FullName) Absolute() bool
- func (n FullName) Append(names ...string) FullName
- func (n FullName) Components() iter.Seq[string]
- func (n FullName) First() string
- func (n FullName) IsIdent() bool
- func (n FullName) Name() string
- func (n FullName) Parent() FullName
- func (n FullName) ToAbsolute() FullName
- func (n FullName) ToRelative() FullName
- type Function
- func (f Function) AST() ast.DeclFunction
- func (f Function) Annotations() seq.Indexer[AnnotationUse]
- func (f Function) FullName() FullName
- func (f Function) InternedFullName() intern.ID
- func (f Function) InternedName() intern.ID
- func (f Function) Name() string
- func (f Function) Options() seq.Indexer[FunctionOption]
- func (f Function) Params() seq.Indexer[FunctionParam]
- type FunctionOption
- type FunctionParam
- type Import
- type Importer
- type Member
- func (m Member) AST() ast.DeclDef
- func (m Member) Annotations() seq.Indexer[AnnotationUse]
- func (m Member) AsTagRange() TagRange
- func (m Member) CanTarget(target OptionTarget) bool
- func (m Member) Container() Type
- func (m Member) Deprecated() Value
- func (m Member) Element() Type
- func (m Member) Extend() Extend
- func (m Member) FDPType() descriptorpb.FieldDescriptorProto_Type
- func (m Member) FeatureInfo() FeatureInfo
- func (m Member) FeatureSet() FeatureSet
- func (m Member) FullName() FullName
- func (m Member) InternedFullName() intern.ID
- func (m Member) InternedJSONName() intern.ID
- func (m Member) InternedName() intern.ID
- func (m Member) InternedScope() intern.ID
- func (m Member) IsEnumValue() bool
- func (m Member) IsExtension() bool
- func (m Member) IsGroup() bool
- func (m Member) IsMap() bool
- func (m Member) IsMessageField() bool
- func (m Member) IsPacked() bool
- func (m Member) IsRepeated() bool
- func (m Member) IsSingular() bool
- func (m Member) IsSynthetic() bool
- func (m Member) IsUnicode() bool
- func (m Member) JSONName() string
- func (m Member) Name() string
- func (m Member) Number() int32
- func (m Member) Oneof() Oneof
- func (m Member) Options() MessageValue
- func (m Member) Parent() Type
- func (m Member) Presence() presence.Kind
- func (m Member) PseudoOptions() PseudoFields
- func (m Member) Scope() FullName
- func (m Member) SyntheticOneofName() string
- func (m Member) Targets() iter.Seq[OptionTarget]
- func (m Member) TypeAST() ast.TypeAny
- func (m Member) TypeAliasChain() seq.Indexer[TypeAlias]
- type MessageValue
- func (v MessageValue) AsValue() Value
- func (v MessageValue) Concrete() MessageValue
- func (v MessageValue) Field(field Member) Value
- func (v MessageValue) Fields() iter.Seq[Value]
- func (v MessageValue) IsEmpty() bool
- func (v MessageValue) Marshal(buf []byte, r *report.Report) []byte
- func (v MessageValue) Type() Type
- func (v MessageValue) TypeURL() string
- type Method
- func (m Method) AST() ast.DeclDef
- func (m Method) Annotations() seq.Indexer[AnnotationUse]
- func (m Method) Deprecated() Value
- func (m Method) FeatureSet() FeatureSet
- func (m Method) FullName() FullName
- func (m Method) Input() (ty Type, stream bool)
- func (m Method) InternedFullName() intern.ID
- func (m Method) InternedName() intern.ID
- func (m Method) Name() string
- func (m Method) Options() MessageValue
- func (m Method) Output() (ty Type, stream bool)
- func (m Method) Service() Service
- type Oneof
- func (o Oneof) AST() ast.DeclDef
- func (o Oneof) Annotations() seq.Indexer[AnnotationUse]
- func (o Oneof) Container() Type
- func (o Oneof) FeatureSet() FeatureSet
- func (o Oneof) FullName() FullName
- func (o Oneof) Index() int
- func (o Oneof) InternedFullName() intern.ID
- func (o Oneof) InternedName() intern.ID
- func (o Oneof) Members() seq.Indexer[Member]
- func (o Oneof) Name() string
- func (o Oneof) Options() MessageValue
- func (o Oneof) Parent() Type
- type OptionTarget
- type PseudoFields
- type PxfNumber
- type Ref
- type ReservedName
- type ReservedRange
- func (r ReservedRange) AST() ast.ExprAny
- func (r ReservedRange) AsTagRange() TagRange
- func (r ReservedRange) DeclAST() ast.DeclRange
- func (r ReservedRange) FeatureSet() FeatureSet
- func (r ReservedRange) ForExtensions() bool
- func (r ReservedRange) Options() MessageValue
- func (r ReservedRange) Range() (start, end int32)
- type Service
- func (s Service) AST() ast.DeclDef
- func (s Service) Annotations() seq.Indexer[AnnotationUse]
- func (s Service) Deprecated() Value
- func (s Service) FeatureSet() FeatureSet
- func (s Service) FullName() FullName
- func (s Service) InternedFullName() intern.ID
- func (s Service) InternedName() intern.ID
- func (s Service) Methods() seq.Indexer[Method]
- func (s Service) Name() string
- func (s Service) Options() MessageValue
- type Session
- type Symbol
- func (s Symbol) AsAnnotation() Annotation
- func (s Symbol) AsFunction() Function
- func (s Symbol) AsMember() Member
- func (s Symbol) AsMethod() Method
- func (s Symbol) AsOneof() Oneof
- func (s Symbol) AsService() Service
- func (s Symbol) AsType() Type
- func (s Symbol) AsTypeAlias() TypeAlias
- func (s Symbol) Definition() source.Span
- func (s Symbol) Deprecated() Value
- func (s Symbol) FeatureSet() FeatureSet
- func (s Symbol) FullName() FullName
- func (s Symbol) Import(in *File) Import
- func (s Symbol) InternedFullName() intern.ID
- func (s Symbol) Kind() SymbolKind
- func (s Symbol) Visible(in *File, allowOptions bool) bool
- type SymbolKind
- type TagRange
- type Type
- func (t Type) AST() ast.DeclDef
- func (t Type) AbsoluteRange() (start, end int32)
- func (t Type) AllRanges() seq.Indexer[ReservedRange]
- func (t Type) AllowsAlias() bool
- func (t Type) Annotations() seq.Indexer[AnnotationUse]
- func (t Type) CarrierScalar() predeclared.Name
- func (t Type) Deprecated() Value
- func (t Type) EntryFields() (key, value Member)
- func (t Type) Extends() seq.Indexer[Extend]
- func (t Type) ExtensionRanges() seq.Indexer[ReservedRange]
- func (t Type) Extensions() seq.Indexer[Member]
- func (t Type) FeatureSet() FeatureSet
- func (t Type) FullName() FullName
- func (t Type) GroupField() Member
- func (t Type) InternedFullName() intern.ID
- func (t Type) InternedName() intern.ID
- func (t Type) InternedScope() intern.ID
- func (t Type) IsAny() bool
- func (t Type) IsClosedEnum() bool
- func (t Type) IsEnum() bool
- func (t Type) IsExported() (exported, explicit bool)
- func (t Type) IsMapEntry() bool
- func (t Type) IsMessage() bool
- func (t Type) IsMessageSet() bool
- func (t Type) IsPackable() bool
- func (t Type) IsPredeclared() bool
- func (t Type) MapField() Member
- func (t Type) MemberByInternedName(name intern.ID) Member
- func (t Type) MemberByName(name string) Member
- func (t Type) MemberByNumber(number int32) Member
- func (t Type) Members() seq.Indexer[Member]
- func (t Type) Name() string
- func (t Type) Nested() seq.Indexer[Type]
- func (t Type) OccupiedRanges() iter.Seq2[[2]int32, seq.Indexer[TagRange]]
- func (t Type) Oneofs() seq.Indexer[Oneof]
- func (t Type) Options() MessageValue
- func (t Type) Parent() Type
- func (t Type) Predeclared() predeclared.Name
- func (t Type) PxfNumber() PxfNumber
- func (t Type) Ranges(number int32) iter.Seq[TagRange]
- func (t Type) ReservedNames() seq.Indexer[ReservedName]
- func (t Type) ReservedRanges() seq.Indexer[ReservedRange]
- func (t Type) Scope() FullName
- type TypeAlias
- func (t TypeAlias) AST() ast.DeclType
- func (t TypeAlias) Annotations() seq.Indexer[AnnotationUse]
- func (t TypeAlias) BaseTypeFQN() string
- func (t TypeAlias) BaseTypeName() string
- func (t TypeAlias) FullName() FullName
- func (t TypeAlias) InternedFullName() intern.ID
- func (t TypeAlias) InternedName() intern.ID
- func (t TypeAlias) Name() string
- type Value
- func (v Value) AsBool() (value, ok bool)
- func (v Value) AsEnum() Member
- func (v Value) AsFloat() (float64, bool)
- func (v Value) AsInt() (int64, bool)
- func (v Value) AsMessage() MessageValue
- func (v Value) AsString() (string, bool)
- func (v Value) AsUInt() (uint64, bool)
- func (v Value) Container() MessageValue
- func (v Value) Elements() seq.Indexer[Element]
- func (v Value) Field() Member
- func (v Value) IsTopLevel() bool
- func (v Value) IsZeroValue() bool
- func (v Value) KeyAST() ast.ExprAny
- func (v Value) KeyASTs() seq.Indexer[ast.ExprAny]
- func (v Value) Marshal(buf []byte, r *report.Report) []byte
- func (v Value) OptionPaths() seq.Indexer[ast.Path]
- func (v Value) OptionSpan() source.Spanner
- func (v Value) OptionSpans() seq.Indexer[source.Spanner]
- func (v Value) ValueAST() ast.ExprAny
- func (v Value) ValueASTs() seq.Indexer[ast.ExprAny]
Constants ¶
const ( // NullMaskName is the name of the generated field. NullMaskName = "_null" // NullMaskJSONName is its JSON name, as protoc derives it from // [NullMaskName]. NullMaskJSONName = "Null" // NullMaskNumber is the field number protowire claims for the mask in // every message that gets one: the highest legal field number, which // hand-numbered fields almost never reach. It is fixed so that no // schema change can move the mask. NullMaskNumber int32 = 536870911 // NullMaskTypeName is the mask's message type. NullMaskTypeName FullName = "google.protobuf.FieldMask" // NullMaskImport is the file that declares [NullMaskTypeName]. NullMaskImport = "google/protobuf/field_mask.proto" )
The `_null` mask (protocompile#248). PXF decoders record the paths of fields a document sets to null in a message's `_null` FieldMask, and encoders write those fields back as `field = null`; without the mask a null and an absent field are the same on the wire. With masks enabled, lowering adds the field to every message that has a field able to hold null, so a schema author does not have to declare it.
const DescriptorProtoPath = "google/protobuf/descriptor.proto"
const MaxNumericLiteralDigits = 4096
MaxNumericLiteralDigits is protowire's hardening limit on the digit count of a numeric literal and on the magnitude of pxf.Decimal.scale on the wire (protowire HARDENING.md, "Mandatory limits"; draft -01 § Mandatory Limits as amended by trendvidia/protowire#278). It is a decoder limit, and it binds the compiler through what the compiler emits: a binder renders a pxf.BigInt or pxf.Decimal default back into a PXF literal and refuses one past the cap, so a carrier beyond it is a schema no decoder accepts. It lives here, with the rest of the carrier semantics, rather than in the generic big-number helpers.
Variables ¶
This section is empty.
Functions ¶
func CanonicalizeFilePath ¶
CanonicalizeFilePath puts a file path into canonical form.
This function is exported so that all code depending on this module can make sure paths are consistently canonicalized.
func DedupExportedSymbols ¶
DedupExportedSymbols takes a report and the given *[File]s and checks for duplicate exported symbols based on FullName across the files.
Diagnostics are provided only for the highest level of duplication. For example, given the following files and content:
-- a1.proto --
syntax = "proto3";
package a;
message Foo {
optional string bar = 1;
}
-- a2.proto --
syntax = "proto3";
package a;
message Foo {
optional string bar = 1;
}
A diagnostic for the duplication of `a.Foo` would be surfaced, but it would be redundant to surface diagnostics for `a.Foo.bar`..
func DedupExtensions ¶
DedupExtensionTags takes a report and the given *[File]s and checks for duplicate tags for the same extendee. This ensures that a single tag is only used in a single extension across the given files.
func NeedsNullMask ¶ added in v0.35.0
NeedsNullMask reports whether lowering with masks enabled adds a `_null` field to ty. It does not consult File.NullMasks; callers check the file first.
func OptionTargets ¶
func OptionTargets() iter.Seq[OptionTarget]
OptionTargets returns an iterator over all of the possible valid targets, which excludes OptionTargetInvalid.
Types ¶
type Annotation ¶
type Annotation id.Node[Annotation, *File, *rawAnnotation]
Annotation is an `annotation` declaration introduced by the Protowire Schema Extensions (PSE) grammar — see ast.DeclAnnotation.
Annotation declarations name a metadata attachment that use sites reference via `@name(args)` syntax (see ast.DeclAnnotationUse). They live in the file's exported symbol table under SymbolKindAnnotation so cross-file resolution works the same way it does for `message` and `service`.
This is Phase B1 scope: symbol registration only. Subsequent phases will add use-site name resolution, argument type-checking against the parameter signature, and FDP emission via the universal annotation carrier extension.
func (Annotation) AST ¶
func (a Annotation) AST() ast.DeclAnnotation
AST returns the declaration for this annotation, if known.
func (Annotation) Annotations ¶
func (a Annotation) Annotations() seq.Indexer[AnnotationUse]
Annotations returns the annotation use sites attached to this declaration (trailing form: `annotation foo @bar @baz;`). See Type.Annotations for the resolution model.
func (Annotation) FullName ¶
func (a Annotation) FullName() FullName
FullName returns this annotation's fully-qualified name.
func (Annotation) InternedFullName ¶
func (a Annotation) InternedFullName() intern.ID
InternedFullName returns the intern ID for Annotation.FullName.
func (Annotation) InternedName ¶
func (a Annotation) InternedName() intern.ID
InternedName returns the intern ID for Annotation.FullName().Name().
func (Annotation) Name ¶
func (a Annotation) Name() string
Name returns this annotation's declared name, i.e. the last component of its full name.
func (Annotation) Params ¶
func (a Annotation) Params() seq.Indexer[AnnotationParam]
Params returns the parameters of this annotation declaration.
func (Annotation) ResolveEnumValueDefault ¶
func (a Annotation) ResolveEnumValueDefault(path ast.Path) Member
ResolveEnumValueDefault resolves a qualified-identifier default expression of one of this annotation's parameters as an enum-value reference, relative to the declaration's own scope. Returns a zero Member when the name does not resolve to an enum value.
Like AnnotationUse.ResolveEnumValueArg, this resolution is quiet; the B3 defaults validator performs the same resolution with diagnostics.
type AnnotationArgBinding ¶
type AnnotationArgBinding struct {
Arg ast.AnnotationUseArg
Param AnnotationParam
}
AnnotationArgBinding pairs one use-site argument with the parameter of the resolved target Annotation that it binds.
Positional arguments bind parameters left to right; named arguments bind the parameter with the matching name. Param is zero when the argument does not bind anything — an excess positional argument or an unknown name — in which case the B3 validation pass has emitted a diagnostic.
type AnnotationEnumValue ¶ added in v0.36.0
AnnotationEnumValue is one enum value reference in an expression- classified annotation argument (RFC-001 §5.4, §8.1): its canonical spelling and the enum value it resolved to.
type AnnotationFunctionCall ¶
type AnnotationFunctionCall struct {
// The resolved function declaration.
Target Function
// The call site's arity: its count of top-level commas plus one,
// or zero for empty parentheses.
Arity int
// The call site's source span (the identifier through the closing
// parenthesis), for diagnostics and source-map anchoring.
Span source.Span
}
AnnotationFunctionCall is one function-call site extracted from an expression-classified annotation argument, per RFC-001 §8.1: a maximal qualified identifier immediately followed by `(...)` whose name resolves to a visible `function` declaration.
type AnnotationParam ¶
type AnnotationParam id.Node[AnnotationParam, *File, *rawAnnotationParam]
AnnotationParam is a single parameter of an Annotation declaration — see ast.DeclAnnotationParam.
Parameters carry a name, a declared type, and an optional default expression. Phase B1 stores the AST link and the parameter name; type-resolution into [TypeAny] and default-value lowering land in later phases together with use-site type-checking.
func (AnnotationParam) AST ¶
func (p AnnotationParam) AST() ast.DeclAnnotationParam
AST returns the declaration for this annotation parameter, if known.
func (AnnotationParam) Annotation ¶
func (p AnnotationParam) Annotation() Annotation
Annotation returns the annotation declaration that this parameter belongs to.
func (AnnotationParam) Default ¶
func (p AnnotationParam) Default() ast.ExprAny
Default returns the default-value expression syntactically attached to this parameter (e.g. the `"hi"` in `annotation foo(x: string = "hi")`). Returns a zero ast.ExprAny when the parameter has no default — callers should check `defaultExpr.IsZero()` before lowering.
The expression has been shape-checked by the parser's narrow annotation-argument legalize pass and type-checked by the resolution pass — see [validateAnnotationParamDefaults].
func (AnnotationParam) DefaultCalls ¶ added in v0.36.0
func (p AnnotationParam) DefaultCalls() []AnnotationFunctionCall
DefaultCalls is AnnotationUse.ExtractCalls for an `expression`-typed parameter's default, whose names resolve from the annotation declaration's scope.
func (AnnotationParam) DefaultEnumValues ¶ added in v0.36.0
func (p AnnotationParam) DefaultEnumValues() []AnnotationEnumValue
DefaultEnumValues is AnnotationUse.ExtractEnumValues for an `expression`-typed parameter's default, whose names resolve from the annotation declaration's scope.
func (AnnotationParam) DefaultSpan ¶ added in v0.36.0
func (p AnnotationParam) DefaultSpan() source.Span
DefaultSpan returns the source of an `expression`-typed parameter's captured default (RFC-001 §5.1), or zero.
func (AnnotationParam) HasDefault ¶ added in v0.36.0
func (p AnnotationParam) HasDefault() bool
HasDefault reports whether the parameter declares a default value. An `expression`-typed default that is an engine-expression fragment has a zero AnnotationParam.Default, so ask this instead.
func (AnnotationParam) InternedName ¶
func (p AnnotationParam) InternedName() intern.ID
InternedName returns the intern ID for AnnotationParam.Name.
func (AnnotationParam) IsAny ¶
func (p AnnotationParam) IsAny() bool
IsAny reports whether the parameter's declared type is the special PSE pseudo-type `any` (accepts any literal-shaped argument).
func (AnnotationParam) IsExpression ¶
func (p AnnotationParam) IsExpression() bool
IsExpression reports whether the parameter's declared type is the special PSE pseudo-type `expression`: a rule in the RFC-001 §5.4 language, kept as source text and checked by the compiler for syntax, names, builtin arity and a visibly non-boolean result.
func (AnnotationParam) IsScalar ¶
func (p AnnotationParam) IsScalar() bool
IsScalar reports whether the parameter's declared type resolved to a predeclared scalar (string, int32, etc.).
func (AnnotationParam) Name ¶
func (p AnnotationParam) Name() string
Name returns this parameter's declared name.
func (AnnotationParam) Scalar ¶
func (p AnnotationParam) Scalar() predeclared.Name
Scalar returns the predeclared scalar type for this parameter, or predeclared.Unknown when the parameter's type is not a scalar. Pair with AnnotationParam.IsScalar to disambiguate "type resolved to a non-scalar" from "predeclared.Unknown is the type".
func (AnnotationParam) TypeName ¶
func (p AnnotationParam) TypeName() string
TypeName returns the literal text of the parameter's declared type, e.g. "string", "expression", or "myco.SomeMessage". Useful for diagnostics — see AnnotationParam.IsScalar, AnnotationParam.IsExpression, AnnotationParam.IsAny, and AnnotationParam.UserType for the resolved classification.
type AnnotationUse ¶
type AnnotationUse id.Node[AnnotationUse, *File, *rawAnnotationUse]
AnnotationUse is a single `@name(args)` annotation use site — see ast.DeclAnnotationUse. Use sites are attached to a carrier declaration via that carrier's `Annotations()` accessor (e.g. Type.Annotations, Member.Annotations, Service.Annotations).
As of Phase B2, a use site carries its source AST link plus the resolved Annotation (or a zero Ref when name resolution failed — the diagnostic is emitted at resolve time). The argument list is not yet materialised into IR values: that pairs with the signature-aware type-check in Phase B3.
func (AnnotationUse) AST ¶
func (u AnnotationUse) AST() ast.DeclAnnotationUse
AST returns the use-site syntax for this annotation use.
func (AnnotationUse) ArgBindings ¶
func (u AnnotationUse) ArgBindings() []AnnotationArgBinding
ArgBindings pairs this use site's arguments with the target annotation's parameters, in argument source order.
Returns bindings with a zero Param for every argument when the use site's name did not resolve.
func (AnnotationUse) ExtractCalls ¶
func (u AnnotationUse) ExtractCalls(arg ast.AnnotationUseArg) []AnnotationFunctionCall
ExtractCalls scans an expression-classified argument's captured token range for function-call sites and resolves each against the visible `function` declarations, per RFC-001 §8.1.
Extraction is complete with respect to declared functions: every maximal `qualifiedIdent (` occurrence whose name resolves (relative to the use site's scope) is returned, including calls nested inside other calls' argument lists. Names that do not resolve are not returned; they must be RFC-001 §5.4 builtins, and validateExpressionLanguage diagnoses those that are not.
Resolution is quiet; arity verification against the declaration is the B3 validation pass's job.
func (AnnotationUse) ExtractEnumValues ¶ added in v0.36.0
func (u AnnotationUse) ExtractEnumValues(arg ast.AnnotationUseArg) []AnnotationEnumValue
ExtractEnumValues returns the enum value references in an expression-classified argument, once per distinct spelling in source order, each resolved from the use site's scope as an enum-typed argument is. References that do not resolve are left out; the expression-language check diagnoses them. A capture that does not parse has none.
func (AnnotationUse) MessageLiteralArg ¶
func (u AnnotationUse) MessageLiteralArg(arg ast.AnnotationUseArg) MessageValue
MessageLiteralArg returns the evaluated message value for a message-literal argument, recorded by the B3 validation pass. Returns a zero MessageValue when the argument is not a message literal or its evaluation failed.
func (AnnotationUse) MessageLiteralElem ¶ added in v0.22.0
func (u AnnotationUse) MessageLiteralElem(elem ast.ExprAny) MessageValue
MessageLiteralElem returns the evaluated message value for a typed message-literal list element, recorded by the B3 validation pass. Returns a zero MessageValue when the element is not a message literal or its evaluation failed.
func (AnnotationUse) ResolveEnumValueArg ¶
func (u AnnotationUse) ResolveEnumValueArg(path ast.Path) Member
ResolveEnumValueArg resolves a qualified-identifier argument as an enum-value reference, relative to this use site's lexical scope. Returns a zero Member when the name does not resolve to an enum value.
This resolution is quiet: no diagnostics are emitted. The B3 validation pass performs the same resolution with diagnostics; this accessor exists so descriptor production can recover the resolved value without re-running validation.
func (AnnotationUse) Target ¶
func (u AnnotationUse) Target() Annotation
Target returns the Annotation this use site resolves to. Returns a zero Annotation when name resolution failed (in which case the resolve pass already emitted a diagnostic).
func (AnnotationUse) TargetRef ¶
func (u AnnotationUse) TargetRef() Ref[Symbol]
TargetRef returns the raw Ref for the resolved target symbol. Useful for callers that want to detect resolution failures (zero ref) without going through the Annotation accessor.
type ArgLiteralKind ¶ added in v0.31.0
type ArgLiteralKind int
ArgLiteralKind is the type an annotation argument carries on its own, before any target is considered.
const ( // ArgLiteralNone is a shape this rule does not decide: an enum // reference, a message literal, a list. ArgLiteralNone ArgLiteralKind = iota ArgLiteralInt // A number written without a point or an exponent. ArgLiteralFloat // A number written with either. ArgLiteralString ArgLiteralBool )
func ArgLiteralKindOf ¶ added in v0.31.0
func ArgLiteralKindOf(tok token.Token) ArgLiteralKind
ArgLiteralKindOf classifies a scalar literal token by how it is WRITTEN, which is what RFC-001 means by the argument carrying its own typing. Boolean arguments are identifier paths rather than literal tokens, so callers classify those themselves.
token.NumberToken.IsFloat is the spelling test: a `.` or an exponent makes a float. It did not count a positive exponent until #191, which is why this briefly needed a second predicate of its own.
func (ArgLiteralKind) String ¶ added in v0.31.0
func (k ArgLiteralKind) String() string
String names the literal's own type as an author wrote it.
type ArgMember ¶ added in v0.31.0
type ArgMember int
ArgMember names the AnnotationArg oneof member a converted argument lands in.
func ConvertArgKind ¶ added in v0.31.0
func ConvertArgKind(kind ArgLiteralKind, target predeclared.Name, pxf PxfNumber) (ArgMember, bool)
ConvertArgKind reports which member a literal of kind lands in once converted to target, and whether such a conversion exists.
target is predeclared.Unknown when there is nothing to convert to: an annotation on a message, a service or a file, or on a member whose type is a message with no scalar reading. The literal's own type then stands, which is what RFC-001 means by the argument carrying its own typing.
A false second return is a KIND mismatch and is always an error — a string is not a number however it is spelled. Range and integrality are separate questions, asked only once the kind fits, because they depend on the value rather than on how it was written.
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
Element is an element within a Value.
This exists because array values contain multiple non-array elements; this type provides uniform access to such elements. See Value.Elements.
func (Element) AsBool ¶
AsBool returns the bool value of this element.
Returns ok == false if this is not a bool.
func (Element) AsEnum ¶
AsEnum returns the value of this element as a known enum value.
Returns zero if this is not an enum or if the enum value is out of range.
func (Element) AsFloat ¶
AsFloat returns the value of this element as a floating-point number.
Returns false if this is not a float.
func (Element) AsInt ¶
AsInt returns the value of this element as a signed integer.
Returns false if this is not a signed integer (enums are included as signed integers).
func (Element) AsMessage ¶
func (e Element) AsMessage() MessageValue
AsMessage returns the value of this element as a message literal.
Returns the zero value if this is not a message.
func (Element) AsString ¶
AsString returns the value of this element as a string.
Returns false if this is not a string.
func (Element) AsUInt ¶
AsUInt returns the value of this element as an unsigned integer.
Returns false if this is not an unsigned integer.
func (Element) Field ¶
Field returns the field this value sets, which includes the value's type information.
func (Element) IsZeroValue ¶
IsZeroValue returns whether this element contains the zero value for its type.
Always returns false for repeated or message-typed fields.
func (Element) Type ¶
Type returns the type of this element.
Note that this may be distinct from Member.Element. In the case that this is a google.protobuf.Any-typed field, this function will return the concrete type if known, rather than Any.
func (Element) ValueNodeIndex ¶
ValueNodeIndex returns the index into Value.ValueASTs for this element's contributing expression. This can be used to obtain other ASTs related to this element, e.g.
key := e.Value().MessageKeys().At(e.ValueNodeIndex())
If the element is empty, this returns -1.
type ErrCycle ¶
type ErrCycle = cycle.Error[ast.DeclImport]
ErrCycle is returned by an Importer when encountering an import cycle.
type Extend ¶
Extend represents an extend block associated with some extension field.
func (Extend) Extensions ¶
Extensions returns the extensions declared in this block.
func (Extend) InternedScope ¶
InternedScope returns the intern ID for Extend.Scope.
type Feature ¶
type Feature struct {
// contains filtered or unexported fields
}
Feature is a feature setting retrieved from a FeatureSet.
func (Feature) IsDefault ¶
IsDefault returns whether this feature was inherited from edition defaults. An explicit setting to the default will return false for this method.
func (Feature) IsExplicit ¶
IsExplicit returns whether this feature was set explicitly.
func (Feature) IsInherited ¶
IsInherited returns whether this feature value was inherited from its parent.
type FeatureInfo ¶
type FeatureInfo struct {
// contains filtered or unexported fields
}
FeatureInfo represents information about a message field being used as a feature. This corresponds to the edition_defaults and feature_support options on a field.
func (FeatureInfo) Default ¶
func (f FeatureInfo) Default(edition syntax.Syntax) Value
Default returns the default value for this feature.
func (FeatureInfo) Deprecated ¶
func (f FeatureInfo) Deprecated() syntax.Syntax
Deprecated returns whether this feature has been deprecated, and in which edition.
func (FeatureInfo) DeprecationWarning ¶
func (f FeatureInfo) DeprecationWarning() string
DeprecationWarning returns the literal text of the deprecation warning for this feature, if it has been deprecated.
func (FeatureInfo) Introduced ¶
func (f FeatureInfo) Introduced() syntax.Syntax
Introduced returns which edition this feature is first allowed in.
func (FeatureInfo) IsDeprecated ¶
func (f FeatureInfo) IsDeprecated(in syntax.Syntax) bool
IsDeprecated returns whether this feature has been deprecated yet.
func (FeatureInfo) IsIntroduced ¶
func (f FeatureInfo) IsIntroduced(in syntax.Syntax) bool
IsIntroduced returns whether this feature has been introduced yet.
func (FeatureInfo) IsRemoved ¶
func (f FeatureInfo) IsRemoved(in syntax.Syntax) bool
IsRemoved returns whether this feature has been removed yet.
func (FeatureInfo) Removed ¶
func (f FeatureInfo) Removed() syntax.Syntax
Removed returns whether this feature has been removed, and in which edition.
type FeatureSet ¶
type FeatureSet id.Node[FeatureSet, *File, *rawFeatureSet]
FeatureSet represents the Editions-mediated features of a particular declaration.
func (FeatureSet) Lookup ¶
func (fs FeatureSet) Lookup(field Member) Feature
Lookup looks up a feature with the given google.protobuf.FeatureSet member.
func (FeatureSet) LookupCustom ¶
func (fs FeatureSet) LookupCustom(extension, field Member) Feature
LookupCustom looks up a custom feature in the given extension's field.
func (FeatureSet) Options ¶
func (fs FeatureSet) Options() MessageValue
Options returns the value of the google.protobuf.FeatureSet message that this FeatureSet is built from.
func (FeatureSet) Parent ¶
func (fs FeatureSet) Parent() FeatureSet
Parent returns the feature set of the parent scope for this feature.
Returns zero if this is the feature set for the file.
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is an IR file, which provides access to the top-level declarations of a Protobuf *File.
func (*File) AllExtends ¶
AllExtends returns all extend blocks in this file.
func (*File) AllExtensions ¶
AllExtensions returns all extensions defined in this file.
func (*File) AllMembers ¶
AllMembers returns all fields defined in this file, including extensions and enum values.
func (*File) Annotations ¶
func (f *File) Annotations() seq.Indexer[Annotation]
Annotations returns all annotation declarations introduced in this file.
func (*File) Deprecated ¶
Deprecated returns whether this file is deprecated, by returning the relevant option value for setting deprecation.
func (*File) ExportedSymbols ¶
ExportedSymbols returns this file's exported symbols.
func (*File) Extensions ¶
Extensions returns the top level extensions defined in this file (i.e., the contents of any top-level `extends` blocks).
func (*File) FeatureSet ¶
func (f *File) FeatureSet() FeatureSet
FeatureSet returns the Editions features associated with this file.
func (*File) FindSymbol ¶
FindSymbol finds a symbol among File.Symbols with the given fully-qualified name.
func (*File) ImportFor ¶
ImportFor returns import metadata for a given file, if this file imports it.
func (*File) InternedPackage ¶
InternedPackage returns the intern ID for the value of File.Package.
func (*File) InternedPath ¶
InternedPath returns the intern ID for the value of File.Path.
func (*File) IsDescriptorProto ¶
IsDescriptorProto returns whether this is the special file google/protobuf/descriptor.proto, which is given special treatment in the language.
func (*File) NullMaskImport ¶ added in v0.35.0
NullMaskImport returns the file declaring NullMaskTypeName when a message in f gets a `_null` mask and f does not import it itself, and nil otherwise. Descriptor generation lists it as a dependency, and TopoSort orders it before f, so a descriptor set carries it. It is not one of f's File.Imports: f cannot name its symbols.
func (*File) NullMasks ¶ added in v0.35.0
NullMasks reports whether messages in f get a generated `_null` mask: its session selects it, it is not one of protobuf's own files, and the mask's type is available to it, through a regular import of NullMaskImport or through File.NullMaskImport. Protobuf's own files never get one: rewriting google/protobuf/descriptor.proto, whose proto2 option messages all have fields with presence, would change protobuf's descriptors. A descriptor may not list one file as both a regular and an option dependency, so an option import turns masks off for the file, and lowering reports it; so does a file that cannot import the mask's type. It is meaningful once f is lowered.
func (*File) Options ¶
func (f *File) Options() MessageValue
Options returns the top level options applied to this file.
func (*File) Package ¶
Package returns the package name for this file.
The name will not include a leading dot. It will be empty for the empty package.
func (*File) Path ¶
Path returns the canonical path for this file.
This need not be the same as File.AST().Span().Path().
func (*File) Symbols ¶
Symbols returns this file's symbol table.
The symbol table includes both symbols defined in this file, and symbols imported by the file. The symbols are returned in an arbitrary but fixed order.
func (*File) TransitiveImports ¶
TransitiveImports returns an indexer over the transitive imports for this file.
This function does not report whether those imports are weak or not.
func (*File) TypeAliases ¶
TypeAliases returns all `type` alias declarations introduced in this file.
type FullName ¶
type FullName string
FullName is a fully-qualified Protobuf name, which is a dot-separated list of identifiers, with an optional dot prefix.
This is a helper type for common operations on such names. This is essentially protoreflect.FullName, without depending on protoreflect. Unlike protoreflect, we do not provide validation methods.
func (FullName) Absolute ¶
Absolute returns whether this is an absolute name, i.e., has a leading dot.
func (FullName) Append ¶
Append returns a name with the given component(s) appended.
If this is an empty name, the resulting name will not be absolute.
func (FullName) Components ¶
Components returns an iterator over the components of this name.
If there are adjacent dots, e.g. foo..bar, this will yield an empty string within the name.
func (FullName) Parent ¶
Parent returns the name of the parent entity for this name.
If the name only has one component, returns the zero value. In particular, the parent of ".foo" is "".
func (FullName) ToAbsolute ¶
ToAbsolute returns this name with a leading dot.
func (FullName) ToRelative ¶
ToRelative returns this name without a leading dot.
type Function ¶
Function is a `function` declaration introduced by the Protowire Schema Extensions (PSE) grammar — see ast.DeclFunction.
Function declarations name an external function callable from inside `expression` arguments at annotation use sites. They live in the file's exported symbol table under SymbolKindFunction so cross-file resolution works the same way it does for `message`, `service`, and `annotation`.
Phase scope: symbol registration plus FDP emission via the [pwsv1.FileFunctions] file-scope carrier. Argument validation (verifying that a use-site call's arity matches the declared signature) requires the engine-language parser; the engine itself performs that check at runtime.
func (Function) AST ¶
func (f Function) AST() ast.DeclFunction
AST returns the declaration for this function, if known.
func (Function) Annotations ¶
func (f Function) Annotations() seq.Indexer[AnnotationUse]
Annotations returns the annotation use sites attached to this function declaration (trailing form: `function foo() @bar;`).
func (Function) InternedFullName ¶
InternedFullName returns the intern ID for Function.FullName.
func (Function) InternedName ¶
InternedName returns the intern ID for Function.FullName().Name().
func (Function) Name ¶
Name returns this function's declared name, i.e. the last component of its full name.
func (Function) Options ¶ added in v0.20.0
func (f Function) Options() seq.Indexer[FunctionOption]
Options returns the bracket-form options attached to this function declaration, in declaration order.
Option values are recorded without classification: the descriptor surface carries them AnnotationArg-shaped and consumers interpret them at use time.
type FunctionOption ¶ added in v0.20.0
type FunctionOption struct {
// Name is the unqualified option name: the last component of the
// path the option was written with. The FunctionDecl descriptor
// carrier keys its options map by this name.
Name string
// Value is the option's value expression, as written.
Value ast.ExprAny
}
FunctionOption is one bracket-form option attached to a Function declaration site, e.g. `error_code = "common.matches.failed"` in `function matches(...) [error_code = "..."];`.
type FunctionParam ¶
type FunctionParam id.Node[FunctionParam, *File, *rawFunctionParam]
FunctionParam is a single parameter of a Function declaration — see ast.DeclFunctionParam.
func (FunctionParam) AST ¶
func (p FunctionParam) AST() ast.DeclFunctionParam
AST returns the declaration for this function parameter, if known.
func (FunctionParam) Function ¶
func (p FunctionParam) Function() Function
Function returns the function declaration that this parameter belongs to.
func (FunctionParam) InternedName ¶
func (p FunctionParam) InternedName() intern.ID
InternedName returns the intern ID for FunctionParam.Name.
func (FunctionParam) Name ¶
func (p FunctionParam) Name() string
Name returns this parameter's declared name.
func (FunctionParam) TypeFQN ¶ added in v0.37.0
func (p FunctionParam) TypeFQN() string
TypeFQN returns the fully-qualified name of the parameter's type, which for a type alias is the alias itself, not its base. Falls back to FunctionParam.TypeName when the type did not resolve, or is `any`, which names no symbol.
func (FunctionParam) TypeName ¶
func (p FunctionParam) TypeName() string
TypeName returns the textual type the parameter was declared with (e.g. "string", "any", or "Email"), as written in the source.
type Import ¶
type Import struct {
*File // The file that is imported.
// The kind of import this is.
Public, Weak, Option bool
Direct bool // Whether this is a direct or transitive import.
Visible bool // Whether this import's symbols are visible in the current file.
Used bool // Whether this import has been marked as used.
Decl ast.DeclImport // The import declaration.
}
Import is an import in a File.
type Importer ¶
Importer is a callback to resolve the imports of an ast.File being lowered.
If a cycle is encountered, should return an *[incremental.ErrCycle], starting from decl and ending when the currently lowered file is imported.
Session.Lower may not call this function on all imports; only those for which it needs the caller to resolve a File for it.
This function will also be called with DescriptorProtoPath if it isn't transitively imported by the lowered file, with an index value of -1. Returning an error or a zero file will trigger an ICE.
When the session's Session.NullMask selects the file, it is also called with NullMaskImport and an index value of -2, unless the file declares an import of it. Returning an error or a zero file is reported as an error if a message in the file needs the mask.
type Member ¶
Member is a Protobuf message field, enum value, or extension field.
A member has three types associated with it. The English language struggles to give these succinct names, so we review them here.
Its _element_, i.e. the type it contains. This is the type that a member is declared to be _of_. Not present for enum values.
Its _parent_, i.e., the type it is syntactically defined within. Extensions appear syntactically within their parent.
Its _container_, i.e., the type which it is part of for the purposes of serialization. Extensions are fields of their container, but are declared within their parent.
func (Member) Annotations ¶
func (m Member) Annotations() seq.Indexer[AnnotationUse]
Annotations returns the annotation use sites attached to this member (trailing `@name(args)` annotations on a field or enum value). See Type.Annotations for the resolution model.
When the field's declared type referenced a type-alias chain (PSE v1), the chain's trailing annotations appear ahead of any field-site annotations, in base-to-derived order — the alias acts as a macro expansion per RFC-001 §5, and the resulting list matches §6.4 evaluation order (base → derived → field-level). See [propagateTypeAliasAnnotations]. A chain link living in another file is yielded under that file's context, so callers reading AnnotationUse.AST and AnnotationUse.Target still get coherent results.
func (Member) AsTagRange ¶
AsTagRange wraps this member in a TagRange.
func (Member) CanTarget ¶
func (m Member) CanTarget(target OptionTarget) bool
CanTarget returns whether this message field can be set as an option for the given option target type.
This is mediated by the option FieldOptions.targets, which controls whether this field can be set (transitively) on the options of a given entity type. This is useful for options which re-use the same message type for different option types, such as FeatureSet.
func (Member) Container ¶
Container returns the type which contains this member: this is either Member.Parent, or the extendee if this is an extension. This is the type it is declared to be *part of*.
func (Member) Deprecated ¶
Deprecated returns whether this member is deprecated, by returning the relevant option value for setting deprecation.
func (Member) Element ¶
Element returns the this member's element type. This is the type it is declared to be *of*, such as in the phrase "a string field's type is string".
This does not include the member's presence: for example, a repeated int32 member will report the type as being the int32 primitive, not an int32 array.
This is zero for enum values.
func (Member) FDPType ¶
func (m Member) FDPType() descriptorpb.FieldDescriptorProto_Type
FDPType returns the descriptor type that would be used for this field.
func (Member) FeatureInfo ¶
func (m Member) FeatureInfo() FeatureInfo
FeatureInfo returns feature definition information relating to this field (for when using this field as a feature).
Returns a zero value if this information does not exist.
func (Member) FeatureSet ¶
func (m Member) FeatureSet() FeatureSet
FeatureSet returns the Editions features associated with this member.
func (Member) InternedFullName ¶
InternedFullName returns the intern ID for Member.FullName.
func (Member) InternedJSONName ¶
InternedJSONName returns the intern ID for Member.JSONName.
func (Member) InternedName ¶
InternedName returns the intern ID for Member.FullName().Name().
func (Member) InternedScope ¶
InternedScope returns the intern ID for Member.Scope.
func (Member) IsEnumValue ¶
IsEnumValue returns whether this is an enum value.
func (Member) IsExtension ¶
IsExtension returns whether this is a extension message field.
func (Member) IsMessageField ¶
IsMessageField returns whether this is a non-extension message field.
func (Member) IsRepeated ¶
IsRepeated returns whether this is a repeated field; this includes map fields.
func (Member) IsSingular ¶
IsSingular returns whether this is a singular field; this includes oneof members.
func (Member) IsSynthetic ¶
IsSynthetic returns whether or not this is a synthetic field, such as the fields of a map entry.
func (Member) IsUnicode ¶
IsUnicode returns whether this is a string-typed message field that must contain UTF-8 bytes.
func (Member) JSONName ¶
JSONName returns this member's JSON name, either the default-generated one or the one set via the json_name pseudo-option.
func (Member) Number ¶
Number returns the number for this member after expression evaluation.
Defaults to zero if the number is not specified.
func (Member) Oneof ¶
Oneof returns the oneof that this member is a member of.
Returns the zero value if this member does not have presence.Shared.
func (Member) Options ¶
func (m Member) Options() MessageValue
Options returns the options applied to this member.
func (Member) Parent ¶
Parent returns the type this member is syntactically located in. This is the type it is declared *in*, but which it is not necessarily part of.
May be zero for extensions declared at the top level.
func (Member) Presence ¶
Presence returns this member's presence kind.
Returns presence.Unknown for enum values.
func (Member) PseudoOptions ¶
func (m Member) PseudoOptions() PseudoFields
PseudoOptions returns this member's pseudo options.
func (Member) SyntheticOneofName ¶
SyntheticOneofName returns the name of the corresponding synthetic oneof for this member, if there should be one.
For proto3 sources, a oneof is synthesized to track explicit optional presence of a field. For details on generating the synthesized name, see the docs for [syntheticNames] and/or refer to https://protobuf.com/docs/descriptors#synthetic-oneofs.
func (Member) Targets ¶
func (m Member) Targets() iter.Seq[OptionTarget]
Targets returns an iterator over the valid option targets for this member.
func (Member) TypeAliasChain ¶
TypeAliasChain returns the type-alias chain this member's declared type resolved through, in base-to-derived order — the alias closest to the concrete message / enum / scalar base first, ending with the name the field was declared with. Returns an empty indexer for members whose declared type was not an alias.
Yielded TypeAlias values stay in their defining file's context, so TypeAlias.AST and TypeAlias.FullName resolve correctly even when the chain spans multiple files.
Populated by [propagateTypeAliasAnnotations].
type MessageValue ¶
type MessageValue id.Node[MessageValue, *File, *rawMessageValue]
MessageValue is a message literal, represented as a list of ordered key-value pairs.
func (MessageValue) AsValue ¶
func (v MessageValue) AsValue() Value
AsValue returns the Value corresponding to this message.
This value can be used to retrieve the associated Member and from it the message's declared Type.
func (MessageValue) Concrete ¶
func (v MessageValue) Concrete() MessageValue
Concrete returns the concrete version of this value if it is an Any.
If it isn't an Any, or a .Raw()" Any (one not specified with the special type URL syntax), this returns v.
func (MessageValue) Field ¶
func (v MessageValue) Field(field Member) Value
Field returns the field corresponding with the given member, if it is set.
Returns a zero Value if either the member or the message value is zero.
func (MessageValue) Fields ¶
func (v MessageValue) Fields() iter.Seq[Value]
Fields yields the fields within this message literal, in insertion order.
func (MessageValue) IsEmpty ¶
func (v MessageValue) IsEmpty() bool
IsEmpty returns whether any fields are set on this value.
func (MessageValue) Marshal ¶
func (v MessageValue) Marshal(buf []byte, r *report.Report) []byte
Marshal serializes this message as wire format and appends it to buf.
If r is not nil, it will be used to record diagnostics generated during the marshal operation.
func (MessageValue) Type ¶
func (v MessageValue) Type() Type
Type returns this value's message type.
If v was returned from MessageValue.Concrete, its type need not be the same as v.AsValue()'s (although it can be, in the case of pathological Any-within-an-Any messages).
func (MessageValue) TypeURL ¶
func (v MessageValue) TypeURL() string
TypeURL returns this value's type URL, if it is the concrete value of an Any.
type Method ¶
Method is a Protobuf service method.
func (Method) Annotations ¶
func (m Method) Annotations() seq.Indexer[AnnotationUse]
Annotations returns the annotation use sites attached to this method. See Type.Annotations for the resolution model.
func (Method) Deprecated ¶
Deprecated returns whether this service is deprecated, by returning the relevant option value for setting deprecation.
func (Method) FeatureSet ¶
func (m Method) FeatureSet() FeatureSet
FeatureSet returns the Editions features associated with this method.
func (Method) Input ¶
Input returns the input type for this method, and whether it is a streaming input.
func (Method) InternedFullName ¶
InternedFullName returns the intern ID for Method.FullName.
func (Method) InternedName ¶
InternedName returns the intern ID for Method.FullName().Name().
func (Method) Name ¶
Name returns this method's declared name, i.e. the last component of its full name.
func (Method) Options ¶
func (m Method) Options() MessageValue
Options returns the options applied to this method.
type Oneof ¶
Oneof represents a oneof within a message definition.
func (Oneof) Annotations ¶
func (o Oneof) Annotations() seq.Indexer[AnnotationUse]
Annotations returns the annotation use sites attached to this oneof. See Type.Annotations for the resolution model.
func (Oneof) FeatureSet ¶
func (o Oneof) FeatureSet() FeatureSet
FeatureSet returns the Editions features associated with this oneof.
func (Oneof) InternedFullName ¶
InternedFullName returns the intern ID for Oneof.FullName.
func (Oneof) InternedName ¶
InternedName returns the intern ID for Oneof.FullName().Name().
func (Oneof) Options ¶
func (o Oneof) Options() MessageValue
Options returns the options applied to this oneof.
type OptionTarget ¶
type OptionTarget int32
OptionTarget is target for an Editions feature, corresponding to google.protobuf.FieldOptions.OptionTargetType. The values of this enum match those in descriptor.proto one-to-one.
const ( OptionTargetInvalid OptionTarget = iota OptionTargetFile OptionTargetRange OptionTargetMessage OptionTargetField OptionTargetOneof OptionTargetEnum OptionTargetEnumValue OptionTargetService OptionTargetMethod )
func (OptionTarget) GoString ¶
func (v OptionTarget) GoString() string
GoString implements fmt.GoStringer.
type PseudoFields ¶
PseudoFields contains pseudo options, which are special option-like syntax for fields which are not real options. They can be accessed via [Message.PseudoFields].
type PxfNumber ¶ added in v0.32.0
type PxfNumber int
PxfNumber names one of protowire's arbitrary-precision number types.
type Ref ¶
type Ref[T any] struct { // contains filtered or unexported fields }
Ref is a reference in a Protobuf file: an id.ID along with information for retrieving which file that ID is for, relative to the referencing file's context.
The context needed for resolving a ref is called its "base context", which the user is expected to keep track of.
func (Ref[T]) ChangeContext ¶
ChangeContext changes the implicit context for this ref to be with respect to the new one given.
type ReservedName ¶
type ReservedName struct {
// contains filtered or unexported fields
}
ReservedName is a name for a field or enum value that has been reserved for future use.
func (ReservedName) AST ¶
func (r ReservedName) AST() ast.ExprAny
AST returns the expression that this name was evaluated from, if known.
func (ReservedName) DeclAST ¶
func (r ReservedName) DeclAST() ast.DeclRange
DeclAST returns the declaration this name came from. Multiple names may have the same declaration.
func (ReservedName) InternedName ¶
func (r ReservedName) InternedName() intern.ID
InternedName returns the intern ID for ReservedName.Name.
func (ReservedName) Name ¶
func (r ReservedName) Name() string
Name returns the name (i.e., an identifier) that was reserved.
type ReservedRange ¶
type ReservedRange id.Node[ReservedRange, *File, *rawReservedRange]
ReservedRange is a range of reserved field or enum numbers, either from a reserved or extensions declaration.
func (ReservedRange) AST ¶
func (r ReservedRange) AST() ast.ExprAny
AST returns the expression that this range was evaluated from, if known.
func (ReservedRange) AsTagRange ¶
func (r ReservedRange) AsTagRange() TagRange
AsTagRange wraps this range in a TagRange.
func (ReservedRange) DeclAST ¶
func (r ReservedRange) DeclAST() ast.DeclRange
DeclAST returns the declaration this range came from. Multiple ranges may have the same declaration.
func (ReservedRange) FeatureSet ¶
func (r ReservedRange) FeatureSet() FeatureSet
FeatureSet returns the Editions features associated with this file.
func (ReservedRange) ForExtensions ¶
func (r ReservedRange) ForExtensions() bool
ForExtensions returns whether this is an extension range.
func (ReservedRange) Options ¶
func (r ReservedRange) Options() MessageValue
Options returns the options applied to this range.
Reserved ranges cannot carry options; only extension ranges do.
func (ReservedRange) Range ¶
func (r ReservedRange) Range() (start, end int32)
Range returns the start and end of the range.
type Service ¶
Service is a Protobuf service definition.
func (Service) Annotations ¶
func (s Service) Annotations() seq.Indexer[AnnotationUse]
Annotations returns the annotation use sites attached to this service. See Type.Annotations for the resolution model.
func (Service) Deprecated ¶
Deprecated returns whether this service is deprecated, by returning the relevant option value for setting deprecation.
func (Service) FeatureSet ¶
func (s Service) FeatureSet() FeatureSet
FeatureSet returns the Editions features associated with this service.
func (Service) InternedFullName ¶
InternedFullName returns the intern ID for Service.FullName.
func (Service) InternedName ¶
InternedName returns the intern ID for Service.FullName().Name().
func (Service) Name ¶
Name returns this service's declared name, i.e. the last component of its full name.
func (Service) Options ¶
func (s Service) Options() MessageValue
Options returns the options applied to this service.
type Session ¶
type Session struct {
// NullMask, when non-nil, selects the files whose messages get a
// generated `_null` mask (protocompile#248; see [NeedsNullMask]).
// Lowering imports [NullMaskImport] for them and reports what stops a
// message getting one, and descriptor generation adds the field. Set
// it before the session lowers its first file. It is given canonical
// paths. Nil generates none.
NullMask func(path string) bool
// contains filtered or unexported fields
}
Session is shared global configuration and state for all IR values that are being used together.
It is used to track shared book-keeping.
A zero Session is ready to use.
func (*Session) InternStats ¶
InternStats returns interning statistics, assuming Session.RecordInternStats was called first.
This function is intended for performance monitoring only.
func (*Session) Lower ¶
func (s *Session) Lower(source *ast.File, errs *report.Report, importer Importer) (file *File, ok bool)
Lower lowers an AST into an IR module.
Diagnostics generated by this process are written to errs. Returns whether lowering succeeded without errors; warnings and remarks do not make it fail.
The ir package does not provide a mechanism for resolving imports; instead, they must be provided as an argument to this function.
func (*Session) NullMaskSelects ¶ added in v0.35.0
NullMaskSelects reports whether Session.NullMask selects the file at path, which must be canonical (see CanonicalizeFilePath): it is set, it selects path, and path is not one of protobuf's own files. Those never get a mask, and must not ask for NullMaskImport either: field_mask.proto imports descriptor.proto implicitly, so a descriptor.proto that asked for field_mask.proto would close a cycle.
func (*Session) RecordInternStats ¶
func (s *Session) RecordInternStats()
RecordInternStats enables instrumentation of the session's intern table.
See Session.InternStats.
type Symbol ¶
Symbol is an entry in a File's symbol table.
[Symbol.Context] returns the context for the file which imported this symbol. To map this to the context in which the symbol was defined, use [Symbol.InDefFile].
func (Symbol) AsAnnotation ¶
func (s Symbol) AsAnnotation() Annotation
AsAnnotation returns the annotation this symbol refers to, if it is one.
func (Symbol) AsFunction ¶
AsFunction returns the function this symbol refers to, if it is one.
func (Symbol) AsTypeAlias ¶
AsTypeAlias returns the type alias this symbol refers to, if it is one.
func (Symbol) Definition ¶
Definition returns a span for the definition site of this symbol; specifically, this is (typically) just an identifier.
func (Symbol) Deprecated ¶
Deprecated returns whether this symbol is deprecated, but returning the relevant option value for setting deprecation.
Note that although files can be marked as deprecated, packages cannot, so package symbols never show up as deprecated.
func (Symbol) FeatureSet ¶
func (s Symbol) FeatureSet() FeatureSet
FeatureSet returns the features associated with this symbol.
func (Symbol) Import ¶
Import returns the import declaration that brought this symbol into scope in the given file.
Returns zero if s is defined in the current file or if s is not imported by in.
func (Symbol) InternedFullName ¶
InternedFullName returns the intern ID for Symbol.FullName.
type SymbolKind ¶
type SymbolKind int8
SymbolKind is a kind of symbol, i.e. an IR entity that defines a fully-qualified name.
const ( SymbolKindInvalid SymbolKind = iota SymbolKindPackage SymbolKindScalar SymbolKindMessage SymbolKindEnum SymbolKindField SymbolKindEnumValue SymbolKindExtension SymbolKindOneof SymbolKindService SymbolKindMethod SymbolKindAnnotation SymbolKindFunction SymbolKindTypeAlias )
func (SymbolKind) GoString ¶
func (v SymbolKind) GoString() string
GoString implements fmt.GoStringer.
func (SymbolKind) IsMember ¶
func (k SymbolKind) IsMember() bool
IsMember returns whether this is a field's symbol kind. This includes enum values, which the ir package treats as fields of enum types.
func (SymbolKind) IsMessageField ¶
func (k SymbolKind) IsMessageField() bool
IsMessageField returns whether this is a field's symbol kind.
func (SymbolKind) IsScope ¶
func (k SymbolKind) IsScope() bool
IsScope returns whether this is a symbol that defines a scope, for the purposes of name lookup.
func (SymbolKind) IsType ¶
func (k SymbolKind) IsType() bool
IsType returns whether this is a type's symbol kind.
func (SymbolKind) OptionTarget ¶
func (k SymbolKind) OptionTarget() OptionTarget
OptionTarget returns the OptionTarget type for a symbol of this kind.
Returns OptionTargetInvalid if there is no corresponding target for this type of symbol.
type TagRange ¶
type TagRange struct {
// contains filtered or unexported fields
}
TagRange is a range of tag numbers in a Type.
This can represent either a Member or a ReservedRange.
func (TagRange) AsMember ¶
AsMember returns the Member this range points to, or zero if it isn't a member.
func (TagRange) AsReserved ¶
func (r TagRange) AsReserved() ReservedRange
AsReserved returns the ReservedRange this range points to, or zero if it isn't a member.
type Type ¶
Type is a Protobuf message field type.
func PredeclaredType ¶
func PredeclaredType(n predeclared.Name) Type
PredeclaredType returns the type corresponding to a predeclared name.
Returns the zero value if !n.IsScalar().
func (Type) AST ¶
AST returns the declaration for this type, if known.
This need not be an ast.DefMessage or ast.DefEnum; it may be something else in the case of e.g. a map field's entry type.
func (Type) AbsoluteRange ¶
AbsoluteRange returns the smallest and largest number a member of this type can have.
This range is inclusive.
func (Type) AllRanges ¶
func (t Type) AllRanges() seq.Indexer[ReservedRange]
AllRanges returns all reserved/extension ranges declared in this type.
This does not include reserved field names; see Type.ReservedNames.
func (Type) AllowsAlias ¶
AllowsAlias returns whether this is an enum type with the allow_alias option set.
func (Type) Annotations ¶
func (t Type) Annotations() seq.Indexer[AnnotationUse]
Annotations returns the annotation use sites attached to this type (a `@name(args)` form leading the `message`/`enum` declaration).
Materialised by the Phase B2 resolve pass. Each entry's AnnotationUse.Target is the resolved Annotation, or zero when name resolution failed (a diagnostic was emitted at resolve time).
func (Type) CarrierScalar ¶ added in v0.31.0
func (t Type) CarrierScalar() predeclared.Name
CarrierScalar gives the scalar type an `any` annotation argument attached to a member of this type is CONVERTED TO, or predeclared.Unknown when there is none and the literal keeps its own type.
It resolves a conversion TARGET. It began as a routing hint — something consulted to pick an oneof member when the literal's spelling was ambiguous — and the difference matters: a hint is harmless when wrong, because the value survives in another member, while a target decides whether the source compiles. Both the lowering and the diagnostics reach it through ConvertArgKind, so there is one answer rather than two that have to agree (#188).
A wrapper resolves to the scalar it wraps: `google.protobuf.DoubleValue` is the canonical nullable double, and a `@default` on one is a value for that double. Without this the wrappers kept the spelling route and with it the (MaxInt64, MaxUint64] ambiguity #172 removed from bare scalars (#174).
The arbitrary-precision types protowire defines — `pxf.BigInt`, `pxf.Decimal`, `pxf.BigFloat` — are deliberately NOT mapped. They exist to hold values a `double` cannot represent, so routing them through `double_value` would lose the precision that is their entire purpose.
The cost of leaving them unmapped is worse than precision, though, and was recorded too mildly here before: a literal in (MaxInt64, MaxUint64] lowered into `int_value` and reached a consumer with the WRONG SIGN — `@default(1e19)` on a `pxf.BigInt` applied a negative number (#176). checkCarrierRange now rejects that at compile time rather than inventing a value, which is the outcome that does not guess.
Giving these types a faithful route still needs a carrier member that can hold them, not a different scalar route.
func (Type) Deprecated ¶
Deprecated returns whether this type is deprecated, by returning the relevant option value for setting deprecation.
func (Type) EntryFields ¶
EntryFields returns the key and value fields for this map entry type.
func (Type) ExtensionRanges ¶
func (t Type) ExtensionRanges() seq.Indexer[ReservedRange]
ExtensionRanges returns the extension ranges declared in this type.
func (Type) Extensions ¶
Extensions returns any extensions nested within this type.
func (Type) FeatureSet ¶
func (t Type) FeatureSet() FeatureSet
FeatureSet returns the Editions features associated with this type.
func (Type) FullName ¶
FullName returns this type's fully-qualified name.
If t is zero, returns "". Otherwise, the returned name will be absolute unless this is a primitive type.
func (Type) GroupField ¶
GroupField returns the group field that generated this type, if any.
func (Type) InternedFullName ¶
InternedName returns the intern ID for Type.FullName
Predeclared types do not have an interned name.
func (Type) InternedName ¶
InternedName returns the intern ID for Type.FullName().Name()
Predeclared types do not have an interned name.
func (Type) InternedScope ¶
InternedScope returns the intern ID for Type.Scope
Predeclared types do not have an interned name.
func (Type) IsAny ¶
IsAny returns whether this is the type google.protobuf.Any, which gets special treatment in the language.
func (Type) IsClosedEnum ¶
func (Type) IsExported ¶
IsExported returns whether this type is exported for the purposes of visibility in other files.
Returns whether this was set explicitly via the export or local keywords.
func (Type) IsMapEntry ¶
IsMapEntry returns whether this is a map type's entry.
func (Type) IsMessageSet ¶
IsMessageSet returns whether this is a message type using the message set encoding.
func (Type) IsPackable ¶
IsPackable returns whether this type can be the element of a packed repeated field.
func (Type) IsPredeclared ¶
IsPredeclared returns whether this is a predeclared type.
func (Type) MemberByInternedName ¶
MemberByInternedName is like Type.MemberByName, but takes an interned string.
func (Type) MemberByName ¶
MemberByName looks up a member with the given name.
Returns a zero member if there is no such member.
func (Type) MemberByNumber ¶
MemberByNumber looks up a member with the given number.
Returns a zero member if there is no such member.
func (Type) Members ¶
Members returns the members of this type.
Predeclared types have no members; message and enum types do.
func (Type) Name ¶
Name returns this type's declared name, i.e. the last component of its full name.
func (Type) Nested ¶
Nested returns those types which are nested within this one.
Only message types have nested types.
func (Type) OccupiedRanges ¶
OccupiedRanges returns ranges of member numbers currently in use in this type. The pairs of numbers are inclusive ranges.
func (Type) Options ¶
func (t Type) Options() MessageValue
Options returns the options applied to this type.
func (Type) Parent ¶
Parent returns the type that this type is declared inside of, if it isn't at the top level.
func (Type) Predeclared ¶
func (t Type) Predeclared() predeclared.Name
Predeclared returns the predeclared type that this Type corresponds to, if any.
Returns either predeclared.Unknown or a value such that predeclared.Name.IsScalar returns true. For example, this will *not* return predeclared.Map for map fields.
func (Type) PxfNumber ¶ added in v0.32.0
PxfNumber reports which arbitrary-precision type this is, or PxfNone.
These three exist to hold values `int64` and `double` cannot, so an annotation argument on one of them is carried in the matching AnnotationArg member whatever its magnitude — routing a small value through `int_value` and a large one through `big_int_value` would give a consumer two cases for one type, and routing either through `double` would lose the precision the type was declared for (protowire#263).
A map field resolves through its value type, as CarrierScalar does.
func (Type) ReservedNames ¶
func (t Type) ReservedNames() seq.Indexer[ReservedName]
ReservedNames returns the reserved named declared in this type.
func (Type) ReservedRanges ¶
func (t Type) ReservedRanges() seq.Indexer[ReservedRange]
ReservedRanges returns the reserved ranges declared in this type.
This does not include reserved field names; see Type.ReservedNames.
type TypeAlias ¶
TypeAlias is a `type` declaration introduced by the Protowire Schema Extensions (PSE) grammar — see ast.DeclType.
Type aliases are language sugar that lower to standard protobuf: `type Email = string` declares `Email` as a name that fields can use in place of `string` (per RFC-001 §5). Annotations attached at the alias declaration become part of every use site's annotation list, giving authors a single place to refine a primitive base type with validation rules and documentation.
Phase scope here is symbol registration plus FDP emission via the [pwsv1.FileTypeDecls] file-scope carrier (1330). Field-type resolution against type aliases (so that `Email email = 1;` produces a `string` field with the alias's annotations expanded on the field-level [pwsv1.AnnotationList]) lives in the broader field-type resolution stack and is a separate follow-up.
func (TypeAlias) Annotations ¶
func (t TypeAlias) Annotations() seq.Indexer[AnnotationUse]
Annotations returns the annotation use sites attached to this alias (trailing form: `type Email = string @validate(...);`). See Type.Annotations for the resolution model.
func (TypeAlias) BaseTypeFQN ¶ added in v0.21.0
BaseTypeFQN returns the fully-qualified name of the alias's resolved base type — `type CompanyEmail = Email` written bare in-package yields "fixtures.lib.Email" — or the predeclared name ("string") for primitive bases. For a chained alias the immediate base is returned, itself fully qualified.
Falls back to TypeAlias.BaseTypeName's as-written text when the base did not resolve; broken bases are diagnosed at the alias declaration site by the base-resolution pass.
func (TypeAlias) BaseTypeName ¶
BaseTypeName returns the canonical text of the alias's base-type expression as the user wrote it (e.g. "string", or "myco.commons.Address"). Field-type resolution against this name is deferred to the broader resolution stack — see the package- level note on TypeAlias.
func (TypeAlias) InternedFullName ¶
InternedFullName returns the intern ID for TypeAlias.FullName.
func (TypeAlias) InternedName ¶
InternedName returns the intern ID for TypeAlias.FullName().Name().
type Value ¶
Value is an evaluated expression, corresponding to an option in a Protobuf file.
func (Value) AsBool ¶
AsBool is a shortcut for Element.AsBool, if this value is singular.
func (Value) AsEnum ¶
AsEnum is a shortcut for Element.AsEnum, if this value is singular.
func (Value) AsFloat ¶
AsFloat is a shortcut for Element.AsFloat, if this value is singular.
func (Value) AsInt ¶
AsInt is a shortcut for Element.AsInt, if this value is singular.
func (Value) AsMessage ¶
func (v Value) AsMessage() MessageValue
AsMessage is a shortcut for Element.AsMessage, if this value is singular.
func (Value) AsString ¶
AsString is a shortcut for Element.AsString, if this value is singular.
func (Value) AsUInt ¶
AsUInt is a shortcut for Element.AsUInt, if this value is singular.
func (Value) Container ¶
func (v Value) Container() MessageValue
Container returns the message value which contains this value, assuming it is not a top-level value.
This function is analogous to Member.Container, which returns the type that contains a member; in particular, for extensions, it returns an extendee.
func (Value) Elements ¶
Elements returns an indexer over the elements within this value.
If the value is not an array, it contains the singular element within; otherwise, it returns the elements of the array.
The indexer will be nonempty except for the zero Value. That is to say, unset fields of [MessageValue]s are not represented as a distinct "empty" Value.
func (Value) Field ¶
Field returns the field this value sets, which includes the value's type information.
NOTE: Member.Element returns google.protobuf.Any, the concrete type of the values in Value.Elements may be distinct from it.
func (Value) IsTopLevel ¶
IsTopLevel returns whether this value corresponds with a top-level option declaration in source.
This will return false on options for synthetic types, e.g. the map_entry option on map entry types, because this is not set for synthetic types.
func (Value) IsZeroValue ¶
IsZeroValue is a shortcut for Element.IsZeroValue.
func (Value) KeyAST ¶
KeyAST returns a representative AST node for the message key that evaluated from this value.
func (Value) KeyASTs ¶
KeyASTs returns the AST nodes for each key associated with a value in Value.ValueASTs.
This will either be the key value from an ast.FieldExpr (which need not be an ast.PathExpr, in the case of an extension) or the ast.PathExpr associated with the left-hand-side of an option setting.
func (Value) Marshal ¶
Marshal converts this value into a wire format record and appends it to buf.
If r is not nil, it will be used to record diagnostics generated during the marshal operation.
func (Value) OptionPaths ¶
OptionPaths returns the AST nodes for option paths that set this node.
There will be one path per value returned from Value.ValueASTs. Generally, you'll want to use Value.KeyASTs instead.
func (Value) OptionSpan ¶
OptionSpan returns a representative span for the option that set this value.
The Spanner will be an ast.ExprField, if it is set in an ast.ExprDict.
func (Value) OptionSpans ¶
OptionSpans returns an indexer over spans for the option that set this value.
The Spanner will be an ast.ExprField, if it is set in an ast.ExprDict.
Source Files
¶
- annotation_args.go
- annotation_convert.go
- builtins.go
- builtins_copy.go
- doc.go
- duplicate.go
- expression_lang.go
- ir_annotation.go
- ir_features.go
- ir_file.go
- ir_function.go
- ir_imports.go
- ir_member.go
- ir_name.go
- ir_ref.go
- ir_service.go
- ir_symbol.go
- ir_type.go
- ir_type_alias.go
- ir_value.go
- limits.go
- lower.go
- lower_annotation_params.go
- lower_annotation_placement.go
- lower_annotation_uses.go
- lower_deprecated.go
- lower_eval.go
- lower_features.go
- lower_http.go
- lower_imports.go
- lower_json.go
- lower_maps.go
- lower_numbers.go
- lower_options.go
- lower_resolve.go
- lower_symbols.go
- lower_validate.go
- lower_walk.go
- null_mask.go
- option_target.go
- symbol_kind.go
- synthetic.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package presence provides Kind, which denotes the way in which a field can be present in a Protobuf message.
|
Package presence provides Kind, which denotes the way in which a field can be present in a Protobuf message. |
|
Package sourceinfo contains decoding operations for Protobuf descriptor SourceCodeInfo paths.
|
Package sourceinfo contains decoding operations for Protobuf descriptor SourceCodeInfo paths. |
|
decode
command
decode is a helper tool for ingesting an encoded FileDescriptorSet and dumping its SourceCodeInfo in a readable format.
|
decode is a helper tool for ingesting an encoded FileDescriptorSet and dumping its SourceCodeInfo in a readable format. |