mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1220564 - Update and remove obsolete jit-tests. (r=Waldo)
This commit is contained in:
parent
58f6222d2c
commit
1244258776
@ -1181,62 +1181,6 @@ function test_syntax(postfixes, check_error, ignore_opts) {
|
||||
test("for each (let x in y ");
|
||||
test("for each (let x in y) ");
|
||||
|
||||
// Legacy array comprehensions
|
||||
|
||||
test("[x ");
|
||||
test("[x for ");
|
||||
test("[x for ( ");
|
||||
test("[x for (x ");
|
||||
test("[x for (x of ");
|
||||
test("[x for (x of y ");
|
||||
test("[x for (x of y) ");
|
||||
test("[x for (x of y) if ");
|
||||
test("[x for (x of y) if ( ");
|
||||
test("[x for (x of y) if (x ");
|
||||
test("[x for (x of y) if (x == ");
|
||||
test("[x for (x of y) if (x == 1 ");
|
||||
test("[x for (x of y) if (x == 1) ");
|
||||
test("[x for (x of y) if (x == 1)] ");
|
||||
|
||||
test("[x for (x in ");
|
||||
test("[x for (x in y ");
|
||||
test("[x for (x in y) ");
|
||||
|
||||
test("[x for each ");
|
||||
test("[x for each ( ");
|
||||
test("[x for each (x ");
|
||||
test("[x for each (x in ");
|
||||
test("[x for each (x in y ");
|
||||
test("[x for each (x in y) ");
|
||||
|
||||
// Generator expressions
|
||||
|
||||
test("(x ");
|
||||
test("(x for ");
|
||||
test("(x for ( ");
|
||||
test("(x for (x ");
|
||||
test("(x for (x of ");
|
||||
test("(x for (x of y ");
|
||||
test("(x for (x of y) ");
|
||||
test("(x for (x of y) if ");
|
||||
test("(x for (x of y) if ( ");
|
||||
test("(x for (x of y) if (x ");
|
||||
test("(x for (x of y) if (x == ");
|
||||
test("(x for (x of y) if (x == 1 ");
|
||||
test("(x for (x of y) if (x == 1) ");
|
||||
test("(x for (x of y) if (x == 1)) ");
|
||||
|
||||
test("(x for (x in ");
|
||||
test("(x for (x in y ");
|
||||
test("(x for (x in y) ");
|
||||
|
||||
test("(x for each ");
|
||||
test("(x for each ( ");
|
||||
test("(x for each (x ");
|
||||
test("(x for each (x in ");
|
||||
test("(x for each (x in y ");
|
||||
test("(x for each (x in y) ");
|
||||
|
||||
// asm.js
|
||||
|
||||
test("(function() { 'use asm'; ");
|
||||
|
@ -1,4 +0,0 @@
|
||||
function f1(g=((function () { return 4; }) for (x of [1]))) {
|
||||
return g.next()();
|
||||
}
|
||||
assertEq(f1(), 4);
|
@ -9,7 +9,6 @@ assertEq(f3()()(), true);
|
||||
// These should be okay.
|
||||
function f4(f=(function () { with (Object) {} }), g=(function () { "use strict"; })) {}
|
||||
function f5(g=(function () { "use strict"; }), f=(function () { with (Object) {} })) {}
|
||||
function f6(f=(function () { return (x for (y in (function g() {}))); })) {}
|
||||
|
||||
assertThrowsInstanceOf(function () {
|
||||
eval("function f(a=delete x) { 'use strict'; }");
|
||||
|
@ -1,7 +0,0 @@
|
||||
// No 'arguments' binding in genexprs at toplevel.
|
||||
|
||||
load(libdir + "asserts.js");
|
||||
|
||||
delete this.arguments; // it is defined in the shell
|
||||
var iter = (arguments for (x of [1]));
|
||||
assertThrowsInstanceOf(() => iter.next(), ReferenceError);
|
@ -1,4 +0,0 @@
|
||||
// 'arguments' is lexically scoped in genexprs at toplevel.
|
||||
|
||||
var arguments = 8;
|
||||
assertEq((arguments for (x of [1])).next(), 8);
|
@ -1,6 +0,0 @@
|
||||
// 'arguments' is lexically scoped in genexpr in toplevel let-block.
|
||||
|
||||
{
|
||||
let arguments = [];
|
||||
assertEq((arguments for (p in {a: 1})).next(), arguments);
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
// 'arguments' is lexically scoped in genexpr in function.
|
||||
|
||||
function f() {
|
||||
assertEq((arguments for (x of [0])).next(),
|
||||
(arguments for (y of [1])).next());
|
||||
}
|
||||
f();
|
@ -1,8 +0,0 @@
|
||||
// 'arguments' binding can be closed over and outlives the function activation.
|
||||
|
||||
function f() {
|
||||
return (arguments for (x of [1]));
|
||||
}
|
||||
|
||||
var args = f("ponies").next();
|
||||
assertEq(args[0], "ponies");
|
@ -1,12 +0,0 @@
|
||||
// 'arguments' works in nested genexprs.
|
||||
|
||||
function f() {
|
||||
return ((((((arguments for (u of [0]))
|
||||
for (v of [1]))
|
||||
for (w of [2]))
|
||||
for (x of [3]))
|
||||
for (y of [4]))
|
||||
for (z of [5]));
|
||||
}
|
||||
var args = f("ponies").next().next().next().next().next().next();
|
||||
assertEq(args[0], "ponies");
|
@ -136,15 +136,6 @@ assertAsmTypeFail(USE_ASM + 'return {m() {}};');
|
||||
assertTypeFailInEval('class f { constructor() {"use asm"; return {}} }');
|
||||
assertAsmTypeFail(USE_ASM + 'class c { constructor() {}}; return c;');
|
||||
|
||||
assertAsmTypeFail(USE_ASM + 'function f(i) {i=i|0; (i for (x in [1,2,3])) } return f');
|
||||
assertAsmTypeFail(USE_ASM + 'function f(i) {i=i|0; [i for (x in [1,2,3])] } return f');
|
||||
assertAsmTypeFail(USE_ASM + 'function f() { (x for (x in [1,2,3])) } return f');
|
||||
assertAsmTypeFail(USE_ASM + 'function f() { [x for (x in [1,2,3])] } return f');
|
||||
assertTypeFailInEval('function f() { "use asm"; function g(i) {i=i|0; (i for (x in [1,2,3])) } return g }');
|
||||
assertTypeFailInEval('function f() { "use asm"; function g(i) {i=i|0; [i for (x in [1,2,3])] } return g }');
|
||||
assertTypeFailInEval('function f() { "use asm"; function g() { (x for (x in [1,2,3])) } return g }');
|
||||
assertTypeFailInEval('function f() { "use asm"; function g() { [x for (x in [1,2,3])] } return g }');
|
||||
|
||||
assertThrowsInstanceOf(function() { new Function(USE_ASM + 'var)') }, SyntaxError);
|
||||
assertThrowsInstanceOf(function() { new Function(USE_ASM + 'return)') }, SyntaxError);
|
||||
assertThrowsInstanceOf(function() { new Function(USE_ASM + 'var z=-2w') }, SyntaxError);
|
||||
|
@ -1,13 +0,0 @@
|
||||
// |jit-test| error:TypeError
|
||||
|
||||
// Binary: cache/js-dbg-32-86c8e18f20eb-linux
|
||||
// Flags:
|
||||
//
|
||||
(function(){
|
||||
for each (var x in new (
|
||||
(function (){x})()
|
||||
for each (y in [])
|
||||
)
|
||||
)
|
||||
{const functional=undefined}
|
||||
})()
|
@ -1,4 +0,0 @@
|
||||
// Binary: cache/js-dbg-64-55b6298ff619-linux
|
||||
// Flags:
|
||||
//
|
||||
for(let x in []) {((x = [] for(x in [])) for(y in 0))}
|
@ -1,4 +0,0 @@
|
||||
// Binary: cache/js-dbg-32-9d6f5ab54933-linux
|
||||
// Flags: -j
|
||||
//
|
||||
+[(e = {}, (function () e)()) for each (e in ["", {}, "", {}, ""])][4];
|
@ -1,9 +0,0 @@
|
||||
// Binary: cache/js-dbg-32-b22e82ce2364-linux
|
||||
// Flags: -j
|
||||
//
|
||||
x = (w for (x in []))
|
||||
for (w in [0, 0, 0, 0]) {
|
||||
(function() {
|
||||
[c for (z in x)]
|
||||
})()
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
// Binary: cache/js-dbg-64-f5e128da7b5f-linux
|
||||
// Flags: -j
|
||||
//
|
||||
[(delete(/x/ [x])) for each(x in [0, 0, 0, 0, 0, x, 0, 0, 0x40000001])]
|
@ -1,11 +0,0 @@
|
||||
// Binary: cache/js-dbg-32-e0fc487c23f4-linux
|
||||
// Flags: -j
|
||||
//
|
||||
try {
|
||||
for (window = (0
|
||||
for (x in V)); f;) {}
|
||||
} catch(e) {}
|
||||
for each(let z in [0, 0, 0, 0, 0, 0, 0, 0, 0]) {
|
||||
for (v in window) {}
|
||||
}
|
||||
var e, V
|
@ -1,18 +0,0 @@
|
||||
// Binary: cache/js-dbg-64-acf3c1fb7c94-linux
|
||||
// Flags:
|
||||
//
|
||||
|
||||
genexp = "x * x for (x in [])";
|
||||
genexpParened = "(" + genexp + ")";
|
||||
needParens(2, "if (1, xx) { }");
|
||||
function needParens(section, pat, exp) {
|
||||
ft = pat.replace(/xx/, genexpParened);
|
||||
try {
|
||||
f = new Function(ft);
|
||||
} catch(e) { }
|
||||
overParenTest(section, f, exp);
|
||||
}
|
||||
function overParenTest(section, f, exp) {
|
||||
var uf = "" + f;
|
||||
if (uf.indexOf(genexpParened) != -1) { }
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
// Binary: cache/js-dbg-64-defbe00ca091-linux
|
||||
// Flags:
|
||||
//
|
||||
if (typeof disassemble == 'function') {
|
||||
disassemble(eval(("(function(){(a for each (e in b));})")));
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
// Binary: cache/js-dbg-32-0f66a7ecf8de-linux
|
||||
// Flags:
|
||||
//
|
||||
function n(b = ((function() {}), function() {
|
||||
(a for (r in [function() {}]))
|
||||
})) {}
|
@ -1,15 +0,0 @@
|
||||
// This should not crash (or assert in debug builds).
|
||||
|
||||
(function () {
|
||||
for (b in [0, 0]) {
|
||||
(eval("\
|
||||
[this\
|
||||
for (b in [\
|
||||
[undefined],\
|
||||
arguments,\
|
||||
[undefined]\
|
||||
])\
|
||||
]\
|
||||
"))
|
||||
}
|
||||
})()
|
@ -1,7 +0,0 @@
|
||||
var a = [];
|
||||
for (var i = 0; i < 9; i++)
|
||||
a[i] = 0;
|
||||
var b = [x === "0" && true for (x in a)];
|
||||
assertEq(b[0], true);
|
||||
for (var i = 1; i < 9; i++)
|
||||
assertEq(b[i], false);
|
@ -1,10 +0,0 @@
|
||||
Error.prototype.__proto__.p = 5;
|
||||
f = Function("return( \"\" <arguments for(w in[]))");
|
||||
for (i in f()) {}
|
||||
|
||||
(function() {
|
||||
for (a in (
|
||||
arguments for (l in [0])
|
||||
))
|
||||
{}
|
||||
})()
|
@ -1,10 +0,0 @@
|
||||
// 'this' in generator-expression in strict-mode toplevel
|
||||
// is the same as global 'this'.
|
||||
|
||||
"use strict";
|
||||
|
||||
var it1 = (this for (x of [0]));
|
||||
assertEq(it1.next(), this);
|
||||
|
||||
var it2 = (this for (x of (this for (y of (this for (z of [0]))))));
|
||||
assertEq(it2.next(), this);
|
@ -1,11 +0,0 @@
|
||||
// 'this' in escaping generator-expression in a method
|
||||
// is the same as 'this' in the enclosing method.
|
||||
|
||||
var obj = {
|
||||
f: function () {
|
||||
assertEq(this, obj);
|
||||
return (this for (x of [0]));
|
||||
}
|
||||
};
|
||||
|
||||
assertEq(obj.f().next(), obj);
|
@ -1,11 +0,0 @@
|
||||
// 'this' in escaping generator-expression in a method
|
||||
// is the same as 'this' in the enclosing method
|
||||
// even if the method does not otherwise use 'this'.
|
||||
|
||||
var obj = {
|
||||
f: function () {
|
||||
return (this for (x of [0]));
|
||||
}
|
||||
};
|
||||
|
||||
assertEq(obj.f().next(), obj);
|
@ -1,13 +0,0 @@
|
||||
// 'this' in a generator-expression non-strict function produces the expected
|
||||
// object.
|
||||
|
||||
Number.prototype.iters = function () {
|
||||
return [(this for (x of [0])),
|
||||
(this for (y of [0]))];
|
||||
};
|
||||
|
||||
var [a, b] = (3).iters();
|
||||
var three = a.next();
|
||||
assertEq(Object.prototype.toString.call(three), '[object Number]');
|
||||
assertEq(+three, 3);
|
||||
assertEq(b.next(), three);
|
@ -51,7 +51,7 @@ var invalid_strict_funs = [
|
||||
();
|
||||
},
|
||||
...([]),
|
||||
...[Function("'use strict'\n " + op + " 'not'") for (op of binary_ops)],
|
||||
...(binary_ops.map(op => Function("'use strict'\n " + op + " 'not'"))),
|
||||
];
|
||||
|
||||
for (var f of invalid_strict_funs) {
|
||||
@ -66,9 +66,7 @@ var assignment_ops = [
|
||||
"*=", "/=", "%=",
|
||||
];
|
||||
|
||||
var invalid_strict_funs_referror = [
|
||||
...[("'use strict'\n " + op + " 'not'") for (op of assignment_ops)],
|
||||
];
|
||||
var invalid_strict_funs_referror = assignment_ops.map(op => ("'use strict'\n " + op + " 'not'"));
|
||||
|
||||
// assignment with string literal as LHS is an early error, therefore we
|
||||
// can only test for ReferenceError
|
||||
|
@ -1,13 +0,0 @@
|
||||
|
||||
a = (function() {
|
||||
with({}) var x, arguments, arguments
|
||||
})()
|
||||
|
||||
b = (function() {
|
||||
with({}) {
|
||||
var x = Math, arguments
|
||||
({
|
||||
get: (1 for (x in [])),
|
||||
})
|
||||
}
|
||||
})()
|
@ -1,7 +0,0 @@
|
||||
function getgen() {
|
||||
gen = getgen.caller;
|
||||
}
|
||||
var gen;
|
||||
(getgen() for (x of [1])).next();
|
||||
assertEq(gen.toSource(), "function genexp() {\n [generator expression]\n}");
|
||||
assertEq(gen.toString(), gen.toSource());
|
@ -1,6 +0,0 @@
|
||||
load(libdir + 'range.js');
|
||||
|
||||
function testArrayComp1() {
|
||||
return [a for (a in range(0, 10))].join('');
|
||||
}
|
||||
assertEq(testArrayComp1(), '0123456789');
|
@ -1,7 +0,0 @@
|
||||
load(libdir + 'range.js');
|
||||
|
||||
function testArrayComp2() {
|
||||
return [a + b for (a in range(0, 5)) for (b in range(0, 5))].join('');
|
||||
}
|
||||
|
||||
assertEq(testArrayComp2(), '0123412345234563456745678');
|
@ -1,11 +0,0 @@
|
||||
f = eval("\
|
||||
(function() {\
|
||||
for each(l in[0,0]) {\
|
||||
with(gc()>[this for(x in[function(){}])]) {\
|
||||
var a;\
|
||||
yield\
|
||||
}\
|
||||
}\
|
||||
})\
|
||||
")
|
||||
for (i in f()) {}
|
@ -1,6 +0,0 @@
|
||||
function outer() {
|
||||
(function() {x})
|
||||
assertEq(((function() {return x}) for (x in [42])).next()(), "0");
|
||||
var x;
|
||||
}
|
||||
outer();
|
@ -72,10 +72,6 @@ assertEq((function() { try { throw 3 } catch (e) { (function(){assertEq(e,3)})()
|
||||
assertEq((function() { try { throw 3 } catch (e) { assertEq(e, 3); return (function() e)() } })(), 3);
|
||||
assertEq((function() { try { throw 3 } catch (e) { (function(){eval('assertEq(e,3)')})(); return e } })(), 3);
|
||||
|
||||
assertEq((function() { return [(function() i)() for (i of [3])][0] })(), 3);
|
||||
assertEq((function() { return [((function() i++)(), i) for (i of [2])][0] })(), 3);
|
||||
assertEq((function() { return [(i++, (function() i)()) for (i of [2])][0] })(), 3);
|
||||
|
||||
assertEq((function() { var x; function f() { return x } function f() { return 3 }; return f() })(), 3);
|
||||
assertEq((function() { var x = 3; function f() { return 3 } function f() { return x }; return f() })(), 3);
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
var g = newGlobal();
|
||||
var dbg = new g.Debugger(this);
|
||||
|
||||
try {
|
||||
function f() {}
|
||||
(1 for (x in []))
|
||||
} catch (e) {}
|
||||
gc()
|
@ -1,5 +0,0 @@
|
||||
assertEq(((function() arguments) for (x in [1])).next()(42)[0], 42);
|
||||
assertEq(((function() {return arguments}) for (x in [1])).next()(42)[0], 42);
|
||||
assertEq(((function() {return arguments[0] + arguments[1]}) for (x in [1])).next()(41,1), 42);
|
||||
assertEq(((function() {return arguments[0] + (function() { return arguments[0]})(arguments[1])}) for (x in [1])).next()(41,1), 42);
|
||||
assertEq(((function() { var arguments = 3; return arguments}) for (x in [1])).next()(42), 3);
|
@ -5,7 +5,6 @@ function testInterpreterReentry2() {
|
||||
var d = {};
|
||||
this.__defineGetter__('e', function(){});
|
||||
for (let f in this) print(f);
|
||||
[1 for each (g in this) for each (h in [])]
|
||||
return 1;
|
||||
}
|
||||
assertEq(testInterpreterReentry2(), 1);
|
||||
|
@ -1,7 +1,6 @@
|
||||
function testInterpreterReentry3() {
|
||||
for (let i=0;i<5;++i) this["y" + i] = function(){};
|
||||
this.__defineGetter__('e', function (x2) { yield; });
|
||||
[1 for each (a in this) for (b in {})];
|
||||
return 1;
|
||||
}
|
||||
assertEq(testInterpreterReentry3(), 1);
|
||||
|
@ -190,18 +190,6 @@ test('try {for (let x in eval("throw x")) {}} catch (e) {return e;}', undefined,
|
||||
test('try {for each (let x in x) {eval("throw x");}} catch (e) {return e;}', ['ponies'], undefined);
|
||||
test('for each (let {x: y, y: x} in [{x: x, y: x}]) {return y;}', undefined, undefined);
|
||||
|
||||
// genexps
|
||||
test('return (i for (i in x)).next();', {ponies:true});
|
||||
test('return (eval("i") for (i in x)).next();', {ponies:true});
|
||||
test('return (eval("i") for (i in eval("x"))).next();', {ponies:true});
|
||||
test('try {return (eval("throw i") for (i in x)).next();} catch (e) {return e;}', {ponies:true});
|
||||
|
||||
// array comprehension
|
||||
test('return [i for (i in x)][0];', {ponies:true});
|
||||
test('return [eval("i") for (i in x)][0];', {ponies:true});
|
||||
test('return [eval("i") for (i in eval("x"))][0];', {ponies:true});
|
||||
test('try {return [eval("throw i") for (i in x)][0];} catch (e) {return e;}', {ponies:true});
|
||||
|
||||
// don't forget about switch craziness
|
||||
test('var y = 3;switch (function () {return eval("y");}()) {case 3:let y;return x;default:;}');
|
||||
test('switch (x) {case 3:let y;return 3;case 4:let z;return 4;default:return x;}');
|
||||
|
@ -1,9 +0,0 @@
|
||||
actual = '';
|
||||
expected = 'nocrash,';
|
||||
|
||||
+[(e = {}, (function () e)()) for each (e in ["", {}, "", {}, ""])];
|
||||
|
||||
appendToActual('nocrash')
|
||||
|
||||
|
||||
assertEq(actual, expected)
|
@ -1,28 +0,0 @@
|
||||
actual = '';
|
||||
expected = 'foo4,foo4,';
|
||||
|
||||
v = 0
|
||||
{ let f = function (y) {
|
||||
{ let f = function (y) {
|
||||
{ let f = function (g) {
|
||||
for (h in g) {
|
||||
if (++y > 3) {
|
||||
appendToActual('foo' + y)
|
||||
}
|
||||
}
|
||||
};
|
||||
f([y
|
||||
for (b in [1, []])]);
|
||||
f(['', false])
|
||||
}
|
||||
v = String
|
||||
};
|
||||
f(y)
|
||||
f(y)
|
||||
}
|
||||
};
|
||||
f(v)
|
||||
}
|
||||
|
||||
|
||||
assertEq(actual, expected)
|
@ -1,8 +0,0 @@
|
||||
// The argument to Map can be a generator-expression.
|
||||
|
||||
var arr = [1, 2, "green", "red"];
|
||||
var m = new Map([v, v] for (v of arr));
|
||||
assertEq(m.size, 4);
|
||||
|
||||
for (var i = 0; i < 4; i++)
|
||||
assertEq(m.get(arr[i]), arr[i]);
|
@ -1,10 +1,7 @@
|
||||
// The argument to Map may be a generator-iterator that produces no values.
|
||||
|
||||
var m = new Map(x for (x of []));
|
||||
assertEq(m.size, 0);
|
||||
|
||||
function none() {
|
||||
if (0) yield 0;
|
||||
}
|
||||
m = new Map(none());
|
||||
var m = new Map(none());
|
||||
assertEq(m.size, 0);
|
||||
|
@ -20,7 +20,7 @@ function test(pairs) {
|
||||
}
|
||||
assertEq(log, all_keys);
|
||||
|
||||
var remaining_keys = [k for ([k] of map)].join('');
|
||||
var remaining_keys = [...map].map(([k]) => k).join('');
|
||||
assertEq(remaining_keys, false_keys);
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,6 @@ assertIteratorNext(ki, "three");
|
||||
assertIteratorNext(ki, "four");
|
||||
assertIteratorDone(ki, undefined);
|
||||
|
||||
assertEq([k for (k of m.keys())].toSource(), ["one", "two", "three", "four"].toSource());
|
||||
assertEq([k for (k of m.values())].toSource(), [1, 2, 3, 4].toSource());
|
||||
assertEq([k for (k of m.entries())].toSource(), data.toSource());
|
||||
assertEq([...m.keys()].toSource(), ["one", "two", "three", "four"].toSource());
|
||||
assertEq([...m.values()].toSource(), [1, 2, 3, 4].toSource());
|
||||
assertEq([...m.entries()].toSource(), data.toSource());
|
||||
|
@ -1,8 +0,0 @@
|
||||
// The argument to Set can be a generator-expression.
|
||||
|
||||
var s = new Set(k * k for (k of [1, 2, 3, 4]));
|
||||
assertEq(s.size, 4);
|
||||
assertEq(s.has(1), true);
|
||||
assertEq(s.has(4), true);
|
||||
assertEq(s.has(9), true);
|
||||
assertEq(s.has(16), true);
|
@ -4,7 +4,7 @@ function test(letters, toRemove) {
|
||||
var set = new Set(letters);
|
||||
toRemove = new Set(toRemove);
|
||||
|
||||
var leftovers = [x for (x of set) if (!toRemove.has(x))].join("");
|
||||
var leftovers = [...set].filter(x => !toRemove.has(x)).join("");
|
||||
|
||||
var log = "";
|
||||
for (let x of set) {
|
||||
@ -14,7 +14,7 @@ function test(letters, toRemove) {
|
||||
}
|
||||
assertEq(log, letters);
|
||||
|
||||
var remaining = [x for (x of set)].join("");
|
||||
var remaining = [...set].join("");
|
||||
assertEq(remaining, leftovers);
|
||||
}
|
||||
|
||||
|
@ -1,19 +0,0 @@
|
||||
// The argument to WeakMap can be a generator-expression.
|
||||
|
||||
var k1 = {};
|
||||
var k2 = {};
|
||||
var k3 = {};
|
||||
var k4 = {};
|
||||
|
||||
var valueToKey = {
|
||||
1: k1,
|
||||
2: k2,
|
||||
"green": k3,
|
||||
"red": k4
|
||||
};
|
||||
|
||||
var arr = [1, 2, "green", "red"];
|
||||
var m = new WeakMap([valueToKey[v], v] for (v of arr));
|
||||
|
||||
for (var i = 0; i < 4; i++)
|
||||
assertEq(m.get(valueToKey[arr[i]]), arr[i]);
|
@ -1,7 +1,5 @@
|
||||
// The argument to WeakMap may be a generator-iterator that produces no values.
|
||||
|
||||
new WeakMap(x for (x of []));
|
||||
|
||||
function none() {
|
||||
if (0) yield 0;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ var dbg = new Debugger;
|
||||
// The arguments are assumed to be Debugger.Object instances referring to
|
||||
// globals without wrappers --- which is the sort returned by addDebuggee.
|
||||
function assertDebuggees() {
|
||||
print("assertDebuggees([" + [g.toSource() for each (g in arguments)] + "])");
|
||||
print("assertDebuggees([" + Array.prototype.slice.call(arguments).map((g) => g.toSource()) + "])");
|
||||
var debuggees = dbg.getDebuggees();
|
||||
assertEq(arguments.length, debuggees.length);
|
||||
for each (g in arguments)
|
||||
|
@ -95,9 +95,9 @@ function range(start, stop) {
|
||||
}
|
||||
|
||||
function DSSDsplit(s) {
|
||||
return ("var mid = f1" + ["(" + i + ")" for (i in range(0, s))].join("") + ";\n" +
|
||||
"mid" + ["(" + i + ")" for (i in range(s, N))].join("") + ";\n" +
|
||||
"mid" + ["(" + i + ")" for (i in range(s, N))].join("") + ";\n");
|
||||
return ("var mid = f1" + [...range(0, s)].map((i) => "(" + i + ")").join("") + ";\n" +
|
||||
"mid" + [...range(s, N)].map((i) => "(" + i + ")").join("") + ";\n" +
|
||||
"mid" + [...range(s, N)].map((i) => "(" + i + ")").join("") + ";\n");
|
||||
}
|
||||
|
||||
test("a1", 2, DSSDsplit(1));
|
||||
|
@ -21,14 +21,6 @@ test("for (let x in h()) ;", 'declarative');
|
||||
test("for (let x in {a:1}) h();", 'declarative');
|
||||
test("try { throw new Error; } catch (x) { h(x) }", 'declarative');
|
||||
test("'use strict'; eval('var z = 1; h();');", 'declarative');
|
||||
test("for (var x in [h(m) for (m in [1])]) ;", 'declarative');
|
||||
test("for (var x in (h(m) for (m in [1]))) ;", 'declarative');
|
||||
|
||||
// Since a generator-expression is effectively a function, the innermost scope
|
||||
// is a function scope, and thus declarative. Thanks to an odd design decision,
|
||||
// m is already in scope at the point of the call to h(). The answer here is
|
||||
// not all that important, but we shouldn't crash.
|
||||
test("for (var x in (0 for (m in h()))) ;", 'declarative');
|
||||
|
||||
dbg.onDebuggerStatement = function (frame) {
|
||||
assertEq(frame.eval("h(), 2 + 2;").return, 4);
|
||||
|
@ -17,8 +17,6 @@ var cases = [
|
||||
"for (let x of [VAL]) { @@ }",
|
||||
"for each (let x in [VAL]) { @@ }",
|
||||
"switch (0) { default: let x = VAL; @@ }",
|
||||
"[function () { @@ }() for (x of [VAL])];",
|
||||
// "((function () { @@ })() for (x of [VAL])).next();", // bug 709367
|
||||
|
||||
// arguments
|
||||
"function f(x) { @@ } f(VAL);",
|
||||
|
@ -40,5 +40,3 @@ test("function r(n) { for (var i = 0; i < n; i++) yield i; } debugger;",
|
||||
"S[S]");
|
||||
test("function* qux(n) { for (var i = 0; i < n; i++) yield i; } debugger;",
|
||||
"S[S]");
|
||||
test("var it = (3 for (p in obj)); debugger;",
|
||||
"S[S]");
|
||||
|
@ -52,9 +52,6 @@ test(function () { g.eval("function r(n) { for (var i=0;i<n;i++) yield i; }"); }
|
||||
// eval declaring a star generator
|
||||
test(function () { g.eval("function* sg(n) { for (var i=0;i<n;i++) yield i; }"); });
|
||||
|
||||
// eval with a generator-expression
|
||||
test(function () { g.eval("var it = (obj[p] for (p in obj));"); });
|
||||
|
||||
// eval creating several instances of a closure
|
||||
test(function () { g.eval("for (var i = 0; i < 7; i++)\n" +
|
||||
" obj = function () { return obj; };\n"); });
|
||||
|
@ -1,3 +0,0 @@
|
||||
// for-of can be used in array comprehensions.
|
||||
|
||||
assertEq([x*x for (x of [1, 2, 3])].join(), "1,4,9");
|
@ -1,5 +0,0 @@
|
||||
// for-of visits inherited properties in an array full of holes.
|
||||
|
||||
Object.prototype[1] = "O";
|
||||
Array.prototype[2] = "A";
|
||||
assertEq([x for (x of Array(4))].join(","), ",O,A,");
|
@ -1,15 +0,0 @@
|
||||
// for-of in comprehensions does not trigger the JS 1.7 for-in destructuring special case.
|
||||
|
||||
version(170);
|
||||
load(libdir + "asserts.js");
|
||||
|
||||
var data = [[1, 2, 3], [4]];
|
||||
var arr = eval("[a for ([a] of data)]");
|
||||
assertEq(arr.length, 2);
|
||||
assertEq(arr[0], 1);
|
||||
assertEq(arr[1], 4);
|
||||
|
||||
arr = eval("[length for ({length} of data)]");
|
||||
assertEq(arr.length, 2);
|
||||
assertEq(arr[0], 3);
|
||||
assertEq(arr[1], 1);
|
@ -1,4 +0,0 @@
|
||||
// Cleaned-up version of bug 728079 comment 0.
|
||||
|
||||
version(170);
|
||||
eval("(function f() { return [[b, a] for ([a, b] of c.items())]; })");
|
@ -26,11 +26,3 @@ test("for ([a, b] of c) { a.m(b); }");
|
||||
// for-let-of
|
||||
test("for (let a of b) { f(a); }");
|
||||
test("for (let [a, b] of c) { a.m(b); }");
|
||||
|
||||
// array comprehensions
|
||||
test("return [a for (a of b)];");
|
||||
test("return [[b, a] for ([a, b] of c.items())];");
|
||||
|
||||
// generator expressions
|
||||
test("return (a for (a of b));");
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
// for-of can iterate over generator-iterators produced by generator-expressions.
|
||||
|
||||
function g() {
|
||||
yield 1;
|
||||
yield 2;
|
||||
}
|
||||
|
||||
var it = g();
|
||||
for (var i = 0; i < 10; i++) {
|
||||
let prev = it;
|
||||
it = (k + 1 for (k of prev));
|
||||
}
|
||||
|
||||
var arr = [v for (v of it)];
|
||||
assertEq(arr.join(), "11,12");
|
@ -26,4 +26,4 @@ var proxy = Proxy.create({
|
||||
});
|
||||
|
||||
for (var i = 0; i < 2; i++)
|
||||
assertEq([v for (v of proxy)].join(","), "a,b,c,d");
|
||||
assertEq([...proxy].join(","), "a,b,c,d");
|
||||
|
@ -1,48 +0,0 @@
|
||||
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);
|
@ -1,5 +0,0 @@
|
||||
({
|
||||
l: [0
|
||||
for each(s in 0) if ('')
|
||||
]
|
||||
})
|
@ -1,15 +0,0 @@
|
||||
// |jit-test| error: TypeError
|
||||
|
||||
x = 2;
|
||||
|
||||
function tryItOut(c) {
|
||||
return eval("(function(){" + c + "})");
|
||||
}
|
||||
|
||||
function doit() {
|
||||
var f = tryItOut("((( \"\" \n for each (eval in [null, this, null, this, (1/0), new String('q'), new String('q'), null, null, null, new String('q'), new String('q'), new String('q'), null]) if (this)).eval(x = x)));");
|
||||
f();
|
||||
}
|
||||
|
||||
doit();
|
||||
|
@ -175,14 +175,6 @@ delete ...a) =>
|
||||
|
||||
// array comprehension
|
||||
|
||||
testThrow(`
|
||||
[x for (...a) =>
|
||||
`, 8);
|
||||
|
||||
testThrow(`
|
||||
[x for (x of ...a) =>
|
||||
`, 13);
|
||||
|
||||
testThrow(`
|
||||
[for (...a) =>
|
||||
`, 6);
|
||||
|
@ -16,4 +16,8 @@ let proxy = new Proxy({
|
||||
let object = Object.create(proxy);
|
||||
object.d = 4;
|
||||
|
||||
assertEq([x for (x in object)].toString(), "d,a,b");
|
||||
let a = [];
|
||||
for (let x in object) {
|
||||
a.push(x);
|
||||
}
|
||||
assertEq(a.toString(), "d,a,b");
|
||||
|
@ -1,2 +1,6 @@
|
||||
var proxy = new Proxy(['a', 'b', 'c'], {});
|
||||
assertEq([x for each (x in proxy)].toString(), 'a,b,c');
|
||||
var a = [];
|
||||
for each (x in proxy) {
|
||||
a.push(x);
|
||||
}
|
||||
assertEq(a.toString(), 'a,b,c');
|
||||
|
Loading…
Reference in New Issue
Block a user