Closed
Bug 1338796
Opened 9 years ago
Closed 9 years ago
IteratorClose shouldn't be called in yield* when resuming generator with Throw completion and throw method is present
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla54
People
(Reporter: anba, Assigned: shu)
References
Details
Attachments
(1 file)
25.28 KB,
patch
|
arai
:
review+
|
Details | Diff | Splinter Review |
Test case:
---
var iterable = {
[Symbol.iterator]() {
return {
next(x) {
print("NEXT called");
return { done: false };
},
return(x) {
print("RETURN called");
return { done: true };
},
throw(e) {
print("THROW called");
throw e;
},
};
}
};
function* y() {
yield* iterable;
}
var g1 = y();
g1.next();
try { g1.throw(); } catch (e) { }
---
Expected: Prints "NEXT called" and then "THROW called", but doesn't print "RETURN called"
Actual: Also prints "RETURN called"
Test case is derived from ecma_6/Generators/yield-star-iterator-close.js
Assignee | ||
Comment 1•9 years ago
|
||
I refactored the iterator.return() code due to yield* out of emitIteratorClose,
because the semantics are fairly different. This lets emitIteratorClose to be
easier to read and be 1:1 with the spec text.
Attachment #8836975 -
Flags: review?(arai.unmht)
Comment 2•9 years ago
|
||
Comment on attachment 8836975 [details] [diff] [review]
Do not call iterator.return if iterator.throw is present in yield*.
Review of attachment 8836975 [details] [diff] [review]:
-----------------------------------------------------------------
yeah, now it's easy to follow the execution, nice :)
::: js/src/frontend/BytecodeEmitter.cpp
@@ +8306,5 @@
> + // Step v.
> + if (!emitCheckIsObj(CheckIsObjectKind::IteratorReturn)) // ITER OLDRESULT FTYPE FVALUE RESULT
> + return false;
> +
> + // Step vi-viii.
Steps
Attachment #8836975 -
Flags: review?(arai.unmht) → review+
Pushed by shu@rfrn.org:
https://hg.mozilla.org/integration/mozilla-inbound/rev/697c73202fb6
Do not call iterator.return if iterator.throw is present in yield*. (r=arai)
Comment 4•9 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Updated•9 years ago
|
Assignee: nobody → shu
Comment 5•9 years ago
|
||
bugherder uplift |
status-firefox53:
--- → fixed
Flags: in-testsuite+
You need to log in
before you can comment on or make changes to this bug.
Description
•