tor-browser

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

array-elem-trlg-iter-list-nrml-close-err.js (1794B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/dstr-assignment/array-elem-trlg-iter-list-nrml-close-err.case
      3 // - src/dstr-assignment/error/assignment-expr.template
      4 /*---
      5 description: Abrupt completion returned from IteratorClose (AssignmentExpression)
      6 esid: sec-variable-statement-runtime-semantics-evaluation
      7 features: [Symbol.iterator, destructuring-binding]
      8 flags: [generated]
      9 info: |
     10    VariableDeclaration : BindingPattern Initializer
     11 
     12    1. Let rhs be the result of evaluating Initializer.
     13    2. Let rval be GetValue(rhs).
     14    3. ReturnIfAbrupt(rval).
     15    4. Return the result of performing BindingInitialization for
     16       BindingPattern passing rval and undefined as arguments.
     17 
     18    ArrayAssignmentPattern :
     19        [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
     20 
     21    [...]
     22    3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
     23    4. Let status be the result of performing
     24       IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
     25       iteratorRecord as the argument.
     26    5. If status is an abrupt completion, then
     27       a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
     28          status).
     29       b. Return Completion(status).
     30 
     31 ---*/
     32 var nextCount = 0;
     33 var returnCount = 0;
     34 var iterable = {};
     35 var thrower = function() {
     36  throw new Test262Error();
     37 };
     38 var x;
     39 var iterator = {
     40  next: function() {
     41    nextCount += 1;
     42    return { done: nextCount > 10 };
     43  },
     44  return: function() {
     45    returnCount += 1;
     46    throw new Test262Error();
     47  }
     48 };
     49 iterable[Symbol.iterator] = function() {
     50  return iterator;
     51 };
     52 
     53 assert.throws(Test262Error, function() {
     54  0, [ x , ] = iterable;
     55 });
     56 
     57 assert.sameValue(nextCount, 1);
     58 assert.sameValue(returnCount, 1);
     59 
     60 reportCompare(0, 0);