Repository navigation
fix(engine): check iterator completion before requesting rest values (#5648) - #5656
Open
Tushar15769 wants to merge 2 commits into
Open
Tushar15769 wants to merge 2 commits into
Tushar15769 wants to merge 2 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue in array-rest destructuring where
next()could be called again even after the iterator was already marked as done.The problem occurs when earlier elements in the destructuring pattern have already exhausted the iterator. When processing the rest element,
iterator_to_arraywas still callingiterator_next()without checking the iterator's completion state first.The change adds a completion check before requesting the next iterator result. The existing check after
iterator_next()is kept to handle normal iterator exhaustion.It also adds tests covering the following cases:
done: true.next().The changes are limited to
iterator.rsanditerators.rs. No changes were made to the other bugs mentioned in the issue.Tests run:
cargo fmt --all -- --checkcargo test -p boa_engine --libcargo test -p boa_engine --lib -- tests::spreadcargo test --workspaceFixes #5648