Conversation
…ingPattern function parameter
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.
Hello.
This PR adds a test case where IteratorBindingInitialization throws on ArrayBindingPattern function parameter.
In this particular PR, in both files, Arguments don't exist. So Evaluation of NewExpression :
newNewExpression is performed and calls EvaluateNew(|NewExpression|,empty).argList defined in EvaluateNew is set as an empty List. And argList propagates to FunctionDeclarationInstantiation as argumentsList. Also in EvaluateNew, constructor is defined as GetValue(ref) where ref is Evaluation of |NewExpression|. And constructor propagates to FunctionDeclarationInstantiation as func.
In FunctionDeclarationInstantiation step 4, formals is defined as func.[[FormalParameters]].
In FunctionDeclarationInstantiation step 24, iteratorRecord is defined as CreateListIteratorRecord(argumentsList). After that in step 26.a, IteratorBindingInitialization of formals with arguments iteratorRecord and env. is performed.
After this, the two files take slightly different paths. I will address them separately.
iteratorbindinginitialization-formalparameter-throws.jsIn IteratorBindingInitialization of FormalParameterList
,FormalParameter, step 1 is successfully finished and iteratorRecord.[[Done]] is set as true.In IteratorBindingInitialization of FormalParameterList
,FormalParameter step 2, IteratorBindingInitialization of |FormalParameter| with arguments iteratorRecord and environment is performed.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.In BindingInitialization of BindingPattern : ArrayBindingPattern step 1, GetIterator(v,
sync) is called.In GetIterator step 2.a, GetMethod(v, %Symbol.iterator) is called. And in GetMethod step 1, GetV(v, %Symbol.iterator) is called.
In GetV step 1, ToObject(v) is called and throws TypeError since v is
undefined.iteratorbindinginitialization-functionrestparameter-throws.jsIn IteratorBindingInitialization of FormalParameters : FormalParameterList
,FunctionRestParameter step 1, IteratorBindingInitialization of |FormalParameterList| with arguments iteratorRecord and environment is performed.In IteratorBindingInitialization of BindingElement : BindingPattern Initializer? step 1, v is defined as
undefined. And in step 2, iteratorRecord.[[Done]] is set astrue. After that, in step 4, BindingInitialization of |BindingPattern| with arguments v and environment is performed.After is the same with
iteratorbindinginitialization-formalparameter-throws.js.