GlobalScope
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.
Properties
The list of child scopes.
Returns the GlobalScope of this scope by traversing its parents upwards.
In some languages, the lookup scope of a symbol that is being resolved (e.g. of a Reference) can be adjusted through keywords (such as global
in Python or PHP).
FQN Name currently valid
A map of symbols and their respective Declaration nodes that declare them.
A map of typedefs keyed by their alias name. This is still needed as a bridge until we completely redesign the alias / typedef system.
A list of ImportDeclaration nodes that have ImportDeclaration.wildcardImport set to true.
Functions
Adds a declaration with the defined symbol.
Looks up a list of Declaration nodes for the specified symbol. Optionally, predicate can be used for additional filtering.
Because the way we currently handle parallel parsing in TranslationManager.parseParallel, we end up with multiple GlobalScope objects, one for each TranslationUnitDeclaration. In the end, we need to merge all these different scopes into one final global scope. To be somewhat consistent with the behaviour of TranslationManager.parseSequentially, we assign the last translation unit declaration we see to the AST node of the GlobalScope. This is not completely ideal, but the best we can do for now.