ArkScript
A small, fast, functional and scripting language for video games
Ark::internal::StaticScope Class Reference

#include <StaticScope.hpp>

Inheritance diagram for Ark::internal::StaticScope:
[legend]
Collaboration diagram for Ark::internal::StaticScope:
[legend]

Public Member Functions

virtual ~StaticScope ()=default
 
virtual std::string add (const std::string &name, bool is_mutable)
 Add a Declaration to the scope, given a mutability status.
 
virtual std::optional< Declarationget (const std::string &name, bool extensive_lookup)
 Try to return a Declaration from this scope with a given name.
 
virtual std::string fullyQualifiedName (const std::string &name) const
 Given a Declaration name, compute its fully qualified name.
 
virtual bool saveNamespace (std::unique_ptr< StaticScope > &)
 Save a namespace scope to help with lookup.
 
virtual bool isNamespace () const
 
virtual bool withPrefix () const
 
virtual bool isGlob () const
 
virtual std::string prefix () const
 
virtual bool hasSymbol (const std::string &) const
 
virtual bool recursiveHasSymbol (const std::string &) const
 

Private Attributes

std::unordered_set< Declarationm_vars {}
 

Detailed Description

Definition at line 45 of file StaticScope.hpp.

Constructor & Destructor Documentation

◆ ~StaticScope()

virtual Ark::internal::StaticScope::~StaticScope ( )
virtualdefault

Member Function Documentation

◆ add()

std::string Ark::internal::StaticScope::add ( const std::string & name,
bool is_mutable )
virtual

Add a Declaration to the scope, given a mutability status.

Parameters
name
is_mutable

Reimplemented in Ark::internal::NamespaceScope.

Definition at line 8 of file StaticScope.cpp.

References m_vars.

◆ fullyQualifiedName()

std::string Ark::internal::StaticScope::fullyQualifiedName ( const std::string & name) const
nodiscardvirtual

Given a Declaration name, compute its fully qualified name.

Parameters
name
Returns
std::string fully qualified name in the scope

Reimplemented in Ark::internal::NamespaceScope.

Definition at line 21 of file StaticScope.cpp.

◆ get()

std::optional< Declaration > Ark::internal::StaticScope::get ( const std::string & name,
bool extensive_lookup )
nodiscardvirtual

Try to return a Declaration from this scope with a given name.

Parameters
name
extensive_lookupunused in StaticScope
Returns
std::optional<Declaration> std::nullopt if the Declaration isn't in scope

Reimplemented in Ark::internal::NamespaceScope.

Definition at line 14 of file StaticScope.cpp.

References m_vars, and Ark::internal::Declaration::name.

Referenced by Ark::internal::ScopeResolver::currentScope(), and Ark::internal::NameResolutionPass::visit().

◆ hasSymbol()

virtual bool Ark::internal::StaticScope::hasSymbol ( const std::string & ) const
inlinenodiscardvirtual

Reimplemented in Ark::internal::NamespaceScope.

Definition at line 84 of file StaticScope.hpp.

◆ isGlob()

virtual bool Ark::internal::StaticScope::isGlob ( ) const
inlinenodiscardvirtual

Reimplemented in Ark::internal::NamespaceScope.

Definition at line 82 of file StaticScope.hpp.

◆ isNamespace()

bool Ark::internal::StaticScope::isNamespace ( ) const
nodiscardvirtual

Reimplemented in Ark::internal::NamespaceScope.

Definition at line 32 of file StaticScope.cpp.

◆ prefix()

virtual std::string Ark::internal::StaticScope::prefix ( ) const
inlinenodiscardvirtual

Reimplemented in Ark::internal::NamespaceScope.

Definition at line 83 of file StaticScope.hpp.

◆ recursiveHasSymbol()

virtual bool Ark::internal::StaticScope::recursiveHasSymbol ( const std::string & ) const
inlinenodiscardvirtual

Reimplemented in Ark::internal::NamespaceScope.

Definition at line 85 of file StaticScope.hpp.

◆ saveNamespace()

bool Ark::internal::StaticScope::saveNamespace ( std::unique_ptr< StaticScope > & )
virtual

Save a namespace scope to help with lookup.

Returns
true if the scope was saved, on NamespaceScope
false on StaticScope

Reimplemented in Ark::internal::NamespaceScope.

Definition at line 26 of file StaticScope.cpp.

◆ withPrefix()

virtual bool Ark::internal::StaticScope::withPrefix ( ) const
inlinenodiscardvirtual

Reimplemented in Ark::internal::NamespaceScope.

Definition at line 81 of file StaticScope.hpp.

Member Data Documentation

◆ m_vars

std::unordered_set<Declaration> Ark::internal::StaticScope::m_vars {}
private

Definition at line 88 of file StaticScope.hpp.

Referenced by add(), and get().


The documentation for this class was generated from the following files: