Simplify testing-only ts_stack_iterate function
This commit is contained in:
parent
5520983144
commit
dbe77e7199
3 changed files with 44 additions and 41 deletions
|
|
@ -54,13 +54,12 @@ vector<StackEntry> get_stack_entries(Stack *stack, StackVersion version) {
|
|||
ts_stack_iterate(
|
||||
stack,
|
||||
version,
|
||||
[](void *payload, TSStateId state, const TreeArray *trees, uint32_t tree_count) -> StackIterateAction {
|
||||
[](void *payload, TSStateId state, uint32_t tree_count) {
|
||||
auto entries = static_cast<vector<StackEntry> *>(payload);
|
||||
StackEntry entry = {state, tree_count};
|
||||
if (find(entries->begin(), entries->end(), entry) == entries->end()) {
|
||||
entries->push_back(entry);
|
||||
}
|
||||
return StackIterateNone;
|
||||
}, &result);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue