1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
* License, v. 2.0. If a copy of the MPL was not distributed with this
4
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7
//-----------------------------------------------------------------------------
8
var BUGNUMBER = 683738;
9
var summary = 'return with argument and lazy generator detection';
13
//-----------------------------------------------------------------------------
15
//-----------------------------------------------------------------------------
20
printBugNumber(BUGNUMBER);
21
printStatus (summary);
23
expect = "generator function foo returns a value";
27
eval("function foo(x) { if (x) { return this; } else { yield 3; } }");
33
reportCompare(expect, actual, summary + ": 1");
35
expect = "generator function foo returns a value";
39
eval("function foo(x) { if (x) { yield 3; } else { return this; } }");
45
reportCompare(expect, actual, summary + ": 2");
47
expect = "generator function foo returns a value";
51
eval("function foo(x) { if (x) { return this; } else { (yield 3); } }");
57
reportCompare(expect, actual, summary + ": 3");
59
expect = "generator function foo returns a value";
63
eval("function foo(x) { if (x) { (yield 3); } else { return this; } }");
69
reportCompare(expect, actual, summary + ": 4");