tor-browser

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

const-ary-ptrn-rest-init-id.js (1810B)


      1 // |reftest| error:SyntaxError
      2 // This file was procedurally generated from the following sources:
      3 // - src/dstr-binding/ary-ptrn-rest-init-id.case
      4 // - src/dstr-binding/default/for-const.template
      5 /*---
      6 description: Rest element (identifier) does not support initializer (for statement)
      7 esid: sec-for-statement-runtime-semantics-labelledevaluation
      8 features: [destructuring-binding]
      9 flags: [generated]
     10 negative:
     11  phase: parse
     12  type: SyntaxError
     13 info: |
     14    IterationStatement :
     15        for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
     16 
     17    [...]
     18    7. Let forDcl be the result of evaluating LexicalDeclaration.
     19    [...]
     20 
     21    LexicalDeclaration : LetOrConst BindingList ;
     22 
     23    1. Let next be the result of evaluating BindingList.
     24    2. ReturnIfAbrupt(next).
     25    3. Return NormalCompletion(empty).
     26 
     27    BindingList : BindingList , LexicalBinding
     28 
     29    1. Let next be the result of evaluating BindingList.
     30    2. ReturnIfAbrupt(next).
     31    3. Return the result of evaluating LexicalBinding.
     32 
     33    LexicalBinding : BindingPattern Initializer
     34 
     35    1. Let rhs be the result of evaluating Initializer.
     36    2. Let value be GetValue(rhs).
     37    3. ReturnIfAbrupt(value).
     38    4. Let env be the running execution context’s LexicalEnvironment.
     39    5. Return the result of performing BindingInitialization for BindingPattern
     40       using value and env as the arguments.
     41 
     42    13.3.3 Destructuring Binding Patterns
     43    ArrayBindingPattern[Yield] :
     44        [ Elisionopt BindingRestElement[?Yield]opt ]
     45        [ BindingElementList[?Yield] ]
     46        [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
     47 ---*/
     48 $DONOTEVALUATE();
     49 
     50 var iterCount = 0;
     51 
     52 for (const [...x = []] = []; iterCount < 1; ) {
     53  
     54 
     55  iterCount += 1;
     56 }
     57 
     58 assert.sameValue(iterCount, 1, 'Iteration occurred as expected');