A class to handle the VM scope more efficiently.
More...
#include <Scope.hpp>
|
| Scope () noexcept |
| Construct a new Scope object.
|
|
void | mergeRefInto (Scope &other) |
| Merge values from this scope as refs in the other scope.
|
|
void | push_back (uint16_t id, Value &&val) noexcept |
| Put a value in the scope.
|
|
void | push_back (uint16_t id, const Value &val) noexcept |
| Put a value in the scope.
|
|
bool | has (uint16_t id) noexcept |
| Check if the scope has a specific symbol in memory.
|
|
Value * | operator[] (uint16_t id_to_look_for) noexcept |
| Get a value from its symbol id.
|
|
const Value * | operator[] (uint16_t id_to_look_for) const noexcept |
| Get a value from its symbol id.
|
|
uint16_t | idFromValue (const Value &val) const noexcept |
| Get the id of a variable based on its value ; used for debug only.
|
|
std::size_t | size () const noexcept |
| Return the size of the scope.
|
|
|
std::vector< std::pair< uint16_t, Value > > | m_data |
|
uint16_t | m_min_id |
| Minimum stored ID, used for a basic bloom filter.
|
|
uint16_t | m_max_id |
| Maximum stored ID, used for a basic bloom filter.
|
|
A class to handle the VM scope more efficiently.
Definition at line 27 of file Scope.hpp.
◆ Scope()
Ark::internal::Scope::Scope |
( |
| ) |
|
|
noexcept |
◆ has()
bool Ark::internal::Scope::has |
( |
uint16_t | id | ) |
|
|
noexcept |
Check if the scope has a specific symbol in memory.
- Parameters
-
- Returns
- true On success
-
false Otherwise
Definition at line 44 of file Scope.cpp.
◆ idFromValue()
uint16_t Ark::internal::Scope::idFromValue |
( |
const Value & | val | ) |
const |
|
nodiscardnoexcept |
Get the id of a variable based on its value ; used for debug only.
- Parameters
-
- Returns
- uint16_t
Definition at line 69 of file Scope.cpp.
◆ mergeRefInto()
void Ark::internal::Scope::mergeRefInto |
( |
Scope & | 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
-
Definition at line 13 of file Scope.cpp.
References m_data, push_back(), and Ark::Reference.
◆ operator[]() [1/2]
const Value * Ark::internal::Scope::operator[] |
( |
uint16_t | id_to_look_for | ) |
const |
|
noexcept |
Get a value from its symbol id.
- Parameters
-
- Returns
- const Value* Returns nullptr if the value can not be found
Definition at line 59 of file Scope.cpp.
◆ operator[]() [2/2]
Value * Ark::internal::Scope::operator[] |
( |
uint16_t | id_to_look_for | ) |
|
|
noexcept |
Get a value from its symbol id.
- Parameters
-
- Returns
- Value* Returns nullptr if the value can not be found
Definition at line 49 of file Scope.cpp.
◆ push_back() [1/2]
void Ark::internal::Scope::push_back |
( |
uint16_t | id, |
|
|
const Value & | val ) |
|
noexcept |
Put a value in the scope.
- Parameters
-
id | The symbol id of the variable |
val | The value linked to the symbol |
Definition at line 34 of file Scope.cpp.
◆ push_back() [2/2]
void Ark::internal::Scope::push_back |
( |
uint16_t | id, |
|
|
Value && | val ) |
|
noexcept |
Put a value in the scope.
- Parameters
-
id | The symbol id of the variable |
val | The value linked to the symbol |
Definition at line 24 of file Scope.cpp.
Referenced by mergeRefInto().
◆ size()
std::size_t Ark::internal::Scope::size |
( |
| ) |
const |
|
nodiscardnoexcept |
◆ Ark::internal::Closure
◆ Ark::VM
◆ operator==
◆ m_data
std::vector<std::pair<uint16_t, Value> > Ark::internal::Scope::m_data |
|
private |
◆ m_max_id
uint16_t Ark::internal::Scope::m_max_id |
|
private |
Maximum stored ID, used for a basic bloom filter.
Definition at line 107 of file Scope.hpp.
◆ m_min_id
uint16_t Ark::internal::Scope::m_min_id |
|
private |
Minimum stored ID, used for a basic bloom filter.
Definition at line 106 of file Scope.hpp.
The documentation for this class was generated from the following files:
- /Users/fola/Documents/ArkScript/Ark/include/Ark/VM/Scope.hpp
- /Users/fola/Documents/ArkScript/Ark/src/arkreactor/VM/Scope.cpp