ResolutionResult
A successful resolution of a refkey.
Members
Section titled “Members”| commonScope | TScope | undefined | The lexical scope which contains both the reference and the lexical declaration. Undefined when they do not share a common scope. |
| fullReferencePath | TScope[] | The scopes from the root to the scope of the reference. |
| fullSymbolPath | TScope[] | The scopes from the root to scope of the lexical declaration. |
| lexicalDeclaration | TSymbol | When the symbol is a member symbol, this is the symbol of the lexical declaration which contains this member symbol, either as one of its own member symbols, or as a member of one of its members. When the symbol is a non-member symbol, this is the same as symbol. |
| memberPath | TSymbol[] | Member symbols from the lexical declaration (exclusive) to the resolved symbol (inclusive). Empty when resolving a non-member symbol. |
| pathDown | TScope[] | The scopes between the common scope and the declaration. |
| pathUp | TScope[] | The scopes between the common scope and the reference. |
| symbol | TSymbol | The resolved symbol. May be declared in a lexical scope or be a member symbol. |
Example
Section titled “Example”Let’s say we have the following scopes and symbols:
scope: global scope
├── scope: namespace scope 1
│ └── symbol: foo
│ └── static members
│ └── symbol: bar
└── scope: namespace scope 2
└── (resolve bar from here)
When we resolve the refkey for bar from within namespace scope 2, we will get the following
resolution result:
- targetDeclaration: symbol bar, the symbol we resolved.
- commonScope: global scope, because this is the most specific scope that contains both the declaration and the reference.
- pathUp: [namespace scope 2], because this is the scope between the reference and the common scope.
- pathDown: [namespace scope 1], because this is the scope between the common scope and the declaration
- memberPath: [bar]
- lexicalDeclaration: foo For deeper chains (e.g., foo.bar.baz where bar and baz are member symbols, foo is not): memberPath = [bar, baz], lexicalDeclaration = foo.