tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

spread-call-optimized.js (672B)


      1 // Call_Scripted
      2 let f = function(a, b, c, d, e) {
      3    return a * 10000 + b * 1000 + c * 100 + d * 10 + e;
      4 };
      5 for (let i = 0; i < 4; i++) {
      6    assertEq(f(...[1, 2, 3, 4, 5]), 12345);
      7 }
      8 
      9 // Call_Scripted (constructing)
     10 let A = function(a, b, c, d, e) {
     11    this.v = a * 10000 + b * 1000 + c * 100 + d * 10 + e;
     12 };
     13 for (let i = 0; i < 4; i++) {
     14    assertEq(new A(...[1, 2, 3, 4, 5]).v, 12345);
     15 }
     16 
     17 // Call_Native
     18 for (let i = 0; i < 4; i++) {
     19    assertEq(Math.max(...[1, 2, 3, 4, 5]), 5);
     20 }
     21 
     22 // Call_Native (constructing)
     23 for (let i = 0; i < 4; i++) {
     24    assertEq(new Date(...[2014, 4, 28, 8, 16, 1]).getTime(),
     25             new Date(2014, 4, 28, 8, 16, 1).getTime());
     26 }