mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
updated lite-client
This commit is contained in:
parent
4dd5eea11f
commit
4b5dd4525e
27 changed files with 204 additions and 29 deletions
|
@ -289,6 +289,31 @@ Ref<Atom> StackEntry::as_atom() && {
|
|||
return move_as<Atom, t_atom>();
|
||||
}
|
||||
|
||||
bool StackEntry::for_each_scalar(const std::function<bool(const StackEntry&)>& func) const {
|
||||
auto t = as<Tuple, t_tuple>();
|
||||
if (t.not_null()) {
|
||||
for (const auto& entry : *t) {
|
||||
if (!entry.for_each_scalar(func)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return func(*this);
|
||||
}
|
||||
}
|
||||
|
||||
void StackEntry::for_each_scalar(const std::function<void(const StackEntry&)>& func) const {
|
||||
auto t = as<Tuple, t_tuple>();
|
||||
if (t.not_null()) {
|
||||
for (const auto& entry : *t) {
|
||||
entry.for_each_scalar(func);
|
||||
}
|
||||
} else {
|
||||
func(*this);
|
||||
}
|
||||
}
|
||||
|
||||
const StackEntry& tuple_index(const Tuple& tup, unsigned idx) {
|
||||
if (idx >= tup->size()) {
|
||||
throw VmError{Excno::range_chk, "tuple index out of range"};
|
||||
|
@ -672,6 +697,21 @@ void Stack::push_maybe_cellslice(Ref<CellSlice> cs) {
|
|||
push_maybe(std::move(cs));
|
||||
}
|
||||
|
||||
bool Stack::for_each_scalar(const std::function<bool(const StackEntry&)>& func) const {
|
||||
for (const auto& v : stack) {
|
||||
if (!v.for_each_scalar(func)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Stack::for_each_scalar(const std::function<void(const StackEntry&)>& func) const {
|
||||
for (const auto& v : stack) {
|
||||
v.for_each_scalar(func);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* SERIALIZE/DESERIALIZE STACK VALUES
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue