tor-browser

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

eval-spread-empty.js (946B)


      1 // Copyright (C) 2017 André Bargull. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-function-calls-runtime-semantics-evaluation
      6 description: >
      7  Direct eval call with empty spread.
      8 info: |
      9  12.3.4.1 Runtime Semantics: Evaluation
     10    ...
     11    3. If Type(ref) is Reference and IsPropertyReference(ref) is false and GetReferencedName(ref) is "eval", then
     12      a. If SameValue(func, %eval%) is true, then
     13        i. Let argList be ? ArgumentListEvaluation(Arguments).
     14        ii. If argList has no elements, return undefined.
     15        ...
     16 
     17 features: [Symbol.iterator]
     18 ---*/
     19 
     20 var nextCount = 0;
     21 var iter = {};
     22 iter[Symbol.iterator] = function() {
     23  return {
     24    next: function() {
     25      var i = nextCount++;
     26      return {done: true, value: undefined};
     27    }
     28  };
     29 };
     30 
     31 var result = eval(...iter);
     32 
     33 assert.sameValue(result, undefined);
     34 assert.sameValue(nextCount, 1);
     35 
     36 reportCompare(0, 0);