зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
8e5ac9f1ae
Коммит
edcad2a7e9
|
@ -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,
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
Загрузка…
Ссылка в новой задаче