tor-browser

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

ary-ptrn-rest-id-iter-val-err.js (1591B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
      3 // - src/dstr-binding/error/let-stmt.template
      4 /*---
      5 description: Error forwarding when IteratorValue returns an abrupt completion (`let` statement)
      6 esid: sec-let-and-const-declarations-runtime-semantics-evaluation
      7 features: [Symbol.iterator, destructuring-binding]
      8 flags: [generated]
      9 info: |
     10    LexicalBinding : BindingPattern Initializer
     11 
     12    1. Let rhs be the result of evaluating Initializer.
     13    2. Let value be GetValue(rhs).
     14    3. ReturnIfAbrupt(value).
     15    4. Let env be the running execution context's LexicalEnvironment.
     16    5. Return the result of performing BindingInitialization for BindingPattern
     17       using value and env as the arguments.
     18 
     19    13.3.3.6 Runtime Semantics: IteratorBindingInitialization
     20    BindingRestElement : ... BindingIdentifier
     21    1. Let lhs be ResolveBinding(StringValue of BindingIdentifier,
     22       environment).
     23    2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat,
     24       [...]
     25       c. Let nextValue be IteratorValue(next).
     26       d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
     27          true.
     28       e. ReturnIfAbrupt(nextValue).
     29 
     30 ---*/
     31 var poisonedValue = Object.defineProperty({}, 'value', {
     32  get: function() {
     33    throw new Test262Error();
     34  }
     35 });
     36 var iter = {};
     37 iter[Symbol.iterator] = function() {
     38  return {
     39    next: function() {
     40      return poisonedValue;
     41    }
     42  };
     43 };
     44 
     45 assert.throws(Test262Error, function() {
     46  let [...x] = iter;
     47 });
     48 
     49 reportCompare(0, 0);