Skip to content

fix Set iterator not reflecting mutations after creation (#1671)#1687

Open
RealColdFry wants to merge 1 commit intoTypeScriptToLua:masterfrom
RealColdFry:fix/set-iterator-mutation
Open

fix Set iterator not reflecting mutations after creation (#1671)#1687
RealColdFry wants to merge 1 commit intoTypeScriptToLua:masterfrom
RealColdFry:fix/set-iterator-mutation

Conversation

@RealColdFry
Copy link

@RealColdFry RealColdFry commented Mar 17, 2026

Fixes #1671

Set.values(), keys(), and entries() eagerly captured firstKey at iterator creation time. If the Set was mutated (e.g. via delete) before the iterator was consumed, the iterator still saw the stale firstKey. Read firstKey lazily on the first next() call instead.

…oLua#1671)

Set.values(), keys(), and entries() eagerly captured firstKey at
iterator creation time. If the Set was mutated (e.g. via delete)
before the iterator was consumed, the iterator still saw the stale
firstKey. Read firstKey lazily on the first next() call instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set.prototype.values() should change if origin Set changes.

1 participant