extractScope

This function extracts a scope for the Name, e.g. if the name is fully qualified (wrapped in a ScopeExtraction object. null is returned if a scope was specified, but does not exist as a Scope object.

The returned object contains the extracted scope and a name that is adjusted by possible import aliases. The extracted scope is "responsible" for the name (e.g. declares the parent namespace) and the returned name only differs from the provided name if aliasing was involved at the node location (e.g. because of imports).

Note: Currently only fully qualified names are properly resolved. This function will probably return imprecise results for partially qualified names, e.g. if a name A inside B points to A::B, rather than to A.

Return

a ScopeExtraction object with the scope of node.name and the alias-adjusted name

Parameters

node

the nodes name references a namespace constituted by a scope

scope

the current scope relevant for the name resolution, e.g. parent of node


fun extractScope(name: Name, location: PhysicalLocation? = null, scope: Scope? = currentScope): ScopeManager.ScopeExtraction?

This function extracts a scope for the Name, e.g. if the name is fully qualified. null is returned, if no scope can be extracted.

The pair returns the extracted scope and a name that is adjusted by possible import aliases. The extracted scope is "responsible" for the name (e.g. declares the parent namespace) and the returned name only differs from the provided name if aliasing was involved at the node location (e.g. because of imports).

Note: Currently only fully qualified names are properly resolved. This function will probably return imprecise results for partially qualified names, e.g. if a name A inside B points to A::B, rather than to A.

Return

a pair with the scope of node.name and the alias-adjusted name

Parameters

name

the name

scope

the current scope relevant for the name resolution, e.g. parent of node