tor-browser

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

private-meth-static-ary-ptrn-rest-init-obj.js (2744B)


      1 // |reftest| error:SyntaxError
      2 // This file was procedurally generated from the following sources:
      3 // - src/dstr-binding/ary-ptrn-rest-init-obj.case
      4 // - src/dstr-binding/default/cls-expr-private-meth-static.template
      5 /*---
      6 description: Rest element (nested object pattern) does not support initializer (private static class expression method)
      7 esid: sec-class-definitions-runtime-semantics-evaluation
      8 features: [class, class-static-methods-private, destructuring-binding]
      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        b. Else,
     27           Let status be the result of performing PropertyDefinitionEvaluation for
     28           m with arguments F and false.
     29    [...]
     30 
     31    14.3.8 Runtime Semantics: DefineMethod
     32 
     33    MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
     34 
     35    [...]
     36    6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
     37       scope, strict). If functionPrototype was passed as a parameter then pass its
     38       value as the functionPrototype optional argument of FunctionCreate.
     39    [...]
     40 
     41    9.2.1 [[Call]] ( thisArgument, argumentsList)
     42 
     43    [...]
     44    7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
     45    [...]
     46 
     47    9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
     48 
     49    1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
     50    [...]
     51 
     52    9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
     53 
     54    [...]
     55    23. Let iteratorRecord be Record {[[iterator]]:
     56        CreateListIterator(argumentsList), [[done]]: false}.
     57    24. If hasDuplicates is true, then
     58        [...]
     59    25. Else,
     60        b. Let formalStatus be IteratorBindingInitialization for formals with
     61           iteratorRecord and env as arguments.
     62    [...]
     63 
     64    13.3.3 Destructuring Binding Patterns
     65    ArrayBindingPattern[Yield] :
     66        [ Elisionopt BindingRestElement[?Yield]opt ]
     67        [ BindingElementList[?Yield] ]
     68        [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
     69 ---*/
     70 $DONOTEVALUATE();
     71 
     72 var callCount = 0;
     73 var C = class {
     74  static #method([...{ x } = []]) {
     75    
     76    callCount = callCount + 1;
     77  }
     78 
     79  static get method() {
     80    return this.#method;
     81  }
     82 };
     83 
     84 C.method([]);
     85 assert.sameValue(callCount, 1, 'method invoked exactly once');