symbolfacts

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoundText

func BoundText(b semantics.Bound) string

BoundText renders a multiplicity bound; an unevaluable one renders empty.

func LookupNamed

func LookupNamed(idx *symbols.Index, id string) []*symbols.Symbol

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

func LookupNamedMember(idx *symbols.Index, model *semantics.Model, id string) []*symbols.Symbol

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

func MemberChain(idx *symbols.Index, model *semantics.Model, name string) (*symbols.Symbol, string)

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

func UnquotedName(id string) (string, bool)

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 Attribute

type Attribute struct {
	Name  string
	Type  string
	Unit  string
	Value *Value
}

Attribute contains a symbol's attribute declaration facts.

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

func NewContext(idx *symbols.Index) *Context

NewContext builds a conversion context over a symbol index.

func (*Context) Lock

func (sc *Context) Lock() func()

Lock takes exclusive use of the context's resolver and semantic model, and returns the function releasing it.

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.

func Of

func Of(sym *symbols.Symbol, sc *Context) *Info

Of derives the plain-Go facts associated with a symbol.

func Root

func Root(sc *Context, rootScope *symbols.Scope) *Info

Root is one document's root namespace: the index's own root symbol for it, else the document's root scope described as one, which is what a document declaring no root symbol has.

type Multiplicity

type Multiplicity struct {
	Lower string
	Upper string
}

Multiplicity contains the lower and upper bounds of a symbol's multiplicity.

type Specialization

type Specialization struct {
	Kind       string
	Declared   string
	TargetId   string
	TargetKind string
}

Specialization describes a declared generalization relationship.

type TypeInfo

type TypeInfo struct {
	Declared        string
	ResolvedId      string
	ResolvedKind    string
	Primitive       string
	PrimitiveSource string
	Quantity        bool
	Unit            string
}

TypeInfo describes a symbol's declared, resolved and primitive type.

type Value

type Value struct {
	String *string
	Const  *semantics.Value
}

Value contains either a string value or an evaluated semantic constant.

Jump to

Keyboard shortcuts

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