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

A class to store fields captured by a closure. More...

#include <ClosureScope.hpp>

Collaboration diagram for Ark::internal::ClosureScope:
[legend]

Public Member Functions

 ClosureScope () noexcept=default
 Create a new ClosureScope.
 
void push_back (uint16_t id, Value &&val)
 Put a value in the scope.
 
void push_back (uint16_t id, const Value &val)
 Put a value in the scope.
 
Valueoperator[] (uint16_t id_to_look_for)
 
void mergeRefInto (ScopeView &other)
 Merge values from this scope as refs in the other scope.
 

Private Attributes

std::vector< std::pair< uint16_t, Value > > m_data
 

Friends

class Closure
 
ARK_API bool operator== (const ClosureScope &A, const ClosureScope &B)
 

Detailed Description

A class to store fields captured by a closure.

Definition at line 28 of file ClosureScope.hpp.

Constructor & Destructor Documentation

◆ ClosureScope()

Ark::internal::ClosureScope::ClosureScope ( )
defaultnoexcept

Create a new ClosureScope.

Member Function Documentation

◆ mergeRefInto()

void Ark::internal::ClosureScope::mergeRefInto ( ScopeView & other)

Merge values from this scope as refs in the other scope.

This scope must be kept alive for the ref to be used

Parameters
other

Definition at line 27 of file ClosureScope.cpp.

References m_data, Ark::internal::ScopeView::push_back(), and Ark::Reference.

◆ operator[]()

Value * Ark::internal::ClosureScope::operator[] ( uint16_t id_to_look_for)

Definition at line 17 of file ClosureScope.cpp.

References m_data.

◆ push_back() [1/2]

void Ark::internal::ClosureScope::push_back ( uint16_t id,
const Value & val )

Put a value in the scope.

Parameters
idThe symbol id of the variable
valThe value linked to the symbol

Definition at line 12 of file ClosureScope.cpp.

References m_data.

◆ push_back() [2/2]

void Ark::internal::ClosureScope::push_back ( uint16_t id,
Value && val )

Put a value in the scope.

Parameters
idThe symbol id of the variable
valThe value linked to the symbol

Definition at line 7 of file ClosureScope.cpp.

References m_data.

Friends And Related Symbol Documentation

◆ Closure

friend class Closure
friend

Definition at line 61 of file ClosureScope.hpp.

◆ operator==

ARK_API bool operator== ( const ClosureScope & A,
const ClosureScope & B )
friend

Definition at line 38 of file ClosureScope.cpp.

Member Data Documentation

◆ m_data

std::vector<std::pair<uint16_t, Value> > Ark::internal::ClosureScope::m_data
private

Definition at line 66 of file ClosureScope.hpp.

Referenced by mergeRefInto(), operator[](), push_back(), and push_back().


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