Bug 1147371: Implement calling IteratorClose and "return" on iterators in yield*

Issue #74
This commit is contained in:
janekptacijarabaci 2018-03-24 12:27:00 +01:00 committed by Roy Tam
commit 95390009cc
10 changed files with 232 additions and 45 deletions

View file

@ -1887,7 +1887,6 @@ CASE(EnableInterruptsPseudoOpcode)
/* Various 1-byte no-ops. */
CASE(JSOP_NOP)
CASE(JSOP_NOP_DESTRUCTURING)
CASE(JSOP_UNUSED187)
CASE(JSOP_UNUSED192)
CASE(JSOP_UNUSED209)
CASE(JSOP_UNUSED210)
@ -2182,6 +2181,13 @@ CASE(JSOP_ENDITER)
}
END_CASE(JSOP_ENDITER)
CASE(JSOP_ISGENCLOSING)
{
bool b = REGS.sp[-1].isMagic(JS_GENERATOR_CLOSING);
PUSH_BOOLEAN(b);
}
END_CASE(JSOP_ISGENCLOSING)
CASE(JSOP_DUP)
{
MOZ_ASSERT(REGS.stackDepth() >= 1);
@ -5074,6 +5080,10 @@ js::ThrowCheckIsObject(JSContext* cx, CheckIsObjectKind kind)
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
JSMSG_ITER_METHOD_RETURNED_PRIMITIVE, "return");
break;
case CheckIsObjectKind::IteratorThrow:
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
JSMSG_ITER_METHOD_RETURNED_PRIMITIVE, "throw");
break;
case CheckIsObjectKind::GetIterator:
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_GET_ITER_RETURNED_PRIMITIVE);
break;