sun::semantic_analysis::SemanticContext
class · Source (opens in a new tab)
class sun::semantic_analysis::SemanticContext : public sun::semantic_analysis::AccessContextThe shared state and scope machinery of a semantic analysis run.
Implements AccessContext so the scope lookups can filter by visibility: "which module is asking" is the nearest module scope on the stack.
Inherits
Types
- sun::semantic_analysis::SemanticContext::LifetimeScopeGuard (public)
- sun::semantic_analysis::SemanticContext::InterfaceDefinition (public)
- sun::semantic_analysis::SemanticContext::ClassDefinition (public)
- sun::semantic_analysis::SemanticContext::DeclarationCollectionGuard (public)
- sun::semantic_analysis::SemanticContext::SourceFileGuard (public)
- sun::semantic_analysis::SemanticContext::ScopeSwitchGuard (public)
- sun::semantic_analysis::SemanticContext::LocationGuard (public)
Public Functions
- SemanticContext
- accessibleField
- accessibleMethod
- accessibleMethodForArgs
- activeLifetimeNames
- addImportBinding
- addUsingImport
- allowsThisLifetime
- currentFunctionReturnType
- currentFunctionScope
- currentLocation
- currentModuleId
- currentScope
- currentSourceFileId
- declarationTable
- declarations
- declareLifetime
- definitionScopeOf
- denyAccess
- enterClassScope
- enterFunctionScope
- enterInterfaceScope
- enterModuleScope
- enterMoonScope
- enterScope
- enterTryBlock
- enterTypeParamScope
- enterUnsafeBlock
- exitMoonScope
- exitScope
- exitTryBlock
- exitUnsafeBlock
- findSymbolInModule
- findTypeAlias
- findTypeParameter
- getActiveUsingImports
- getAllFunctions
- getCurrentClass
- getCurrentScopePath
- getFullModulePath
- getNarrowedType
- isAccessible
- isAtModuleLevel
- isCollectingDeclarations
- isInMoonScope
- isInThrowingFunction
- isInTryBlock
- isInUnsafeBlock
- isModuleName
- lookupClass
- lookupEnum
- lookupFunction
- lookupGenericClass
- lookupGenericEnum
- lookupGenericFunction
- lookupGenericInterface
- lookupInterface
- lookupModuleScope
- lookupQualifiedFunction
- lookupQualifiedVariable
- narrowVariable
- requireAccessible
- requireDeclaration
- requireModuleAccessible
- resolveNameWithUsings
- results
- rootScope
- scope
- setCurrentClass
- types
SemanticContext
public · function · Source (opens in a new tab)
sun::semantic_analysis::SemanticContext::SemanticContext(std::shared_ptr< sun::semantic_analysis::AnalysisResults > results)Start with an empty global scope holding the builtin functions.
Related: sun::semantic_analysis::AnalysisResults
accessibleField
accessibleField(const sun::types::ClassType &cls, const std::string &name, const sun::support::Position &loc) const
public · function · Source (opens in a new tab)
const sun::types::ClassField * sun::semantic_analysis::SemanticContext::accessibleField(const sun::types::ClassType &cls, const std::string &name, const sun::support::Position &loc) constA class field by name: nullptr when it does not exist; throws when it exists but is not accessible from here.
Related: sun::types::ClassField, sun::types::ClassType, sun::support::Position
accessibleField(const sun::types::InterfaceType &iface, const std::string &name, const sun::support::Position &loc) const
public · function · Source (opens in a new tab)
const sun::types::InterfaceField * sun::semantic_analysis::SemanticContext::accessibleField(const sun::types::InterfaceType &iface, const std::string &name, const sun::support::Position &loc) constAn interface field by name, with the same access rules as a class's.
Related: sun::types::InterfaceField, sun::types::InterfaceType, sun::support::Position
accessibleMethod
accessibleMethod(const sun::types::ClassType &cls, const std::string &name, const sun::support::Position &loc) const
public · function · Source (opens in a new tab)
const sun::types::ClassMethod * sun::semantic_analysis::SemanticContext::accessibleMethod(const sun::types::ClassType &cls, const std::string &name, const sun::support::Position &loc) constThe same for a class method, taking the first overload of that name.
Related: sun::types::ClassMethod, sun::types::ClassType, sun::support::Position
accessibleMethod(const sun::types::InterfaceType &iface, const std::string &name, const sun::support::Position &loc) const
public · function · Source (opens in a new tab)
const sun::types::InterfaceMethod * sun::semantic_analysis::SemanticContext::accessibleMethod(const sun::types::InterfaceType &iface, const std::string &name, const sun::support::Position &loc) constAn interface method by name, with the same access rules as a class's.
Related: sun::types::InterfaceMethod, sun::types::InterfaceType, sun::support::Position
accessibleMethodForArgs
public · function · Source (opens in a new tab)
const sun::types::ClassMethod * sun::semantic_analysis::SemanticContext::accessibleMethodForArgs(const sun::types::ClassType &cls, const std::string &name, const std::vector< sun::types::TypePtr > &argTypes, const sun::support::Position &loc) constThe same, picking the overload that matches the argument types.
Related: sun::types::ClassMethod, sun::types::ClassType, sun::types::TypePtr, sun::support::Position
activeLifetimeNames
public · function · Source (opens in a new tab)
const std::vector< std::string > & sun::semantic_analysis::SemanticContext::activeLifetimeNames() constLifetime names visible in the current declaration or body.
addImportBinding
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::addImportBinding(const ImportBinding &binding)Add a scope-based import binding.
Related: ImportBinding
addUsingImport
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::addUsingImport(const UsingImport &import)Add a using import (legacy string-based).
Related: UsingImport
allowsThisLifetime
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticContext::allowsThisLifetime() constWhether the current declaration or body may name the receiver lifetime.
currentFunctionReturnType
public · function · Source (opens in a new tab)
TypePtr sun::semantic_analysis::SemanticContext::currentFunctionReturnType() constReturn type of the nearest enclosing function scope (null outside functions or when unresolved); used for return-position inference.
Related: sun::types::TypePtr
currentFunctionScope
public · function · Source (opens in a new tab)
FunctionScope * sun::semantic_analysis::SemanticContext::currentFunctionScope() constNearest enclosing function scope, or nullptr at module/global level.
Related: FunctionScope
currentLocation
public · function · Source (opens in a new tab)
std::optional< Position > sun::semantic_analysis::SemanticContext::currentLocation() constThe innermost location a LocationGuard recorded, if any.
Related: sun::support::Position, LocationGuard
currentModuleId
public · function · Source (opens in a new tab)
DeclarationId sun::semantic_analysis::SemanticContext::currentModuleId() const overrideThe module asking for access: the nearest module scope on the stack.
Related: sun::semantic_analysis::DeclarationId
currentScope
currentScope() const
public · function · Source (opens in a new tab)
const SemanticScope & sun::semantic_analysis::SemanticContext::currentScope() constReturns the lexical scope used for current semantic lookups.
Related: SemanticScope
currentScope()
public · function · Source (opens in a new tab)
SemanticScope & sun::semantic_analysis::SemanticContext::currentScope()Access the scope currently being analyzed.
Related: SemanticScope
currentSourceFileId
public · function · Source (opens in a new tab)
SourceFileId sun::semantic_analysis::SemanticContext::currentSourceFileId() const overrideThe file whose imports are visible during the current operation.
Related: SourceFileId
declarationTable
public · function · Source (opens in a new tab)
const sun::semantic_analysis::DeclarationTable & sun::semantic_analysis::SemanticContext::declarationTable() const overrideDeclaration ownership for visibility checks in this session.
Related: sun::semantic_analysis::DeclarationTable
declarations
public · function · Source (opens in a new tab)
DeclarationState & sun::semantic_analysis::SemanticContext::declarations()Declaration identities, registered shapes, and pending extensions.
Related: DeclarationState
declareLifetime
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::declareLifetime(const std::string &name)Add a lifetime binder within a LifetimeScopeGuard.
Related: LifetimeScopeGuard
definitionScopeOf
public · function · static · Source (opens in a new tab)
template <typename GenericInfo>
static SemanticScope * sun::semantic_analysis::SemanticContext::definitionScopeOf(const GenericInfo &info)The scope a generic template was declared in (nullptr if unknown, in which case ScopeSwitchGuard keeps the current scope).
Related: SemanticScope, ScopeSwitchGuard
denyAccess
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::denyAccess(const sun::semantic_analysis::ItemRef &item) const overrideReport that item is not reachable from here, pointing at source.
Related: sun::semantic_analysis::ItemRef
enterClassScope
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::enterClassScope(const sun::semantic_analysis::QualifiedName &className)Enter a class scope with qualified name for proper scope path.
Related: sun::semantic_analysis::QualifiedName
enterFunctionScope
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::enterFunctionScope(const std::string &funcSig, const sun::semantic_analysis::QualifiedName &funcName, bool canThrow=false, sun::types::TypePtr returnType=nullptr)Enter a function scope with the function's signature for nested function qualified names.
The signature should be "funcName(paramType1,paramType2)". funcName is the qualified name of the function.
Related: sun::semantic_analysis::QualifiedName, sun::types::TypePtr
enterInterfaceScope
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::enterInterfaceScope(const sun::semantic_analysis::QualifiedName &interfaceName)Enter an interface scope with qualified name for proper scope path.
Related: sun::semantic_analysis::QualifiedName
enterModuleScope
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::enterModuleScope(const std::string &moduleName)Enter a module's scope, creating it if this is the first time the module is opened.
Re-opening a module returns to the same scope.
enterMoonScope
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::enterMoonScope()Enter a moon import's stub scope.
enterScope
enterScope(SemanticScope &scope)
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::enterScope(SemanticScope &scope)Make an existing scope current; exitScope returns to its parent.
Related: SemanticScope
enterScope(ScopeType type=ScopeType::Block)
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::enterScope(ScopeType type=ScopeType::Block)Push a new scope of the given kind and make it current.
Related: ScopeType, ScopeType::Block
enterTryBlock
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::enterTryBlock()Enter a try block (increments the try depth counter).
enterTypeParamScope
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::enterTypeParamScope(const std::vector< std::string > ¶ms, const std::vector< sun::types::TypePtr > &args)Enter a type parameter scope with bindings (combines enterScope + currentScope().declareTypeParameters).
Related: sun::types::TypePtr, currentScope()
enterUnsafeBlock
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::enterUnsafeBlock()Enter an unsafe block (increments the unsafe depth counter).
exitMoonScope
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::exitMoonScope()Leave a moon import's stub scope.
exitScope
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::exitScope()Make the parent scope current again.
The scope itself stays in the tree for debugging and visualization.
exitTryBlock
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::exitTryBlock()Leave a try block (decrements the try depth counter).
exitUnsafeBlock
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::exitUnsafeBlock()Leave an unsafe block (decrements the unsafe depth counter).
findSymbolInModule
public · function · Source (opens in a new tab)
SymbolMatch sun::semantic_analysis::SemanticContext::findSymbolInModule(const std::string &modulePath, const std::string &name, SymbolKind filterKind=SymbolKind::None, const std::vector< sun::types::TypePtr > *argTypes=nullptr) constFind a symbol in a specific module path (dot-separated, user-visible), traversing library scopes transparently: findSymbolInModule("b", "get_version") finds b.get_version even if b is inside a library scope like $hash$.b.
Optional filterKind restricts to a specific symbol type (None = any). Optional argTypes selects the matching overload when the symbol is a function; without it the first registered overload is returned. Throws when the same name is found in several libraries.
Related: SymbolMatch, SymbolKind, SymbolKind::None, sun::types::TypePtr
findTypeAlias
public · function · Source (opens in a new tab)
TypePtr sun::semantic_analysis::SemanticContext::findTypeAlias(const std::string &name) constThe type a type alias names, searching outwards (null if none).
Related: sun::types::TypePtr
findTypeParameter
public · function · Source (opens in a new tab)
TypePtr sun::semantic_analysis::SemanticContext::findTypeParameter(const std::string &name) constThe type a type parameter is bound to, searching outwards (null if none).
Related: sun::types::TypePtr
getActiveUsingImports
public · function · Source (opens in a new tab)
std::vector< UsingImport > sun::semantic_analysis::SemanticContext::getActiveUsingImports() constGet all active using imports (from all enclosing scopes).
Related: UsingImport
getAllFunctions
public · function · Source (opens in a new tab)
std::vector< FunctionInfo > sun::semantic_analysis::SemanticContext::getAllFunctions(const std::string &name) constEvery overload declared under the given name.
Related: FunctionInfo
getCurrentClass
public · function · Source (opens in a new tab)
std::shared_ptr< ClassType > sun::semantic_analysis::SemanticContext::getCurrentClass() constThe class whose body is being analyzed, or null outside one.
Related: sun::types::ClassType
getCurrentScopePath
public · function · Source (opens in a new tab)
std::vector< std::string > sun::semantic_analysis::SemanticContext::getCurrentScopePath() constGet the current scope path as a vector of segments.
e.g., inside "module A { module B { } }", returns {"A", "B"}.
getFullModulePath
public · function · Source (opens in a new tab)
std::string sun::semantic_analysis::SemanticContext::getFullModulePath(const std::string &visiblePath) constGet the full module path including library scope hashes.
e.g., "b" -> "$hash$.b" if b is inside a library scope.
getNarrowedType
public · function · Source (opens in a new tab)
TypePtr sun::semantic_analysis::SemanticContext::getNarrowedType(const std::string &varName, sun::types::TypePtr originalType) constThe narrowed type in effect for a variable, or its original type when no guard applies.
The more specific of the two wins (class over interface).
Related: sun::types::TypePtr
isAccessible
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticContext::isAccessible(const sun::semantic_analysis::ItemRef &item) constTrue when item is reachable from the current module.
Related: sun::semantic_analysis::ItemRef
isAtModuleLevel
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticContext::isAtModuleLevel() constTrue when not inside any function scope (i.e.
at module/global level).
isCollectingDeclarations
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticContext::isCollectingDeclarations() constWhether type declarations are being collected before body analysis.
isInMoonScope
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticContext::isInMoonScope() constAre we analyzing the stubs a moon import carries?
A stub keeps only its signature — the body is stripped to an empty block — so checks about what a body does (such as returning on every path) do not apply there.
isInThrowingFunction
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticContext::isInThrowingFunction() constCheck if we're currently inside a function declared with "throws IError".
Traverses parent scopes to find the nearest function scope.
isInTryBlock
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticContext::isInTryBlock() constCheck if we're currently inside a try block.
isInUnsafeBlock
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticContext::isInUnsafeBlock() constCheck if we're currently inside an unsafe block.
isModuleName
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticContext::isModuleName(const std::string &name) constTrue when the name refers to a module, so x.y can be read as a qualified name rather than a member access on a value.
lookupClass
public · function · Source (opens in a new tab)
std::shared_ptr< ClassType > sun::semantic_analysis::SemanticContext::lookupClass(const std::string &name) constFind a class by name in the scope chain (null when there is none).
Related: sun::types::ClassType
lookupEnum
public · function · Source (opens in a new tab)
std::shared_ptr< sun::types::EnumType > sun::semantic_analysis::SemanticContext::lookupEnum(const std::string &name) constFind an enum by name in the scope chain (null when there is none).
Related: sun::types::EnumType
lookupFunction
public · function · Source (opens in a new tab)
std::optional< FunctionInfo > sun::semantic_analysis::SemanticContext::lookupFunction(const std::string &name, const std::vector< FunctionArgumentType > &argTypes, std::optional< sun::support::Position > loc=std::nullopt) constSelect an overload by preferred argument types, then by their alternatives.
Returns nullopt when no overload matches.
Related: FunctionInfo, FunctionArgumentType, sun::support::Position
lookupGenericClass
lookupGenericClass(const std::string &name) const
public · function · Source (opens in a new tab)
const GenericClassInfo * sun::semantic_analysis::SemanticContext::lookupGenericClass(const std::string &name) constFind a generic class template by name in the scope chain.
Related: GenericClassInfo
lookupGenericClass(sun::semantic_analysis::DeclarationId id) const
public · function · Source (opens in a new tab)
const GenericClassInfo * sun::semantic_analysis::SemanticContext::lookupGenericClass(sun::semantic_analysis::DeclarationId id) constRetrieve an already selected template from the retained scope tree.
Related: GenericClassInfo, sun::semantic_analysis::DeclarationId
lookupGenericEnum
lookupGenericEnum(const std::string &name) const
public · function · Source (opens in a new tab)
const GenericEnumInfo * sun::semantic_analysis::SemanticContext::lookupGenericEnum(const std::string &name) constFind a generic enum template by name in the scope chain.
Related: GenericEnumInfo
lookupGenericEnum(sun::semantic_analysis::DeclarationId id) const
public · function · Source (opens in a new tab)
const GenericEnumInfo * sun::semantic_analysis::SemanticContext::lookupGenericEnum(sun::semantic_analysis::DeclarationId id) constRetrieve an already selected template from the retained scope tree.
Related: GenericEnumInfo, sun::semantic_analysis::DeclarationId
lookupGenericFunction
public · function · Source (opens in a new tab)
const GenericFunctionInfo * sun::semantic_analysis::SemanticContext::lookupGenericFunction(const std::string &name) constLook up a generic function by name.
Tries the direct name first, then falls back to enclosing function prefix + name (for nested generic functions).
Related: GenericFunctionInfo
lookupGenericInterface
lookupGenericInterface(sun::semantic_analysis::DeclarationId id) const
public · function · Source (opens in a new tab)
const GenericInterfaceInfo * sun::semantic_analysis::SemanticContext::lookupGenericInterface(sun::semantic_analysis::DeclarationId id) constRetrieve an already selected template from the retained scope tree.
Related: GenericInterfaceInfo, sun::semantic_analysis::DeclarationId
lookupGenericInterface(const std::string &name) const
public · function · Source (opens in a new tab)
const GenericInterfaceInfo * sun::semantic_analysis::SemanticContext::lookupGenericInterface(const std::string &name) constFind a generic interface template by name in the scope chain.
Related: GenericInterfaceInfo
lookupInterface
public · function · Source (opens in a new tab)
std::shared_ptr< InterfaceType > sun::semantic_analysis::SemanticContext::lookupInterface(const std::string &name) constFind an interface by name in the scope chain, falling back to the builtin interfaces (IError).
Related: sun::types::InterfaceType
lookupModuleScope
lookupModuleScope(sun::semantic_analysis::DeclarationId id) const
public · function · Source (opens in a new tab)
SemanticScopeBase * sun::semantic_analysis::SemanticContext::lookupModuleScope(sun::semantic_analysis::DeclarationId id) constRetrieve a module already selected by its declaration identity.
Related: SemanticScopeBase, sun::semantic_analysis::DeclarationId
lookupModuleScope(const std::string &dotPath) const
public · function · Source (opens in a new tab)
SemanticScope * sun::semantic_analysis::SemanticContext::lookupModuleScope(const std::string &dotPath) constTraverse childModules from global scope to find a module by dot-separated path (e.g., "std" or "std.collections").
Returns nullptr if not found.
Related: SemanticScope
lookupQualifiedFunction
public · function · Source (opens in a new tab)
const FunctionInfo * sun::semantic_analysis::SemanticContext::lookupQualifiedFunction(const std::string &qualifiedName) constFind a function by its dotted name (a.b.f); undotted names never match.
Related: FunctionInfo
lookupQualifiedVariable
public · function · Source (opens in a new tab)
VariableInfo * sun::semantic_analysis::SemanticContext::lookupQualifiedVariable(const std::string &qualifiedName)Find a variable by its dotted name (a.b.x).
An undotted name is an ordinary variable lookup.
Related: VariableInfo
narrowVariable
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::narrowVariable(const std::string &varName, sun::types::TypePtr narrowedType)Narrow a variable's type for the rest of the current scope, after an _is<T> guard proved it holds a T.
Related: sun::types::TypePtr
requireAccessible
requireAccessible(const sun::semantic_analysis::ItemRef &item) const
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::requireAccessible(const sun::semantic_analysis::ItemRef &item) constThe same, pointing at the innermost recorded location.
Related: sun::semantic_analysis::ItemRef
requireAccessible(const sun::semantic_analysis::ItemRef &item, const sun::support::Position &loc) const
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::requireAccessible(const sun::semantic_analysis::ItemRef &item, const sun::support::Position &loc) constThrow at loc unless item is reachable from the current module.
Related: sun::semantic_analysis::ItemRef, sun::support::Position
requireDeclaration
public · function · Source (opens in a new tab)
DeclarationId sun::semantic_analysis::SemanticContext::requireDeclaration(const sun::semantic_analysis::PortableDeclarationKey &key, const std::string &exporter="", std::optional< sun::types::Type::Kind > expectedKind=std::nullopt, const std::string &displayName="") constRequire the original nominal declaration, without source-name fallback.
Related: sun::semantic_analysis::DeclarationId, sun::semantic_analysis::PortableDeclarationKey, sun::types::Type::Kind
requireModuleAccessible
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::requireModuleAccessible(const SemanticScopeBase &moduleScope, const sun::support::Position &loc) constA module named by user code (a.b, using a.b;, b.f()): every module on its path must be visible from here.
Related: SemanticScopeBase, sun::support::Position
resolveNameWithUsings
public · function · Source (opens in a new tab)
QualifiedName sun::semantic_analysis::SemanticContext::resolveNameWithUsings(const std::string &name) constResolve a bare name against the using imports in scope, giving the qualified name it refers to (the name itself when nothing matches).
Related: sun::semantic_analysis::QualifiedName
results
results() const
public · function · Source (opens in a new tab)
const AnalysisResults & sun::semantic_analysis::SemanticContext::results() constRead-only view of the program-wide analysis results.
Related: AnalysisResults
results()
public · function · Source (opens in a new tab)
AnalysisResults & sun::semantic_analysis::SemanticContext::results()What analysis concludes about the whole program.
Complete once the analysis pipeline has run; later stages only read it.
Related: AnalysisResults
rootScope
rootScope() const
public · function · Source (opens in a new tab)
const SemanticScope & sun::semantic_analysis::SemanticContext::rootScope() constReturns the outermost scope containing the analyzed program.
Related: SemanticScope
rootScope()
public · function · Source (opens in a new tab)
SemanticScope & sun::semantic_analysis::SemanticContext::rootScope()The global scope, for debugging and visualization.
Related: SemanticScope
scope
public · function · Source (opens in a new tab)
SemanticScope * sun::semantic_analysis::SemanticContext::scope() constThe scope currently being analyzed.
Related: SemanticScope
setCurrentClass
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::setCurrentClass(std::shared_ptr< sun::types::ClassType > classType)Set the class whose body is being analyzed, so this resolves to it.
Related: sun::types::ClassType
types
public · function · Source (opens in a new tab)
const std::shared_ptr< sun::semantic_analysis::TypeRegistry > & sun::semantic_analysis::SemanticContext::types() constClass and interface types, shared with codegen.
Related: sun::semantic_analysis::TypeRegistry
Public Fields
classDefinitions
public · variable · Source (opens in a new tab)
std::map<DeclarationId, ClassDefinition> sun::semantic_analysis::SemanticContext::classDefinitionsNo documentation comment.
Related: DeclarationId, ClassDefinition
interfaceDefinitions
public · variable · Source (opens in a new tab)
std::map<DeclarationId, InterfaceDefinition> sun::semantic_analysis::SemanticContext::interfaceDefinitionsNo documentation comment.
Related: DeclarationId, InterfaceDefinition
Private Functions
registerBuiltinFunctions
private · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticContext::registerBuiltinFunctions()Register built-in functions (print, println, file I/O, etc.).
Private Fields
- activeLifetimeNames_
- allowThisLifetime_
- builtinResult_
- currentClass_
- currentScope_
- declarationCollectionDepth_
- declarations_
- locationStack_
- moonScopeDepth_
- results_
- rootScope_
- sourceFileId_
activeLifetimeNames_
private · variable · Source (opens in a new tab)
std::vector<std::string> sun::semantic_analysis::SemanticContext::activeLifetimeNames_No documentation comment.
allowThisLifetime_
private · variable · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticContext::allowThisLifetime_ = falseNo documentation comment.
builtinResult_
private · variable · Source (opens in a new tab)
std::shared_ptr<sun::ast::EnumDefinitionAST> sun::semantic_analysis::SemanticContext::builtinResult_No documentation comment.
Related: sun::ast::EnumDefinitionAST
currentClass_
private · variable · Source (opens in a new tab)
std::shared_ptr<sun::types::ClassType> sun::semantic_analysis::SemanticContext::currentClass_ = nullptrNo documentation comment.
Related: sun::types::ClassType
currentScope_
private · variable · Source (opens in a new tab)
SemanticScope* sun::semantic_analysis::SemanticContext::currentScope_ = rootScope_.get()No documentation comment.
Related: SemanticScope
declarationCollectionDepth_
private · variable · Source (opens in a new tab)
size_t sun::semantic_analysis::SemanticContext::declarationCollectionDepth_ = 0No documentation comment.
declarations_
private · variable · Source (opens in a new tab)
DeclarationState sun::semantic_analysis::SemanticContext::declarations_No documentation comment.
Related: DeclarationState
locationStack_
private · variable · Source (opens in a new tab)
std::vector<const sun::support::Position *> sun::semantic_analysis::SemanticContext::locationStack_No documentation comment.
Related: sun::support::Position
moonScopeDepth_
private · variable · Source (opens in a new tab)
int sun::semantic_analysis::SemanticContext::moonScopeDepth_ = 0No documentation comment.
results_
private · variable · Source (opens in a new tab)
std::shared_ptr<AnalysisResults> sun::semantic_analysis::SemanticContext::results_No documentation comment.
Related: AnalysisResults
rootScope_
private · variable · Source (opens in a new tab)
std::shared_ptr<GlobalScope> sun::semantic_analysis::SemanticContext::rootScope_ = std::make_shared<GlobalScope>()No documentation comment.
Related: GlobalScope
sourceFileId_
private · variable · Source (opens in a new tab)
SourceFileId sun::semantic_analysis::SemanticContext::sourceFileId_ = 0No documentation comment.
Related: SourceFileId