Documentation
¶
Index ¶
- func BoundText(b semantics.Bound) string
- func LookupNamed(idx *symbols.Index, id string) []*symbols.Symbol
- func LookupNamedMember(idx *symbols.Index, model *semantics.Model, id string) []*symbols.Symbol
- func MemberChain(idx *symbols.Index, model *semantics.Model, name string) (*symbols.Symbol, string)
- func UnquotedName(id string) (string, bool)
- type Attribute
- type Context
- type Info
- type Multiplicity
- type Specialization
- type TypeInfo
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LookupNamed ¶
LookupNamed resolves a symbol ID written in either spelling: the quoted, notation-legal form a model author writes ('My Pkg'::Car), or the unquoted spelling the index records (My Pkg::Car), which keeps working as it did. Model elements come before library homonyms: an ID naming both denotes the model's own element, which is what the client asked about.
func LookupNamedMember ¶ added in v0.10.1
LookupNamedMember is LookupNamed for an ID the index registers no declaration under because its last segments name members the type of the segment before them contributes: a member a subtype inherits (Sub::inherited) or one reached through a feature's type (Outer::inner::b). Such a name is walked through the model's member lookup, so the member a redefinition replaces is answered by the redefinition, as a reference in the notation resolves.
func MemberChain ¶ added in v0.10.1
MemberChain resolves a qualified name, in the unquoted spelling the index records, whose later segments are members of the type of the segment before them: the longest prefix one declaration answers to is the chain's root, and the rest is walked through model's member lookup, which follows typing and specialization. A prefix the model declares shadows a library declaration of the same name, as the notation resolves the name. The second result is the fully-qualified name the member is declared under; nil and "" when no prefix is a declaration the rest walks from.
func UnquotedName ¶
UnquotedName is the name a notation-legal qualified name states, with the quoting of its unrestricted segments removed, or false for an ID the notation does not read as one whole name.
Types ¶
type Context ¶
type Context struct {
Index *symbols.Index
Resolver *resolve.Resolver
Semantics *semantics.Model
// contains filtered or unexported fields
}
Context holds what converting a symbol to proto needs besides the symbol: its index, and the resolver and semantic model that answer what its declared names refer to. Their memoization is why it is shared per model.
The resolver and semantic model memoize into plain maps, so a shared context must be used by one goroutine at a time; Lock serializes concurrent conversions of the same model.
func NewContext ¶
NewContext builds a conversion context over a symbol index.
type Info ¶
type Info struct {
Id string
Name string
Kind string
Metadata map[string]string
ChildIds []string
TypeInfo *TypeInfo
Multiplicity *Multiplicity
Specializations []*Specialization
Attributes []*Attribute
WithheldLibraryAttributes int32
}
Info contains protobuf-independent facts about a symbol.
type Multiplicity ¶
Multiplicity contains the lower and upper bounds of a symbol's multiplicity.
type Specialization ¶
Specialization describes a declared generalization relationship.