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

ForIn/OfBodyEvaluation: missing return if IteratorComplete #1107

Closed
woess opened this Issue Feb 19, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@woess
Contributor

woess commented Feb 19, 2018

#1066 changed 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation:

-            1. Let _nextResult_ be ? IteratorStep(_iteratorRecord_).
-            1. If _nextResult_ is *false*, return NormalCompletion(_V_).
+            1. Let _nextResult_ be ? Call(_iteratorRecord_.[[NextMethod]], _iteratorRecord_.[[Iterator]], « »).
+            1. If _iteratorKind_ is ~async~, then set _nextResult_ to ? Await(_nextResult_).
+            1. If Type(_nextResult_) is not Object, throw a *TypeError* exception.
             1. Let _nextValue_ be ? IteratorValue(_nextResult_).

Note how the step If _nextResult_ is *false*, return NormalCompletion(_V_). is gone without replacement.

Unless I'm missing something, I believe the following steps should be inserted before Let _nextValue_ be ? IteratorValue(_nextResult_):

1. Let _done_ be ? IteratorComplete(_nextResult_).
1. If _done_ is *true*, then
  1. Return ? IteratorValue(_nextResult_).
@littledan

This comment has been minimized.

Show comment
Hide comment
@littledan
Member

littledan commented Apr 6, 2018

@ljharb ljharb closed this in #1111 Oct 5, 2018

@ljharb ljharb added the spec bug label Oct 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment