Bug 1313490 - Part 2: Remove unnecessary expression closure from jstests. r=evilpie

This commit is contained in:
Tooru Fujisawa 2016-11-26 06:41:42 +09:00
Родитель b15d6aadc1
Коммит a6acd75a3a
22 изменённых файлов: 34 добавлений и 33 удалений

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

@ -27,7 +27,7 @@ function run_test() {
var timer = new Timer; var timer = new Timer;
var next = query.slice(1); var next = query.slice(1);
timer.initWithCallback({ notify: function() doSearch(next) }); timer.initWithCallback({ notify: function() { return doSearch(next); } });
} }
}); });
})("title"); })("title");

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

@ -86,11 +86,11 @@ assertEq(testLenientAndStrict('Function("x","y","\'use strict\'")',
* The parameter lists of function expressions should not contain * The parameter lists of function expressions should not contain
* duplicate identifiers. * duplicate identifiers.
*/ */
assertEq(testLenientAndStrict('(function (x,x) 2)', assertEq(testLenientAndStrict('(function (x,x) {})',
parsesSuccessfully, parsesSuccessfully,
parseRaisesException(SyntaxError)), parseRaisesException(SyntaxError)),
true); true);
assertEq(testLenientAndStrict('(function (x,y) 2)', assertEq(testLenientAndStrict('(function (x,y) {})',
parsesSuccessfully, parsesSuccessfully,
parsesSuccessfully), parsesSuccessfully),
true); true);
@ -173,19 +173,19 @@ assertEq(testLenientAndStrict('(function eval(){"use strict";})',
parseRaisesException(SyntaxError), parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)), parseRaisesException(SyntaxError)),
true); true);
assertEq(testLenientAndStrict('(function f(eval) 2)', assertEq(testLenientAndStrict('(function f(eval) {})',
parsesSuccessfully, parsesSuccessfully,
parseRaisesException(SyntaxError)), parseRaisesException(SyntaxError)),
true); true);
assertEq(testLenientAndStrict('(function f([eval]) 2)', assertEq(testLenientAndStrict('(function f([eval]) {})',
parsesSuccessfully, parsesSuccessfully,
parseRaisesException(SyntaxError)), parseRaisesException(SyntaxError)),
true); true);
assertEq(testLenientAndStrict('(function f({x:eval}) 2)', assertEq(testLenientAndStrict('(function f({x:eval}) {})',
parsesSuccessfully, parsesSuccessfully,
parseRaisesException(SyntaxError)), parseRaisesException(SyntaxError)),
true); true);
assertEq(testLenientAndStrict('(function eval() 2)', assertEq(testLenientAndStrict('(function eval() {})',
parsesSuccessfully, parsesSuccessfully,
parseRaisesException(SyntaxError)), parseRaisesException(SyntaxError)),
true); true);
@ -277,19 +277,19 @@ assertEq(testLenientAndStrict('(function arguments(){"use strict";})',
parseRaisesException(SyntaxError), parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)), parseRaisesException(SyntaxError)),
true); true);
assertEq(testLenientAndStrict('(function f(arguments) 2)', assertEq(testLenientAndStrict('(function f(arguments) {})',
parsesSuccessfully, parsesSuccessfully,
parseRaisesException(SyntaxError)), parseRaisesException(SyntaxError)),
true); true);
assertEq(testLenientAndStrict('(function f([arguments]) 2)', assertEq(testLenientAndStrict('(function f([arguments]) {})',
parsesSuccessfully, parsesSuccessfully,
parseRaisesException(SyntaxError)), parseRaisesException(SyntaxError)),
true); true);
assertEq(testLenientAndStrict('(function f({x:arguments}) 2)', assertEq(testLenientAndStrict('(function f({x:arguments}) {})',
parsesSuccessfully, parsesSuccessfully,
parseRaisesException(SyntaxError)), parseRaisesException(SyntaxError)),
true); true);
assertEq(testLenientAndStrict('(function arguments() 2)', assertEq(testLenientAndStrict('(function arguments() {})',
parsesSuccessfully, parsesSuccessfully,
parseRaisesException(SyntaxError)), parseRaisesException(SyntaxError)),
true); true);

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

@ -10,7 +10,7 @@ assertThrowsInstanceOf(() => eval('new.target'), SyntaxError);
// new.target is invalid inside indirect eval. // new.target is invalid inside indirect eval.
let ieval = eval; let ieval = eval;
try { try {
(function () ieval('new.target'))(); (function () { return ieval('new.target'); })();
assertEq(false, true); assertEq(false, true);
} catch (e if e instanceof SyntaxError) { } } catch (e if e instanceof SyntaxError) { }

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

@ -12,7 +12,7 @@ var expect = '';
printBugNumber(BUGNUMBER); printBugNumber(BUGNUMBER);
printStatus (summary); printStatus (summary);
(this.__defineGetter__("x", function (x)'foo'.replace(/o/g, [1].push))); (this.__defineGetter__("x", function (x) { return 'foo'.replace(/o/g, [1].push); }));
for(let y in [,,,]) for(let y in [,,,]) x = x; for(let y in [,,,]) for(let y in [,,,]) x = x;
reportCompare(expect, actual, summary); reportCompare(expect, actual, summary);

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

@ -22,7 +22,7 @@ function test()
try try
{ {
this.__defineGetter__('x', function() 2); for (var j=0;j<4;++j) { x=1; } this.__defineGetter__('x', function() { return 2; }); for (var j=0;j<4;++j) { x=1; }
} }
catch(ex) catch(ex)
{ {

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

@ -25,7 +25,7 @@ function test()
expect = 'TypeError: [].__proto__ is not a function'; expect = 'TypeError: [].__proto__ is not a function';
Array.prototype.__proto__ = function () 3; Array.prototype.__proto__ = function () { return 3; };
try try
{ {

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

@ -20,7 +20,7 @@ function test()
printStatus (summary); printStatus (summary);
for (var j=0;j<5;++j) (new (function(q) q)).a; for (var j=0;j<5;++j) (new (function(q) { return q; })).a;
reportCompare(expect, actual, summary); reportCompare(expect, actual, summary);

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

@ -53,8 +53,9 @@ var url=new SNI.Ads.Url();
this.addParameter=url.addParameter; this.addParameter=url.addParameter;
this.getParameter=url.getParameter; this.getParameter=url.getParameter;
} }
function DartAd() function DartAd() {
AdUrl.prototype=new Ad(); return AdUrl.prototype=new Ad();
}
function AdUrl() { } function AdUrl() { }
function AdRestriction() { function AdRestriction() {
var p=new SNI.MetaData.Parameter(); var p=new SNI.MetaData.Parameter();

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

@ -22,7 +22,7 @@ function test()
for (let f in [1,1]); for (let f in [1,1]);
Object.prototype.__defineGetter__('x', function() gc()); Object.prototype.__defineGetter__('x', function() { return gc(); });
(function() { for each (let j in [1,1,1,1,1]) { var y = .2; } })(); (function() { for each (let j in [1,1,1,1,1]) { var y = .2; } })();

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

@ -25,7 +25,7 @@ function test()
try try
{ {
var o = {toString: function()(i > 2) ? this : "foo"}; var o = {toString: function() { return (i > 2) ? this : "foo"; }};
var s = ""; var s = "";
for (var i = 0; i < 5; i++) for (var i = 0; i < 5; i++)
s += o + o; s += o + o;

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

@ -23,7 +23,7 @@ function test()
expect = '11111'; expect = '11111';
(function(d) { for (let j = 0; j < 5; ++j) { actual += ('' + d); } })({valueOf: function()1}); (function(d) { for (let j = 0; j < 5; ++j) { actual += ('' + d); } })({valueOf: function() { return 1; }});
reportCompare(expect, actual, summary); reportCompare(expect, actual, summary);

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

@ -20,7 +20,7 @@ function test()
printBugNumber(BUGNUMBER); printBugNumber(BUGNUMBER);
printStatus (summary); printStatus (summary);
(function() { x = 0; function x() 4; var x; const y = 1; })(); (function() { x = 0; function x() { return 4; }; var x; const y = 1; })();
reportCompare(expect, actual, summary); reportCompare(expect, actual, summary);

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

@ -34,7 +34,7 @@ function test()
(function (){ (function (){
var x; var x;
eval("var x; (function ()x)"); eval("var x; (function () { return x; })");
} }
)(); )();

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

@ -24,7 +24,7 @@ function test()
// ------- Comment #27 From Brendan Eich // ------- Comment #27 From Brendan Eich
function f(x){function g(y)x+y;return g} function f(x){function g(y) { return x+y; } return g}
g = f(2); g = f(2);
actual = String(g(3)); actual = String(g(3));

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

@ -24,7 +24,7 @@ function test()
// ------- Comment #79 From Jason Orendorff // ------- Comment #79 From Jason Orendorff
x; var x; function x() 0 x; var x; function x() { return 0; }
// Assertion failure: !(pn->pn_dflags & flag), at ../jsparse.h:635 // Assertion failure: !(pn->pn_dflags & flag), at ../jsparse.h:635

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

@ -24,7 +24,7 @@ function test()
// ===== // =====
(function(){function x(){} function x()y})(); (function(){function x(){} function x() { return y; }})();
// Assertion failure: JOF_OPTYPE(op) == JOF_ATOM, at ../jsemit.cpp:1710 // Assertion failure: JOF_OPTYPE(op) == JOF_ATOM, at ../jsemit.cpp:1710

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

@ -23,7 +23,7 @@ function test()
// ------- Comment #121 From Gary Kwong [:nth10sd] // ------- Comment #121 From Gary Kwong [:nth10sd]
// without -j // without -j
x = function()x; x = function() { return x; };
// Assertion failure: !(pn->pn_dflags & flag), at ../jsparse.h:651 // Assertion failure: !(pn->pn_dflags & flag), at ../jsparse.h:651

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

@ -22,12 +22,12 @@ function test()
printStatus (summary); printStatus (summary);
// crash [@ js_Interpret] // crash [@ js_Interpret]
(eval("(function(){ this.watch(\"x\", function () { new function ()y } ); const y = undefined });"))(); (eval("(function(){ this.watch(\"x\", function () { new function () { return y; } } ); const y = undefined });"))();
x = NaN; x = NaN;
reportCompare(expect, actual, summary + ': 2'); reportCompare(expect, actual, summary + ': 2');
// Assertion failure: JOF_OPTYPE(op) == JOF_ATOM, at ../jsemit.cpp:5916 // Assertion failure: JOF_OPTYPE(op) == JOF_ATOM, at ../jsemit.cpp:5916
({ set z(v){}, set y(v)--x, set w(v)--w }); ({ set z(v){}, set y(v) { return --x; }, set w(v) { return --w; } });
reportCompare(expect, actual, summary + ': 3'); reportCompare(expect, actual, summary + ': 3');
exitFunc ('test'); exitFunc ('test');

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

@ -6,7 +6,7 @@
*/ */
var sandbox = evalcx(''); var sandbox = evalcx('');
var foreign = evalcx('({ get f() this, set x(v) { result = this } })', sandbox); var foreign = evalcx('({ get f() { return this; }, set x(v) { result = this } })', sandbox);
var local = Object.create(foreign); var local = Object.create(foreign);
reportCompare(local, local.f, "this should be set correctly in getters"); reportCompare(local, local.f, "this should be set correctly in getters");

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

@ -2,7 +2,7 @@
// http://creativecommons.org/licenses/publicdomain/ // http://creativecommons.org/licenses/publicdomain/
(function () { (function () {
var [x, y] = [1, function () x]; var [x, y] = [1, function () { return x; }];
assertEq(y(), 1); assertEq(y(), 1);
})(); })();

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

@ -3,7 +3,7 @@
(function () { (function () {
var obj = {prop: 1}; var obj = {prop: 1};
var [x, {prop: y}] = [function () y, obj]; var [x, {prop: y}] = [function () { return y; }, obj];
assertEq(y, 1); assertEq(y, 1);
assertEq(x(), 1); assertEq(x(), 1);
})(); })();

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

@ -2,7 +2,7 @@
// http://creativecommons.org/licenses/publicdomain/ // http://creativecommons.org/licenses/publicdomain/
(function () { (function () {
var [x, y] = [function () y, 13]; var [x, y] = [function () { return y; }, 13];
assertEq(x(), 13); assertEq(x(), 13);
})(); })();