sun::semantic_analysis::SemanticScopeBase
struct · Source (opens in a new tab)
struct sun::semantic_analysis::SemanticScopeBase : public std::enable_shared_from_this< SemanticScopeBase >SemanticScopeBase - Base class for all scope types Contains all fields for backward compatibility during incremental refactor. Inherits enable_shared_from_this to allow weak_ptr references from
GenericClassInfo without creating circular ownership.
Inherits
- std::enable_shared_from_this< SemanticScopeBase > (public)
Inherited by
- sun::semantic_analysis::BlockScope (public)
- sun::semantic_analysis::ClassScope (public)
- sun::semantic_analysis::FunctionScope (public)
- sun::semantic_analysis::GlobalScope (public)
- sun::semantic_analysis::ImportScope (public)
- sun::semantic_analysis::InterfaceScope (public)
- sun::semantic_analysis::ModuleScope (public)
- sun::semantic_analysis::TypeParamsScope (public)
Public Functions
- accessCtx
- admitsImport
- asBlock
- asClass
- asFunction
- asInterface
- cloneSymbols
- collectFunctions
- declareClass
- declareClassDefinition
- declareEnum
- declareFunction
- declareGenericClass
- declareGenericEnum
- declareGenericFunction
- declareGenericInterface
- declareInterface
- declareModule
- declareModuleVariable
- declareTypeAlias
- declareTypeParameters
- declareVariable
- findClass
- findEnum
- findGenericClass
- findGenericEnum
- findGenericInterface
- findInterface
- findUnanalyzedGlobal
- getActiveUsingImports
- getAllFunctions
- getCurrentScopePath
- getType
- hasAccessibleSymbol
- hasSymbol
- isAtModuleLevel
- isModuleName
- isPersistent
- lookupClass
- lookupEnum
- lookupFunction
- lookupFunctionLocal
- lookupGenericClass
- lookupGenericEnum
- lookupGenericFunction
- lookupGenericInterface
- lookupInChain
- lookupInterface
- lookupModuleScope
- lookupParent
- lookupQualifiedFunction
- lookupQualifiedVariable
- lookupVariable
- resolveNameWithUsings
- ~SemanticScopeBase
accessCtx
public · function · Source (opens in a new tab)
const AccessContext * sun::semantic_analysis::SemanticScopeBase::accessCtx() constReturns the scope context used to check declaration visibility.
Related: AccessContext
admitsImport
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticScopeBase::admitsImport(SourceFileId sourceFile) constWhether an import belongs to the source unit performing lookup.
Related: SourceFileId
asBlock
asBlock()
public · function · Source (opens in a new tab)
BlockScope * sun::semantic_analysis::SemanticScopeBase::asBlock()Accesses this scope as a block scope when its kind matches.
Related: BlockScope
asBlock() const
public · function · Source (opens in a new tab)
const BlockScope * sun::semantic_analysis::SemanticScopeBase::asBlock() constAccesses this scope as a block scope when its kind matches.
Related: BlockScope
asClass
asClass()
public · function · Source (opens in a new tab)
ClassScope * sun::semantic_analysis::SemanticScopeBase::asClass()Accesses this scope as a class scope when its kind matches.
Related: ClassScope
asClass() const
public · function · Source (opens in a new tab)
const ClassScope * sun::semantic_analysis::SemanticScopeBase::asClass() constAccesses this scope as a class scope when its kind matches.
Related: ClassScope
asFunction
asFunction()
public · function · Source (opens in a new tab)
FunctionScope * sun::semantic_analysis::SemanticScopeBase::asFunction()===== Downcasting helpers =====
Related: FunctionScope
asFunction() const
public · function · Source (opens in a new tab)
const FunctionScope * sun::semantic_analysis::SemanticScopeBase::asFunction() constAccesses this scope as a function scope when its kind matches.
Related: FunctionScope
asInterface
asInterface()
public · function · Source (opens in a new tab)
InterfaceScope * sun::semantic_analysis::SemanticScopeBase::asInterface()Accesses this scope as a interface scope when its kind matches.
Related: InterfaceScope
asInterface() const
public · function · Source (opens in a new tab)
const InterfaceScope * sun::semantic_analysis::SemanticScopeBase::asInterface() constAccesses this scope as a interface scope when its kind matches.
Related: InterfaceScope
cloneSymbols
public · function · Source (opens in a new tab)
std::shared_ptr< SemanticScopeBase > sun::semantic_analysis::SemanticScopeBase::cloneSymbols(SemanticScopeBase *newParent) constClone symbol tables (for diamond import handling).
Related: SemanticScopeBase
collectFunctions
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticScope::collectFunctions(const std::string &name, std::vector< FunctionInfo > &results) constAppends the visible overloads matching the requested function name.
Related: FunctionInfo
declareClass
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticScopeBase::declareClass(const std::string &name, std::shared_ptr< sun::types::ClassType > classType, std::optional< sun::support::Position > loc=std::nullopt)Record a class in the current scope.
A repeated registration of the same name is ignored, which is what a diamond import produces.
Related: sun::types::ClassType, sun::support::Position
declareClassDefinition
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticScopeBase::declareClassDefinition(const std::string &name, ClassDefinitionAST &definition)Record the source class body associated with a name.
Related: ClassDefinitionAST
declareEnum
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticScopeBase::declareEnum(const std::string &name, std::shared_ptr< sun::types::EnumType > enumType)Record an enum in the current scope.
Related: sun::types::EnumType
declareFunction
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticScopeBase::declareFunction(const std::string &name, const FunctionInfo &info, std::optional< sun::support::Position > loc=std::nullopt)Register a function prototype (key = name + param types for overloads).
Related: FunctionInfo, sun::support::Position
declareGenericClass
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticScopeBase::declareGenericClass(const std::string &name, const GenericClassInfo &info, std::optional< sun::support::Position > loc=std::nullopt)Record a generic class template in the current scope, along with the scope it was declared in, so its bodies resolve names as written there.
Related: GenericClassInfo, sun::support::Position
declareGenericEnum
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticScopeBase::declareGenericEnum(const std::string &name, GenericEnumInfo info)Record a generic enum template in the current scope, along with the scope it was declared in.
Related: GenericEnumInfo
declareGenericFunction
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticScopeBase::declareGenericFunction(FunctionAST &func)Record a generic function template and its declaration scope.
Repeated registration of the same declaration is allowed; another template with the same name in this scope is rejected.
Related: FunctionAST
declareGenericInterface
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticScopeBase::declareGenericInterface(const std::string &name, const GenericInterfaceInfo &info, std::optional< sun::support::Position > loc=std::nullopt)Record a generic interface template in the current scope.
Related: GenericInterfaceInfo, sun::support::Position
declareInterface
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticScopeBase::declareInterface(const std::string &name, std::shared_ptr< sun::types::InterfaceType > interfaceType, std::optional< sun::support::Position > loc=std::nullopt)Record an interface in the current scope.
A repeated registration of the same name is ignored, which is what a diamond import produces.
Related: sun::types::InterfaceType, sun::support::Position
declareModule
declareModule(const std::string &name)
public · function · Source (opens in a new tab)
ModuleScope & sun::semantic_analysis::SemanticScopeBase::declareModule(const std::string &name)Create or reuse a child module without entering it.
Related: ModuleScope
declareModule(const sun::ast::ModuleAST &module)
public · function · Source (opens in a new tab)
ModuleScope & sun::semantic_analysis::SemanticScopeBase::declareModule(const sun::ast::ModuleAST &module)Record a module declaration and validate visibility on reopening.
Related: ModuleScope, sun::ast::ModuleAST
declareModuleVariable
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticScopeBase::declareModuleVariable(const sun::semantic_analysis::QualifiedName &qualifiedName, sun::types::TypePtr type, sun::semantic_analysis::Visibility visibility, bool isConst=false, bool isCExtern=false, sun::semantic_analysis::DeclarationId declarationId={})Record a module-level variable by source name with its visibility.
Related: sun::semantic_analysis::QualifiedName, sun::types::TypePtr, sun::semantic_analysis::Visibility, sun::semantic_analysis::DeclarationId
declareTypeAlias
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticScopeBase::declareTypeAlias(const std::string &name, sun::types::TypePtr type, std::optional< sun::support::Position > loc=std::nullopt)Record a type alias, rejecting a duplicate in this scope.
Related: sun::types::TypePtr, sun::support::Position
declareTypeParameters
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticScopeBase::declareTypeParameters(const std::vector< std::string > ¶ms, const std::vector< sun::types::TypePtr > &args)Bind type parameter names to concrete types in the current scope.
Related: sun::types::TypePtr
declareVariable
public · function · Source (opens in a new tab)
void sun::semantic_analysis::SemanticScopeBase::declareVariable(const std::string &name, sun::types::TypePtr type, bool isParam=false, bool isConst=false, sun::semantic_analysis::DeclarationId declarationId={})Record a variable here, checking reserved names and global shadowing.
Related: sun::types::TypePtr, sun::semantic_analysis::DeclarationId
findClass
public · function · Source (opens in a new tab)
std::shared_ptr< ClassType > sun::semantic_analysis::SemanticScope::findClass(const std::string &name) constLooks up a visible class by name in the accessible scopes.
Related: sun::types::ClassType
findEnum
public · function · Source (opens in a new tab)
std::shared_ptr< EnumType > sun::semantic_analysis::SemanticScope::findEnum(const std::string &name) constLooks up a visible enum by name in the accessible scopes.
Related: sun::types::EnumType
findGenericClass
public · function · Source (opens in a new tab)
const GenericClassInfo * sun::semantic_analysis::SemanticScope::findGenericClass(const std::string &name) constLooks up a visible generic class by name in the accessible scopes.
Related: GenericClassInfo
findGenericEnum
public · function · Source (opens in a new tab)
const GenericEnumInfo * sun::semantic_analysis::SemanticScope::findGenericEnum(const std::string &name) constLooks up a visible generic enum by name in the accessible scopes.
Related: GenericEnumInfo
findGenericInterface
public · function · Source (opens in a new tab)
const GenericInterfaceInfo * sun::semantic_analysis::SemanticScope::findGenericInterface(const std::string &name) constLooks up a visible generic interface by name in the accessible scopes.
Related: GenericInterfaceInfo
findInterface
public · function · Source (opens in a new tab)
std::shared_ptr< InterfaceType > sun::semantic_analysis::SemanticScope::findInterface(const std::string &name) constLooks up a visible interface by name in the accessible scopes.
Related: sun::types::InterfaceType
findUnanalyzedGlobal
public · function · Source (opens in a new tab)
UnanalyzedGlobal sun::semantic_analysis::SemanticScopeBase::findUnanalyzedGlobal(const std::string &name, const DeclarationTable &declarations)The not-yet-analyzed global that name refers to from this scope, and the scope that declares it.
Empty when the name already resolves to a variable or to no global at all. Searches the same scopes lookupVariable does, nearest first, asking declarations which globals each declares.
Related: UnanalyzedGlobal, DeclarationTable
getActiveUsingImports
public · function · Source (opens in a new tab)
std::vector< UsingImport > sun::semantic_analysis::SemanticScopeBase::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::SemanticScopeBase::getAllFunctions(const std::string &name) constGet all function overloads with the given name.
Related: FunctionInfo
getCurrentScopePath
public · function · Source (opens in a new tab)
std::vector< std::string > sun::semantic_analysis::SemanticScopeBase::getCurrentScopePath() constGet the current scope path as a vector of segments.
getType
public · function · Source (opens in a new tab)
virtual ScopeType sun::semantic_analysis::SemanticScopeBase::getType() const =0Get the scope type (virtual - each subclass returns its type).
Related: ScopeType
hasAccessibleSymbol
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticScope::hasAccessibleSymbol(const std::string &name, class AccessFilter &filter) constLike hasSymbol, but only counts symbols the filter admits (private ones are recorded on the filter as denied candidates).
Related: AccessFilter
hasSymbol
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticScope::hasSymbol(const std::string &name) const===== Symbol lookup methods (delegate to persistent scope impl) =====
isAtModuleLevel
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticScopeBase::isAtModuleLevel() constReport whether this scope is outside every function body.
isModuleName
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticScopeBase::isModuleName(const std::string &name) constCheck if a name refers to a module.
isPersistent
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticScopeBase::isPersistent() constCheck if this is a persistent scope type.
lookupClass
public · function · Source (opens in a new tab)
std::shared_ptr< ClassType > sun::semantic_analysis::SemanticScopeBase::lookupClass(const std::string &name) constLookup a class by name in the scope chain.
Related: sun::types::ClassType
lookupEnum
public · function · Source (opens in a new tab)
std::shared_ptr< EnumType > sun::semantic_analysis::SemanticScopeBase::lookupEnum(const std::string &name) constLookup an enum by name in the scope chain.
Related: sun::types::EnumType
lookupFunction
public · function · Source (opens in a new tab)
std::optional< FunctionInfo > sun::semantic_analysis::SemanticScopeBase::lookupFunction(const std::string &name, const std::vector< FunctionArgumentType > &argTypes, std::optional< sun::support::Position > loc=std::nullopt) constSelect an overload by types, then by supplied alternative types.
Related: FunctionInfo, FunctionArgumentType, sun::support::Position
lookupFunctionLocal
public · function · Source (opens in a new tab)
std::optional< FunctionInfo > sun::semantic_analysis::SemanticScopeBase::lookupFunctionLocal(const std::string &name, const std::vector< FunctionArgumentType > &argTypes, class AccessFilter *filter=nullptr, bool matchAlternatives=false, std::optional< sun::support::Position > loc=std::nullopt) constSelect an overload from this scope's own function table.
Record inaccessible candidates on the filter. Setting matchAlternatives enables the fallback pass, which lookupFunction runs only after ordinary lookup finds no match.
Related: FunctionInfo, FunctionArgumentType, AccessFilter, sun::support::Position
lookupGenericClass
public · function · Source (opens in a new tab)
const GenericClassInfo * sun::semantic_analysis::SemanticScopeBase::lookupGenericClass(const std::string &name) constLookup a generic class by name in the scope chain.
Related: GenericClassInfo
lookupGenericEnum
public · function · Source (opens in a new tab)
const GenericEnumInfo * sun::semantic_analysis::SemanticScopeBase::lookupGenericEnum(const std::string &name) constLookup a generic enum by name in the scope chain.
Related: GenericEnumInfo
lookupGenericFunction
public · function · Source (opens in a new tab)
const GenericFunctionInfo * sun::semantic_analysis::SemanticScopeBase::lookupGenericFunction(const std::string &name) constLookup a generic function by name in the scope chain.
Related: GenericFunctionInfo
lookupGenericInterface
public · function · Source (opens in a new tab)
const GenericInterfaceInfo * sun::semantic_analysis::SemanticScopeBase::lookupGenericInterface(const std::string &name) constLookup a generic interface by name in the scope chain.
Related: GenericInterfaceInfo
lookupInChain
public · function · Source (opens in a new tab)
template <typename ResultT, typename Finder>
ResultT sun::semantic_analysis::SemanticScopeBase::lookupInChain(const std::string &name, Finder finder) constGeneric scope-chain traversal: calls finder(scope) at each scope in chain.
lookupInterface
public · function · Source (opens in a new tab)
std::shared_ptr< InterfaceType > sun::semantic_analysis::SemanticScopeBase::lookupInterface(const std::string &name) constLookup an interface by name in the scope chain.
Related: sun::types::InterfaceType
lookupModuleScope
public · function · Source (opens in a new tab)
SemanticScopeBase * sun::semantic_analysis::SemanticScopeBase::lookupModuleScope(const std::string &dotPath) constLookup module scope by dot-separated path.
Related: SemanticScopeBase
lookupParent
public · function · Source (opens in a new tab)
SemanticScopeBase * sun::semantic_analysis::SemanticScopeBase::lookupParent() constReturns the enclosing variable scope, stopping at a library bundle.
Related: SemanticScopeBase
lookupQualifiedFunction
public · function · Source (opens in a new tab)
const FunctionInfo * sun::semantic_analysis::SemanticScopeBase::lookupQualifiedFunction(const std::string &qualifiedName) constLookup a namespaced function (module-qualified).
Related: FunctionInfo
lookupQualifiedVariable
public · function · Source (opens in a new tab)
VariableInfo * sun::semantic_analysis::SemanticScopeBase::lookupQualifiedVariable(const std::string &qualifiedName)Lookup a namespaced variable (module-qualified).
Related: VariableInfo
lookupVariable
public · function · Source (opens in a new tab)
VariableInfo * sun::semantic_analysis::SemanticScopeBase::lookupVariable(const std::string &name)Lookup a variable by name in the scope chain.
Related: VariableInfo
resolveNameWithUsings
public · function · Source (opens in a new tab)
QualifiedName sun::semantic_analysis::SemanticScopeBase::resolveNameWithUsings(const std::string &name) constResolve a name considering using statements and module scopes.
Related: sun::semantic_analysis::QualifiedName
~SemanticScopeBase
public · function · Source (opens in a new tab)
virtual sun::semantic_analysis::SemanticScopeBase::~SemanticScopeBase()=defaultDestroys this object and releases its owned members.
Public Fields
- accessContext
- canonicalModules
- catchBinding
- childModules
- children
- classDefinitions
- classes
- enums
- functions
- genericClasses
- genericEnums
- genericFunctions
- genericInterfaces
- importBindings
- inUnsafeContext
- interfaces
- isExternal
- namespacedVariables
- narrowedTypes
- parent
- scopeName
- scopePath
- tryBlockDepth
- typeAliases
- typeParameters
- unsafeBlockDepth
- usingImports
- variables
accessContext
public · variable · Source (opens in a new tab)
const AccessContext* sun::semantic_analysis::SemanticScopeBase::accessContext = nullptrNo documentation comment.
Related: AccessContext
canonicalModules
public · variable · Source (opens in a new tab)
std::map<std::string, SemanticScopeBase*> sun::semantic_analysis::SemanticScopeBase::canonicalModulesOriginal module paths and nominal declarations, indexed on the root scope.
Related: SemanticScopeBase
catchBinding
public · variable · Source (opens in a new tab)
DeclarationId sun::semantic_analysis::SemanticScopeBase::catchBindingNo documentation comment.
Related: DeclarationId
childModules
public · variable · Source (opens in a new tab)
std::map<std::string, std::shared_ptr<SemanticScopeBase> > sun::semantic_analysis::SemanticScopeBase::childModulesNo documentation comment.
Related: SemanticScopeBase
children
public · variable · Source (opens in a new tab)
std::vector<std::shared_ptr<SemanticScopeBase> > sun::semantic_analysis::SemanticScopeBase::childrenNo documentation comment.
Related: SemanticScopeBase
classDefinitions
public · variable · Source (opens in a new tab)
std::map<std::string, ClassDefinitionAST*> sun::semantic_analysis::SemanticScopeBase::classDefinitionsNo documentation comment.
Related: ClassDefinitionAST
classes
public · variable · Source (opens in a new tab)
std::map<std::string, std::shared_ptr<sun::types::ClassType> > sun::semantic_analysis::SemanticScopeBase::classesNo documentation comment.
Related: sun::types::ClassType
enums
public · variable · Source (opens in a new tab)
std::map<std::string, std::shared_ptr<sun::types::EnumType> > sun::semantic_analysis::SemanticScopeBase::enumsNo documentation comment.
Related: sun::types::EnumType
functions
public · variable · Source (opens in a new tab)
FunctionTable sun::semantic_analysis::SemanticScopeBase::functionsNo documentation comment.
Related: FunctionTable
genericClasses
public · variable · Source (opens in a new tab)
std::map<std::string, GenericClassInfo> sun::semantic_analysis::SemanticScopeBase::genericClassesNo documentation comment.
Related: GenericClassInfo
genericEnums
public · variable · Source (opens in a new tab)
std::map<std::string, GenericEnumInfo> sun::semantic_analysis::SemanticScopeBase::genericEnumsNo documentation comment.
Related: GenericEnumInfo
genericFunctions
public · variable · Source (opens in a new tab)
std::map<std::string, GenericFunctionInfo> sun::semantic_analysis::SemanticScopeBase::genericFunctionsNo documentation comment.
Related: GenericFunctionInfo
genericInterfaces
public · variable · Source (opens in a new tab)
std::map<std::string, GenericInterfaceInfo> sun::semantic_analysis::SemanticScopeBase::genericInterfacesNo documentation comment.
Related: GenericInterfaceInfo
importBindings
public · variable · Source (opens in a new tab)
std::vector<ImportBinding> sun::semantic_analysis::SemanticScopeBase::importBindingsNo documentation comment.
Related: ImportBinding
inUnsafeContext
public · variable · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticScopeBase::inUnsafeContext = falseNo documentation comment.
interfaces
public · variable · Source (opens in a new tab)
std::map<std::string, std::shared_ptr<sun::types::InterfaceType> > sun::semantic_analysis::SemanticScopeBase::interfacesNo documentation comment.
Related: sun::types::InterfaceType
isExternal
public · variable · Source (opens in a new tab)
bool sun::semantic_analysis::SemanticScopeBase::isExternal = falseNo documentation comment.
namespacedVariables
public · variable · Source (opens in a new tab)
std::map<std::string, VariableInfo> sun::semantic_analysis::SemanticScopeBase::namespacedVariablesNo documentation comment.
Related: VariableInfo
narrowedTypes
public · variable · Source (opens in a new tab)
std::map<std::string, sun::types::TypePtr> sun::semantic_analysis::SemanticScopeBase::narrowedTypesNo documentation comment.
Related: sun::types::TypePtr
parent
public · variable · Source (opens in a new tab)
SemanticScopeBase* sun::semantic_analysis::SemanticScopeBase::parent = nullptrNo documentation comment.
Related: SemanticScopeBase
scopeName
public · variable · Source (opens in a new tab)
std::string sun::semantic_analysis::SemanticScopeBase::scopeNameNo documentation comment.
scopePath
public · variable · Source (opens in a new tab)
std::vector<std::string> sun::semantic_analysis::SemanticScopeBase::scopePathNo documentation comment.
tryBlockDepth
public · variable · Source (opens in a new tab)
int sun::semantic_analysis::SemanticScopeBase::tryBlockDepth = 0No documentation comment.
typeAliases
public · variable · Source (opens in a new tab)
std::map<std::string, sun::types::TypePtr> sun::semantic_analysis::SemanticScopeBase::typeAliasesNo documentation comment.
Related: sun::types::TypePtr
typeParameters
public · variable · Source (opens in a new tab)
std::map<std::string, sun::types::TypePtr> sun::semantic_analysis::SemanticScopeBase::typeParametersNo documentation comment.
Related: sun::types::TypePtr
unsafeBlockDepth
public · variable · Source (opens in a new tab)
int sun::semantic_analysis::SemanticScopeBase::unsafeBlockDepth = 0No documentation comment.
usingImports
public · variable · Source (opens in a new tab)
std::vector<UsingImport> sun::semantic_analysis::SemanticScopeBase::usingImportsNo documentation comment.
Related: UsingImport
variables
public · variable · Source (opens in a new tab)
std::map<std::string, VariableInfo> sun::semantic_analysis::SemanticScopeBase::variablesNo documentation comment.
Related: VariableInfo