fix: skip nested captures (#22)

* fix: skip nested captures

* test: update atom bench
This commit is contained in:
richard 2024-09-28 17:17:54 -07:00 • committed by GitHub
parent 69e5f78463
commit 7c323e5739
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 71 additions and 44 deletions

View file

@ -15,8 +15,10 @@ local function atom<T>(state: T, options: AtomOptions<T>?): Atom<T>
local function atom(...)
if select("#", ...) == 0 then
for set in next, store.capturing do
set[atom] = true
local index = store.capturing.index
if index > 0 then
store.capturing.stack[index][atom] = true
end
return state