Bug 1012480 - Do not treat star generator's iterator as legacy generator's iterator in for..in loop. r=jorendorff

This commit is contained in:
Tooru Fujisawa 2014-07-29 03:05:46 +09:00
Родитель 8e5ac9f1ae
Коммит edcad2a7e9
2 изменённых файлов: 48 добавлений и 6 удалений

Просмотреть файл

@ -0,0 +1,48 @@
load(libdir + "eqArrayHelper.js");
var iter;
var hit;
hit = 0;
iter = function*(){ hit++; };
assertEqArray([x for (x in iter)],
[]);
assertEqArray([x for each (x in iter)],
[]);
assertEq(hit, 0);
hit = 0;
iter = function*(){ hit++; };
iter["foo"] = "bar";
assertEqArray([x for (x in iter)],
["foo"]);
assertEqArray([x for each (x in iter)],
["bar"]);
assertEq(hit, 0);
hit = 0;
iter = function*(){ hit++; }();
assertEqArray([x for (x in iter)],
[]);
assertEqArray([x for each (x in iter)],
[]);
assertEq(hit, 0);
hit = 0;
iter = function*(){ hit++; }();
iter["foo"] = "bar";
assertEqArray([x for (x in iter)],
["foo"]);
assertEqArray([x for each (x in iter)],
["bar"]);
assertEq(hit, 0);
hit = 0;
iter = function*(){ hit++; }();
iter["foo"] = 10;
iter["bar"] = 20;
assertEqArray([x for (x in iter)].sort(),
["bar", "foo"]);
assertEqArray([x for each (x in iter)].sort(),
[10, 20]);
assertEq(hit, 0);

Просмотреть файл

@ -1720,12 +1720,6 @@ const Class StarGeneratorObject::class_ = {
nullptr, /* hasInstance */
nullptr, /* construct */
TraceGenerator<StarGeneratorObject>,
JS_NULL_CLASS_SPEC,
{
nullptr, /* outerObject */
nullptr, /* innerObject */
iterator_iteratorObject,
}
};
/*