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

#include <NameResolutionPass.hpp>

Collaboration diagram for Ark::internal::ScopeResolver::Scope:
[legend]

Public Member Functions

void add (const std::string &name, bool is_mutable)
 Add a variable to the scope, given a mutability status.
 
std::optional< Variableget (const std::string &name) const
 Try to return a variable from this scope with a given name.
 
bool has (const std::string &name) const
 

Private Attributes

std::unordered_set< Variablem_vars {}
 

Detailed Description

Definition at line 94 of file NameResolutionPass.hpp.

Member Function Documentation

◆ add()

void Ark::internal::ScopeResolver::Scope::add ( const std::string & name,
bool is_mutable )

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

Parameters
name
is_mutable

Definition at line 12 of file NameResolutionPass.cpp.

References m_vars.

◆ get()

std::optional< Variable > Ark::internal::ScopeResolver::Scope::get ( const std::string & name) const
nodiscard

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

Parameters
name
Returns
std::optional<Variable> std::nullopt if the variable isn't in scope

Definition at line 17 of file NameResolutionPass.cpp.

References Ark::internal::Variable::name.

◆ has()

bool Ark::internal::ScopeResolver::Scope::has ( const std::string & name) const
nodiscard

Definition at line 24 of file NameResolutionPass.cpp.

References Ark::internal::Variable::name.

Member Data Documentation

◆ m_vars

std::unordered_set<Variable> Ark::internal::ScopeResolver::Scope::m_vars {}
private

Definition at line 114 of file NameResolutionPass.hpp.

Referenced by add().


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