resolve

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 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

View Source
const CodeNameConflict = "name-conflict"

CodeNameConflict marks a name declared twice in one namespace, counting the members it inherits (SysML 7.6.1, KerML 7.3.2.1).

View Source
const CodeNotAVertex = "not-a-vertex"

CodeNotAVertex marks an endpoint naming an element no transition can start or end at (SysML 7.19.2).

Variables

This section is empty.

Functions

func ActionGeneralBodies added in v0.5.0

func ActionGeneralBodies(scope *symbols.Scope) []*symbols.Scope

ActionGeneralBodies returns the bodies of the actions the action enclosing scope specializes or is typed by, nearest first and each once, found from the scope tree alone — where a member the action inherits was declared.

func ActionNodeInScope added in v0.3.0

func ActionNodeInScope(scope *symbols.Scope, qn *ast.QualifiedName) (ast.Node, *symbols.Scope, bool, bool)

ActionNodeInScope finds an inherited action node from the scope tree alone. The final bool reports an unresolved generalization that makes absence uncertain.

func ActionNodeOfBody added in v0.5.0

func ActionNodeOfBody(body *symbols.Scope, name string) (ast.Node, bool)

ActionNodeOfBody finds the action node a name written in an action's body names there: one the body declares, else one its declaration inherits.

func FeatureSymbolInScope added in v0.4.2

func FeatureSymbolInScope(scope *symbols.Scope, segments []string) (*symbols.Symbol, bool)

FeatureSymbolInScope resolves a dotted feature path from the scope tree alone, innermost scope first, so a local declaration shadows an outer one — for lowering a send target without a resolver over its document. At each scope, a member the scope's declaration inherits from its generalizations counts as the scope's own, so an inherited port shadows like a declared one.

func ImplicitlyRedefined added in v0.3.0

func ImplicitlyRedefined(sym *symbols.Symbol) bool

ImplicitlyRedefined reports whether a member takes an inherited feature's name by implicitly redefining it: a behavior parameter matched by position, and the subject, actors, stakeholders and objective of a requirement or case (KerML 7.3.4.5, SysML 7.18.4).

func IsVertex added in v0.7.0

func IsVertex(decl ast.Node) bool

IsVertex reports whether decl is a vertex a transition may name: a state, a pseudostate, or a control node standing in for one (SysML 7.19.2).

func ParameterizedByName added in v0.3.0

func ParameterizedByName(sym *symbols.Symbol) bool

ParameterizedByName reports whether sym is a case or requirement — including a concern or viewpoint, which are requirements — whose subject, actors and stakeholders redefine the inherited ones by name (SysML 7.18.4, 7.19.4). That is not modelled and not distinguishable from an ordinary feature here, so the conflict rule skips such a body entirely.

func RedefinesActionNode added in v0.5.0

func RedefinesActionNode(body *symbols.Scope, node *ast.Usage, decl ast.Node) bool

RedefinesActionNode reports whether node, declared in body, redefines decl — directly or through a node it redefines that does — from the scope tree alone.

func TypeDeclInScope added in v0.4.0

func TypeDeclInScope(scope *symbols.Scope, qn *ast.QualifiedName) (ast.Node, *symbols.Scope, bool)

TypeDeclInScope is TypeDecl from the scope tree alone, for a machine lowered without a resolver over its document.

func VertexInScope

func VertexInScope(scope *symbols.Scope, target ast.Node) (ast.Node, bool)

VertexInScope finds the vertex an endpoint names from the scope tree alone, innermost scope first, for a machine lowered without a resolver over its document (lower.ToStateGraph): no index is consulted, so nothing outside the scopes the endpoint was written in can answer it.

Types

type Diagnostic

type Diagnostic struct {
	Span    source.Span
	Message string
	// Code names the kind of problem; empty leaves it to the message.
	Code string
	// Fixes are the unambiguous edits resolving the diagnostic, offered by an
	// editor as quick fixes.
	Fixes []quickfix.Fix
	// Warning reports a well-formedness rule the reference states as a warning:
	// the model still resolves, so validation continues past it.
	Warning bool
}

Diagnostic is a name-resolution problem tied to a source span.

type HeadRelationship added in v0.6.0

type HeadRelationship struct {
	Scope *symbols.Scope
	Kind  ast.RelationshipKind
	// Member is the chain member the reference is a segment of; nil when the
	// reference is the name decided on.
	Member *ast.QualifiedName
}

HeadRelationship places a reference in a declaration's head relationship: its target resolves in Scope, the declaration's own, when it opens with a member there.

type MemberLookup

type MemberLookup interface {
	// LookupMember searches for a member by name in sym's scope and inherited scopes.
	LookupMember(sym *symbols.Symbol, name string) (*symbols.Symbol, bool)
	// LookupContributedMember searches the inherited scopes only, skipping
	// what sym itself declares.
	LookupContributedMember(sym *symbols.Symbol, name string) (*symbols.Symbol, bool)
}

MemberLookup interface abstracts semantic model for inheritance-aware member resolution. Implemented by *semantics.Model.

type Reading added in v0.5.0

type Reading struct {
	// contains filtered or unexported fields
}

Reading is what a qualified name named when read in a chosen scope, with the per-segment records and ambiguity a consumer of ResolveQualified would ask the resolver for afterwards: see ReadQualified.

func (Reading) Alias added in v0.5.1

func (rd Reading) Alias(i int) (*symbols.Symbol, bool)

Alias returns the alias membership segment i was written as, as PartAlias does.

func (Reading) Ambiguity added in v0.5.0

func (rd Reading) Ambiguity() (int, bool)

Ambiguity returns how many elements the name named when it failed for naming several, as Ambiguity does for a written name.

func (Reading) Part added in v0.5.0

func (rd Reading) Part(i int) (*symbols.Symbol, bool)

Part returns the element segment i named, as PartSymbol does for a written name.

func (Reading) Symbol added in v0.5.0

func (rd Reading) Symbol() (*symbols.Symbol, bool)

Symbol returns the element the name reached, or false when it reached none.

type Reference

type Reference struct {
	Scope *symbols.Scope
	QN    *ast.QualifiedName
	// Referrer owns the reference subsetting QN is the target of, if any.
	Referrer ast.Node
	// Chain is set when QN is the member of a feature chain, whose segments are
	// members of the operand rather than of Scope (SysML 7.6.6).
	Chain *ast.FeatureChainExpr
	// Constructed is set when QN labels a constructor argument: a simple name is
	// a feature of the instantiated type Constructed names, a qualified one is
	// resolved in Scope.
	Constructed *ast.QualifiedName
	// Redefines is set when QN is the target of a redefinition, which names a
	// feature of Scope's generals rather than a member of Scope itself.
	Redefines bool
	// Condition is set when QN is a name inside an element-filter condition, which
	// its own namespace's filters do not restrict (see InCondition).
	Condition bool
	// Invocation is set when QN is the name an invocation calls, which overload
	// selection may resolve to one of several declarations (see ResolveInvocationName).
	Invocation *ast.InvocationExpr
	// Performed is set when Invocation is the value of an action usage, which
	// runs the action it names rather than evaluating a calc of that name.
	Performed bool
	// Endpoint is set when QN is a transition end, which names a vertex of the
	// enclosing machine ahead of anything else it reaches (see ResolveEndpoint).
	Endpoint bool
	// Import is the import QN is the target of, if any; an `import all` reaches
	// private members the visibility rule would otherwise hide.
	Import *ast.Import
	// Subsetting is the declaration QN subsets, if any; its spelling decides
	// whether it is read as a redefinition, as a sibling redefining the name, or
	// as the declaration's own name.
	Subsetting ast.Node
	// Member is the declaration whose text QN is written in, when known.
	Member ast.Node
	// Within is set when Member is declared inside an expression body: the
	// namespace member whose declaration holds the outermost such body.
	Within ast.Node
	// Head is set when QN is written in a head relationship of a declaration
	// with a scope of its own, where the target may resolve ahead of Scope.
	Head *HeadRelationship
}

Reference describes one occurrence of a name to resolve on its own, outside a document walk: which scope it is written in, the declaration that refers to it when it is a reference subsetting's target, and the feature chain it is the member segment of. Used by the editor layer, which resolves a single name under the cursor and must reach the same symbol the document walk did.

func References

func References(root *ast.RootNamespace, rootScope *symbols.Scope) []Reference

References walks a document's scope tree and AST, gathering every QualifiedName reference with the scope it resolves in. It mirrors document.go's traversal: a form handled there but not here is a reference a consumer walking the document — the editor's navigation and highlighting — cannot find.

func (Reference) Spelled added in v0.5.0

func (ref Reference) Spelled(qn *ast.QualifiedName) Reference

Spelled returns ref as it would be collected had qn been written in its place: the same occurrence, read the way the document walk reads that spelling.

type Resolver

type Resolver struct {
	Diagnostics []Diagnostic
	// contains filtered or unexported fields
}

Resolver performs lazy name resolution over a symbol index, memoizing results keyed by the reference AST node and collecting diagnostics.

func New

func New(idx *symbols.Index) *Resolver

New creates a resolver over the given index.

func (*Resolver) AdmittedChildrenOf

func (r *Resolver) AdmittedChildrenOf(scope *symbols.Scope, fqn string, children []*symbols.Symbol) []*symbols.Symbol

AdmittedChildrenOf keeps the members of the namespace fqn that a lookup made in scope can reach, so an enumeration of a namespace (completion) offers only names resolution then admits.

func (*Resolver) AdmittedTopLevel

func (r *Resolver) AdmittedTopLevel(doc string, bindings []symbols.RootBinding) []*symbols.Symbol

AdmittedTopLevel keeps the root-level names a lookup made in doc reaches, so an enumeration of them (completion) offers only names resolution then admits: a name another document's import borrowed, or one this document's import filter rejects, is no member of this document's root namespace.

func (*Resolver) AliasNamesNothing added in v0.2.0

func (r *Resolver) AliasNamesNothing(sym *symbols.Symbol) bool

AliasNamesNothing reports whether the name an alias binds reaches no element, because the alias's own target reference is unresolved (KerML 8.2.3.2). A cyclic alias is excluded: its target reference does name an element.

func (*Resolver) AliasedElement added in v0.2.0

func (r *Resolver) AliasedElement(sym *symbols.Symbol) *symbols.Symbol

AliasedElement is the element a name bound to sym reaches: an alias names an existing element rather than being one (KerML 8.2.3.2). An alias whose target is unresolvable stays itself, so its own diagnostic still fires.

func (*Resolver) BindsName added in v0.6.0

func (r *Resolver) BindsName(sym *symbols.Symbol) bool

BindsName reports whether sym binds the name it is registered under. A feature with no declared name takes the name of the feature it redefines or references, so it binds none when that target resolves to nothing, or to no feature (KerML 7.3.4.5).

func (*Resolver) CutShort added in v0.5.1

func (r *Resolver) CutShort(depth int)

CutShort records that a guard cut a query short for the lookup at depth.

func (*Resolver) DistinguishableMembers added in v0.6.0

func (r *Resolver) DistinguishableMembers(scope *symbols.Scope) (owned, aliases []*symbols.Symbol)

DistinguishableMembers splits the members of scope whose names the distinguishability rules compare into owned members and aliases: those that bind a name, as LocalBinding finds them. Exported for the library-base half of the rule in internal/core/passes.

func (*Resolver) EndSymbol added in v0.5.0

func (r *Resolver) EndSymbol(qn *ast.QualifiedName) (*symbols.Symbol, bool)

EndSymbol returns what the edge end qn resolved to: the vertex a transition end was judged as, or otherwise its last segment's symbol.

func (*Resolver) Endpoint

func (r *Resolver) Endpoint(scope *symbols.Scope, target ast.Node) (ast.Node, bool)

Endpoint returns the declaration an endpoint names, which lowering builds its edges from (lower.EndpointResolver); the lookup itself reports nothing, since this tier reports an endpoint naming no vertex when it resolves the document.

func (*Resolver) EndpointSymbol added in v0.2.0

func (r *Resolver) EndpointSymbol(scope *symbols.Scope, target ast.Node) (*symbols.Symbol, bool)

EndpointSymbol returns the resolved symbol for a transition endpoint.

func (*Resolver) Enter added in v0.5.1

func (r *Resolver) Enter() int

Enter begins a lookup that memoizes its answer and returns its depth, which the guard protecting it passes to CutShort. A nil resolver has no lookups to cut short, so its every answer is settled.

func (*Resolver) ImportTarget added in v0.2.0

func (r *Resolver) ImportTarget(scope *symbols.Scope, imp *ast.Import) (*symbols.Symbol, bool)

ImportTarget is the namespace or membership an import names, as the import itself reaches it.

func (*Resolver) ImportedElements

func (r *Resolver) ImportedElements(scope *symbols.Scope, imp *ast.Import) []*symbols.Symbol

ImportedElements enumerates the elements imp surfaces into scope, with the same admission a lookup through imp makes: the import's filter clause and the `filter` members of the declaring namespace (see importAdmitsInto).

func (*Resolver) ImportedElementsInto added in v0.6.0

func (r *Resolver) ImportedElementsInto(into, scope *symbols.Scope, imp *ast.Import) []*symbols.Symbol

ImportedElementsInto enumerates the elements imp, declared in scope, surfaces into the namespace owning into, which inherits it: an inherited `expose` is admitted against the inheriting view's conditions too (see importAdmitsInto).

func (*Resolver) InCondition

func (r *Resolver) InCondition(f func())

InCondition runs the resolution of a filter condition's own names, which its namespace's filters do not restrict: a condition naming a metadata type the namespace imports would otherwise be filtered by itself (KerML 8.2.4). Nothing resolved meanwhile is memoized, so the bypass reaches no other lookup.

func (*Resolver) Index

func (r *Resolver) Index() *symbols.Index

Index returns the symbol index this resolver operates over.

func (*Resolver) InitialSymbol added in v0.5.0

func (r *Resolver) InitialSymbol(n *ast.InitialNode) (*symbols.Symbol, bool)

InitialSymbol returns the member the initial node's name resolved to: the one a start marker binds to, or the source a succession's `first` refers to; false where the name is a label the node itself declares.

func (*Resolver) InvocationCandidates added in v0.5.0

func (r *Resolver) InvocationCandidates(scope *symbols.Scope, qn *ast.QualifiedName) []*symbols.Symbol

InvocationCandidates returns every declaration a called name may denote from scope, in lookup order (ResolveInvocationName reaches the first), an alias standing for its target; library functions need an import.

func (*Resolver) IsBaseThat added in v0.2.0

func (r *Resolver) IsBaseThat(sym *symbols.Symbol) bool

IsBaseThat reports whether sym is the implicit `that` feature of the base usage: it names the object featuring a usage's values, so it is reachable in any usage body and its declared type Anything is not what a chain reads.

func (*Resolver) IsOccurrenceThis added in v0.4.0

func (r *Resolver) IsOccurrenceThis(sym *symbols.Symbol) bool

IsOccurrenceThis reports whether sym is the context occurrence feature `this`, whose members a chain reads from the object it denotes (see ThisContext).

func (*Resolver) Journal added in v0.5.0

func (r *Resolver) Journal(node ast.Node, drop func())

Journal registers drop to run when the enclosing Scratch, if any, ends with node transient: how a side table keyed by node joins the resolver's lifecycle.

func (*Resolver) Leave added in v0.5.1

func (r *Resolver) Leave() bool

Leave ends the innermost lookup and reports whether its answer is settled: no guard cut a query short for a lookup outside it, so it saw every member.

func (*Resolver) LibraryFeature added in v0.8.0

func (r *Resolver) LibraryFeature(sym *symbols.Symbol) bool

LibraryFeature reports whether sym is declared by bundled library content, so a model's own declaration under a library name is not mistaken for the library's.

func (*Resolver) LocalBinding added in v0.6.0

func (r *Resolver) LocalBinding(scope *symbols.Scope, name string) (*symbols.Symbol, bool)

LocalBinding returns the first of LocalBindings.

func (*Resolver) LocalBindings added in v0.6.0

func (r *Resolver) LocalBindings(scope *symbols.Scope, name string) []*symbols.Symbol

LocalBindings returns the members scope declares under name that bind it, declared names first.

func (*Resolver) LookupName

func (r *Resolver) LookupName(scope *symbols.Scope, name string) (*symbols.Symbol, bool)

LookupName resolves an unqualified reference from scope the way a written one resolves — the enclosing scope chain, inherited members, imports, then the global index — but records no diagnostic when it finds nothing.

It is what an evaluator asks: the names it looks up are not all references the source wrote down (a value bound at run time is looked up the same way), and a miss is for the evaluator to report against the value it was reading.

func (*Resolver) LookupNameExcluding

func (r *Resolver) LookupNameExcluding(scope *symbols.Scope, name string, decl ast.Node) (*symbols.Symbol, bool)

LookupNameExcluding resolves name from scope as LookupName does, with decl's own binding hidden: what the name resolves to where decl does not declare it.

func (*Resolver) MachineStateVertex added in v0.2.0

func (r *Resolver) MachineStateVertex(scope *symbols.Scope, qn *ast.QualifiedName, sym *symbols.Symbol) bool

MachineStateVertex reports whether sym is a vertex of the state machine enclosing scope, using the same inherited-member predicate as endpoint resolution.

func (*Resolver) MemoSize added in v0.5.0

func (r *Resolver) MemoSize() int

MemoSize is the number of resolutions this resolver retains.

func (*Resolver) MetadataBodyOwner added in v0.2.0

func (r *Resolver) MetadataBodyOwner(scope *symbols.Scope) *symbols.Symbol

MetadataBodyOwner returns the type whose features a metadata body implicitly redefines (KerML 7.4.7): the metadata type of `@M { … }` / `metadata m : M { … }`, or the redefined feature for a body nested in one; nil when it does not resolve.

func (*Resolver) PartAlias added in v0.2.0

func (r *Resolver) PartAlias(qn *ast.QualifiedName, i int) (*symbols.Symbol, bool)

PartAlias returns the alias membership the i-th segment of qn was written as, where the name it wrote is an alias of the element PartSymbol reports.

func (*Resolver) PartName added in v0.5.0

func (r *Resolver) PartName(qn *ast.QualifiedName, i int) (*symbols.Symbol, bool)

PartName returns the symbol whose name the i-th segment of qn wrote: the alias membership when it was written as an alias name, else the element it reached.

func (*Resolver) PartSymbol

func (r *Resolver) PartSymbol(qn *ast.QualifiedName, i int) (*symbols.Symbol, bool)

PartSymbol returns the symbol the i-th segment of qn resolved to during a previous resolution by this resolver. Callers that need intermediate resolutions of a qualified name (a hover over `A::B` in `A::B::C`, say) read them here.

func (*Resolver) ProbeReading added in v0.5.1

func (r *Resolver) ProbeReading(ref Reference) Reading

ProbeReading is ProbeReference with what each segment of ref.QN reached, a failed reading's segments included. ref.QN should be a fresh node (see Reference.Spelled): its segment records are read off and left cleared.

func (*Resolver) ProbeReference added in v0.5.0

func (r *Resolver) ProbeReference(ref Reference) (*symbols.Symbol, bool)

ProbeReference resolves ref as a trial reading: what a name spelled differently at the same place would denote. Its diagnostics are suppressed.

func (*Resolver) ReadQualified added in v0.5.0

func (r *Resolver) ReadQualified(scope *symbols.Scope, qn *ast.QualifiedName) Reading

ReadQualified resolves qn as if it were written in scope, the way an expression evaluated in a chosen scope reads its names. A written name is read in one scope, so ResolveQualified memoizes by node; an expression may be evaluated in several, so a reading is memoized by scope and node, and leaves the node's own records untouched.

func (*Resolver) RedefinitionTarget added in v0.8.0

func (r *Resolver) RedefinitionTarget(scope *symbols.Scope, decl ast.Node, target ast.Node) (*symbols.Symbol, bool)

RedefinitionTarget returns the feature a redefinition owned by decl, declared in scope, targets — an alias followed to what it names. It reports nothing itself.

func (*Resolver) ReferringNamespaceFQN

func (r *Resolver) ReferringNamespaceFQN(scope *symbols.Scope) string

ReferringNamespaceFQN returns the fully-qualified name of the namespace a reference made in scope belongs to, or "" for one made outside any namespace. It is the context a qualified lookup is answered in: a name a private wildcard import brought into a namespace is a member of it but visible only from within (KerML 8.2.3.3), so `Mid::Hidden` resolves inside Mid and nowhere else.

func (*Resolver) ResolveAliasTarget

func (r *Resolver) ResolveAliasTarget(sym *symbols.Symbol) (*symbols.Symbol, bool)

ResolveAliasTarget follows an alias symbol to its ultimate non-alias target. Non-alias symbols resolve to themselves. Cycles yield (nil, false).

func (*Resolver) ResolveDocument

func (r *Resolver) ResolveDocument(name string, root *ast.RootNamespace)

ResolveDocument walks the document's references and resolves each, recording diagnostics on the Resolver. name identifies the document in the index.

func (*Resolver) ResolveEndpoint

func (r *Resolver) ResolveEndpoint(scope *symbols.Scope, qn *ast.QualifiedName) (*symbols.Symbol, bool)

ResolveEndpoint resolves the vertex a transition endpoint names, reporting one that names nothing or no vertex. A nil name is the sourceless form: legal.

func (*Resolver) ResolveEndpointRef added in v0.8.0

func (r *Resolver) ResolveEndpointRef(scope *symbols.Scope, target ast.Node) (*symbols.Symbol, bool)

ResolveEndpointRef resolves an endpoint however a connector end writes it: a name, or a feature chain (`c.c1`) whose member segments read from the vertex its operand names. A nil name is the sourceless form: legal.

func (*Resolver) ResolveInvocationName added in v0.5.0

func (r *Resolver) ResolveInvocationName(scope *symbols.Scope, qn *ast.QualifiedName) (*symbols.Symbol, bool)

ResolveInvocationName resolves a called name as ResolveQualified does, except that several declarations under a qualified name denote the first: overload selection picks the one run.

func (*Resolver) ResolveName

func (r *Resolver) ResolveName(scope *symbols.Scope, name string, at ast.Node) (*symbols.Symbol, bool)

ResolveName resolves a single-segment (unqualified) reference from the given scope. The at node keys the memo table.

func (*Resolver) ResolveQualified

func (r *Resolver) ResolveQualified(scope *symbols.Scope, qn *ast.QualifiedName) (*symbols.Symbol, bool)

ResolveQualified resolves a qualified-name reference against the given scope. scope may be nil to resolve purely from the global index / document root. Later tasks implement the walk; this skeleton reports unresolved.

func (*Resolver) ResolveRedefinitionTarget added in v0.6.0

func (r *Resolver) ResolveRedefinitionTarget(scope *symbols.Scope, decl ast.Node, target ast.Node) (*symbols.Symbol, bool)

ResolveRedefinitionTarget resolves the target of a redefinition owned by decl: the feature decl's owner inherits, which decl's own redefinition does not mask (KerML 8.3.3.3.6), whatever name decl borrowed from it.

func (*Resolver) ResolveReference

func (r *Resolver) ResolveReference(ref Reference) (*symbols.Symbol, bool)

ResolveReference resolves a single name occurrence, honoring both the reference-subsetting and feature-chain rules.

func (*Resolver) ResolveReferenceTarget

func (r *Resolver) ResolveReferenceTarget(scope *symbols.Scope, decl ast.Node, target ast.Node) (*symbols.Symbol, bool)

ResolveReferenceTarget resolves the target of a reference subsetting owned by decl, which is declared in scope.

func (*Resolver) ResolveTarget

func (r *Resolver) ResolveTarget(scope *symbols.Scope, target ast.Node) (*symbols.Symbol, bool)

ResolveTarget resolves a relationship target to the feature it names. A target is either a qualified name (`references takePicture`) or a feature chain (`perform providePower.generateTorque`), and the chain's segments are members of the previous segment rather than of the enclosing scope (SysML 7.6.6).

Unlike resolveFeatureChain, this reports nothing: the target of a declared relationship is already resolved — and diagnosed — while walking the document, and this is the query side of that result.

func (*Resolver) Scratch added in v0.5.0

func (r *Resolver) Scratch(transient map[ast.Node]bool, f func())

Scratch runs f, then forgets what f memoized about the transient nodes, so syntax the model does not own (a request expression) is not retained.

func (*Resolver) SetModel

func (r *Resolver) SetModel(model MemberLookup)

SetModel attaches a semantic model for inheritance-aware member resolution. Must be called before resolving feature chains if inherited members are needed.

func (*Resolver) ThisContext added in v0.4.0

func (r *Resolver) ThisContext(scope *symbols.Scope) *symbols.Symbol

ThisContext returns the object `this` denotes where scope was written: the innermost enclosing object, since an owned performance and its subperformances take their owner's `this` ([KerML] Objects::ownedPerformances, [SysML] Parts::Part::this, Actions::Action::subactions). Nil in a standalone behavior, where `this` is the performance itself.

func (*Resolver) TypeDecl added in v0.4.0

func (r *Resolver) TypeDecl(scope *symbols.Scope, qn *ast.QualifiedName) (ast.Node, *symbols.Scope, bool)

TypeDecl returns the declaration a type name reaches and the scope of that declaration's body, which is what a usage typed by it inherits its content from. It reports nothing itself: the tier reported the name already.

func (*Resolver) UnresolvedMember added in v0.8.0

func (r *Resolver) UnresolvedMember(scope *symbols.Scope, qn *ast.QualifiedName, owner *symbols.Symbol, i int) string

UnresolvedMember is the text after "unresolved reference: " for a qualified name read from scope whose segment i names no member of owner: as written, plus `T::'SA-506'` for `T::SA` when that spelling would resolve from scope.

func (*Resolver) UnresolvedName added in v0.5.0

func (r *Resolver) UnresolvedName(scope *symbols.Scope, name string, at ast.Node) string

UnresolvedName is the text after "unresolved reference: " for an unqualified name written at in scope that resolves to nothing: the name and the spellings it may mean.

Jump to

Keyboard shortcuts

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