tor-browser

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

private-gen-meth-dflt-ary-ptrn-rest-not-final-id.js (2979B)


      1 // |reftest| error:SyntaxError
      2 // This file was procedurally generated from the following sources:
      3 // - src/dstr-binding/ary-ptrn-rest-not-final-id.case
      4 // - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template
      5 /*---
      6 description: Rest element (identifier) may not be followed by any element (private class expression method (default parameter))
      7 esid: sec-class-definitions-runtime-semantics-evaluation
      8 features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
      9 flags: [generated]
     10 negative:
     11  phase: parse
     12  type: SyntaxError
     13 info: |
     14    ClassExpression : class BindingIdentifieropt ClassTail
     15 
     16    1. If BindingIdentifieropt is not present, let className be undefined.
     17    2. Else, let className be StringValue of BindingIdentifier.
     18    3. Let value be the result of ClassDefinitionEvaluation of ClassTail
     19       with argument className.
     20    [...]
     21 
     22    14.5.14 Runtime Semantics: ClassDefinitionEvaluation
     23 
     24    21. For each ClassElement m in order from methods
     25        a. If IsStatic of m is false, then
     26           i. Let status be the result of performing
     27              PropertyDefinitionEvaluation for m with arguments proto and
     28              false.
     29        [...]
     30 
     31    14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
     32 
     33    GeneratorMethod :
     34        * PropertyName ( StrictFormalParameters ) { GeneratorBody }
     35 
     36    1. Let propKey be the result of evaluating PropertyName.
     37    2. ReturnIfAbrupt(propKey).
     38    3. If the function code for this GeneratorMethod is strict mode code,
     39       let strict be true. Otherwise let strict be false.
     40    4. Let scope be the running execution context's LexicalEnvironment.
     41    5. Let closure be GeneratorFunctionCreate(Method,
     42       StrictFormalParameters, GeneratorBody, scope, strict).
     43 
     44    9.2.1 [[Call]] ( thisArgument, argumentsList)
     45 
     46    [...]
     47    7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
     48    [...]
     49 
     50    9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
     51 
     52    1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
     53    [...]
     54 
     55    9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
     56 
     57    [...]
     58    23. Let iteratorRecord be Record {[[iterator]]:
     59        CreateListIterator(argumentsList), [[done]]: false}.
     60    24. If hasDuplicates is true, then
     61        [...]
     62    25. Else,
     63        b. Let formalStatus be IteratorBindingInitialization for formals with
     64           iteratorRecord and env as arguments.
     65    [...]
     66 
     67    13.3.3 Destructuring Binding Patterns
     68    ArrayBindingPattern[Yield] :
     69        [ Elisionopt BindingRestElement[?Yield]opt ]
     70        [ BindingElementList[?Yield] ]
     71        [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
     72 ---*/
     73 $DONOTEVALUATE();
     74 
     75 var callCount = 0;
     76 var C = class {
     77  * #method([...x, y] = [1, 2, 3]) {
     78    
     79    callCount = callCount + 1;
     80  }
     81 
     82  get method() {
     83    return this.#method;
     84  }
     85 };
     86 
     87 new C().method().next();
     88 assert.sameValue(callCount, 1, 'method invoked exactly once');