Skip to content

Add test case where IteratorBindingInitialization throws on ArrayBindingPattern function parameter#4934

Open
G-Lee1031 wants to merge 1 commit intotc39:mainfrom
G-Lee1031:iteratorbindinginitialization-function-parameter
Open

Add test case where IteratorBindingInitialization throws on ArrayBindingPattern function parameter#4934
G-Lee1031 wants to merge 1 commit intotc39:mainfrom
G-Lee1031:iteratorbindinginitialization-function-parameter

Conversation

@G-Lee1031
Copy link
Contributor

Hello.
This PR adds a test case where IteratorBindingInitialization throws on ArrayBindingPattern function parameter.

After this, the two files take slightly different paths. I will address them separately.

iteratorbindinginitialization-formalparameter-throws.js

  • First
    In IteratorBindingInitialization of FormalParameterList , FormalParameter, step 1 is successfully finished and iteratorRecord.[[Done]] is set as true.
  • Second
    In IteratorBindingInitialization of FormalParameterList , FormalParameter step 2, IteratorBindingInitialization of |FormalParameter| with arguments iteratorRecord and environment is performed.
  • Third
    IteratorBindingInitialization BindingElement : BindingPattern Initializer? is performed. In step 1, v is set as undefined. And in step 4, BindingInitialization of |BindingPattern| with arguments v and environment is performed.
  • Fourth
    In BindingInitialization of BindingPattern : ArrayBindingPattern step 1, GetIterator(v, sync) is called.
  • Fifth
    In GetIterator step 2.a, GetMethod(v, %Symbol.iterator) is called. And in GetMethod step 1, GetV(v, %Symbol.iterator) is called.
  • Sixth
    In GetV step 1, ToObject(v) is called and throws TypeError since v is undefined.

iteratorbindinginitialization-functionrestparameter-throws.js

  • First
    In IteratorBindingInitialization of FormalParameters : FormalParameterList , FunctionRestParameter step 1, IteratorBindingInitialization of |FormalParameterList| with arguments iteratorRecord and environment is performed.
  • Second
    In IteratorBindingInitialization of BindingElement : BindingPattern Initializer? step 1, v is defined as undefined. And in step 2, iteratorRecord.[[Done]] is set as true. After that, in step 4, BindingInitialization of |BindingPattern| with arguments v and environment is performed.

After is the same with iteratorbindinginitialization-formalparameter-throws.js.

@G-Lee1031 G-Lee1031 requested a review from a team as a code owner February 19, 2026 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants