mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 097da81cf423.
This commit is contained in:
parent
302bd98617
commit
f39f953a6e
@ -5797,7 +5797,12 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
|
||||
#if JS_HAS_GENERATORS
|
||||
case TOK_YIELD:
|
||||
JS_ASSERT(cg->inFunction());
|
||||
if (!cg->inFunction()) {
|
||||
ReportCompileErrorNumber(cx, CG_TS(cg), pn, JSREPORT_ERROR,
|
||||
JSMSG_BAD_RETURN_OR_YIELD,
|
||||
js_yield_str);
|
||||
return JS_FALSE;
|
||||
}
|
||||
if (pn->pn_kid) {
|
||||
if (!js_EmitTree(cx, cg, pn->pn_kid))
|
||||
return JS_FALSE;
|
||||
|
@ -4786,13 +4786,8 @@ Parser::returnOrYield(bool useAssignExpr)
|
||||
return NULL;
|
||||
|
||||
#if JS_HAS_GENERATORS
|
||||
if (tt == TOK_YIELD) {
|
||||
if (!tc->inFunction()) {
|
||||
reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_BAD_RETURN_OR_YIELD, js_yield_str);
|
||||
return NULL;
|
||||
}
|
||||
if (tt == TOK_YIELD)
|
||||
tc->flags |= TCF_FUN_IS_GENERATOR;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This is ugly, but we don't want to require a semicolon. */
|
||||
|
@ -390,17 +390,6 @@ assertStmt("try { } catch (e if foo) { } catch (e if bar) { } catch (e) { } fina
|
||||
catchClause(ident("e"), null, blockStmt([])) ],
|
||||
blockStmt([])));
|
||||
|
||||
// Bug 632028: yield outside of a function should throw
|
||||
(function() {
|
||||
var threw = false;
|
||||
try {
|
||||
Reflect.parse("yield 0");
|
||||
} catch (expected) {
|
||||
threw = true;
|
||||
}
|
||||
assertEq(threw, true);
|
||||
})();
|
||||
|
||||
// redeclarations (TOK_NAME nodes with lexdef)
|
||||
|
||||
assertStmt("function f() { function g() { } function g() { } }",
|
||||
|
Loading…
Reference in New Issue
Block a user