tor-browser

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

gen-meth-ary-ptrn-rest-init-id.js (2153B)


      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/gen-meth.template
      5 /*---
      6 description: Rest element (identifier) does not support initializer (generator method)
      7 esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation
      8 features: [generators, destructuring-binding]
      9 flags: [generated]
     10 negative:
     11  phase: parse
     12  type: SyntaxError
     13 info: |
     14    GeneratorMethod :
     15        * PropertyName ( StrictFormalParameters ) { GeneratorBody }
     16 
     17    1. Let propKey be the result of evaluating PropertyName.
     18    2. ReturnIfAbrupt(propKey).
     19    3. If the function code for this GeneratorMethod is strict mode code,
     20       let strict be true. Otherwise let strict be false.
     21    4. Let scope be the running execution context's LexicalEnvironment.
     22    5. Let closure be GeneratorFunctionCreate(Method,
     23       StrictFormalParameters, GeneratorBody, scope, strict).
     24    [...]
     25 
     26    9.2.1 [[Call]] ( thisArgument, argumentsList)
     27 
     28    [...]
     29    7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
     30    [...]
     31 
     32    9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
     33 
     34    1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
     35    [...]
     36 
     37    9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
     38 
     39    [...]
     40    23. Let iteratorRecord be Record {[[iterator]]:
     41        CreateListIterator(argumentsList), [[done]]: false}.
     42    24. If hasDuplicates is true, then
     43        [...]
     44    25. Else,
     45        b. Let formalStatus be IteratorBindingInitialization for formals with
     46           iteratorRecord and env as arguments.
     47    [...]
     48 
     49    13.3.3 Destructuring Binding Patterns
     50    ArrayBindingPattern[Yield] :
     51        [ Elisionopt BindingRestElement[?Yield]opt ]
     52        [ BindingElementList[?Yield] ]
     53        [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
     54 ---*/
     55 $DONOTEVALUATE();
     56 
     57 var callCount = 0;
     58 var obj = {
     59  *method([...x = []]) {
     60    
     61    callCount = callCount + 1;
     62  }
     63 };
     64 
     65 obj.method([]).next();
     66 assert.sameValue(callCount, 1, 'generator method invoked exactly once');