blob: ecef5dde74ace5cf67dba031a9cf7388b6314075 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/
*/
var args;
function* upToTen()
{
"use strict";
eval("args = arguments;");
for (var i = 0; i < 9; i++)
yield i;
}
var gen = upToTen();
var i = 0;
for (var v of gen)
{
assertEq(v, i);
i++;
}
assertEq(i, 9);
assertEq(Object.prototype.toString.call(args), "[object Arguments]");
assertEq(args.length, 0);
|