-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Cleanup JavascriptEnumerator interface #1400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The JavascriptEnumerator function GetCurrentAndMoveNext is misleading because. Because it move to the next one before return the next element that we moved to. Change to MoveAndGetNext. Also remove MoveNext/GetCurrentIndex/GetCurrentPropertyId, which is equivalent to GetCurrentAndMoveNext. Move all usage of those API to MoveAndGetNext.
@@ -155,11 +150,11 @@ namespace Js | |||
BOOL ForInObjectEnumerator::MoveNext() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we going to change this sometime as well? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still used in Chakra.dll #Resolved
I'm always a bit confused here: should propertyId & propertyName be consistent at this point? should we assert at this point? #Resolved Refers to: lib/Runtime/Library/JavascriptObject.cpp:1152 in 871a891. [](commit_id = 871a891, deletion_comment = False) |
@dotnet-bot test Windows x64_release |
Can we update the comment here? I'll try to enumerate combinations of return value I know. Please let me know if I missed something: Refers to: lib/Runtime/Types/JavascriptEnumerator.h:32 in 871a891. [](commit_id = 871a891, deletion_comment = False) |
|
||
if (enumerator->GetCurrentPropertyId(&idMember)) | ||
if (idMember != Js::Constants::NoProperty) | ||
{ | ||
Js::Var newElement = Walk(Js::JavascriptString::FromVar(propertyNameVar), idMember, value); | ||
if (Js::JavascriptOperators::IsUndefinedObject(newElement, undefined)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we reverse the check order (IsUndefined first before casting to JavascriptString? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh? We are checking for undefined on newElement, and we are not casting that to string. #Resolved
I am planning to refactor is next and change the behavior. So I will document it then. In reply to: 238279890 [](ancestors = 238279890) Refers to: lib/Runtime/Types/JavascriptEnumerator.h:32 in 871a891. [](commit_id = 871a891, deletion_comment = False) |
|
Merge pull request #1400 from curtisman:enumclean The JavascriptEnumerator function GetCurrentAndMoveNext is misleading because. Because it move to the next one before return the next element that we moved to. Change to MoveAndGetNext. Also remove MoveNext/GetCurrentIndex/GetCurrentPropertyId, which is equivalent to GetCurrentAndMoveNext. Move all usage of those API to MoveAndGetNext.
The JavascriptEnumerator function GetCurrentAndMoveNext is misleading because. Because it move to the next one before return the next element that we moved to. Change to MoveAndGetNext.
Also remove MoveNext/GetCurrentIndex/GetCurrentPropertyId, which is equivalent to GetCurrentAndMoveNext. Move all usage of those API to MoveAndGetNext.