28 m_scope(std::make_shared<ClosureScope>(scope)),
39 return std::ranges::any_of(std::ranges::views::keys(
m_scope->m_data), [&vm, &end](
const auto&
id) {
40 return end.ends_with(
":" + vm.m_state.m_symbols[id]);
46 std::string out =
"(";
47 for (std::size_t i = 0, end = m_scope->m_data.size(); i < end; ++i)
49 const auto& [id, value] = m_scope->m_data[i];
53 out +=
'.' + vm.m_state.m_symbols[id] +
'=';
54 if (value.valueType() ==
ValueType::Closure && value.closure().scopePtr() == scopePtr())
57 out += value.toString(vm);
65 if (A.m_page_addr != B.m_page_addr)
68 if (A.m_scope.get() == B.m_scope.get())
71 return *A.m_scope == *B.m_scope;
Subtype of the value type, handling closures.
Subtype of the value type, handling closures.
The ArkScript virtual machine.
The ArkScript virtual machine, executing ArkScript bytecode.
A class to store fields captured by a closure.
std::string toString(VM &vm) const noexcept
Print the closure to a string.
bool hasFieldEndingWith(const std::string &end, const VM &vm) const
Used when generating error messages in the VM, to see if a symbol might have been wrongly fully quali...
std::shared_ptr< ClosureScope > m_scope
Closure(const ClosureScope &scope, PageAddr_t pa) noexcept
Construct a new Closure object.
bool operator==(const Namespace &A, const Namespace &B)