Package-level declarations

Types

Link copied to clipboard

Represents a scope that is only visible in the current file. This is usually used in programming languages for file-level imports.

Link copied to clipboard
Link copied to clipboard

This should ideally only be called once. It constructs a new global scope, which is not associated to any AST node. However, depending on the language, a language frontend can explicitly set the ast node using ScopeManager.resetToGlobal if the language needs a global scope that is restricted to a translation unit, i.e. C++ while still maintaining a unique list of global variables.

Link copied to clipboard
class LocalScope(var astNode: Node) : ValueDeclarationScope

Scope of validity associated to the local statement. Variables declared inside this statement are not visible outside.

Link copied to clipboard

A scope which acts as a namespace with a certain name, which is prefixed to all local names declared in it. This could be a package or other structural elements, like a class. In the first case, the derived NamespaceScope, in the latter case, the derived RecordScope should be used.

Link copied to clipboard

This scope is opened up by a NamespaceDeclaration and represents the scope of the whole namespace. This scope is special in a way that it will only exist once (per GlobalScope) and contains all symbols declared in this namespace, even if they are spread across multiple files.

Link copied to clipboard
class RecordScope(node: Node? = null) : NameScope

Represents the scope of a record or class, most likely created by a RecordDeclaration.

Link copied to clipboard
sealed class Scope : Node

Represent semantic scopes in the language. Depending on the language scopes can have visibility restriction and can act as namespaces to avoid name collisions.

Link copied to clipboard

This sealed (and abstract) class represents a Scope that in addition to declare variables also defines structures, such as classes, namespaces, etc.

Link copied to clipboard
typealias Symbol = String

A symbol is a simple, local name. It is valid within the scope that declares it and all of its child scopes. However, a child scope can usually "shadow" a symbol of a higher scope.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Is a scope where local variables can be declared and independent of specific language constructs. Works for if, for, and extends to the block scope

Functions

Link copied to clipboard
fun SymbolMap.mergeFrom(symbolMap: SymbolMap)

This function merges in all entries from the symbolMap into the current SymbolMap.