tor-browser

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

private-static-generator-method-name.js (2341B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/class-elements/private-static-generator-method-name.case
      3 // - src/class-elements/default/cls-decl.template
      4 /*---
      5 description: Private static generator methods have name property properly configured (field definitions in a class declaration)
      6 esid: prod-FieldDefinition
      7 features: [class-static-methods-private, class]
      8 flags: [generated]
      9 info: |
     10    Updated Productions
     11 
     12    ClassElement : MethodDefinition
     13      1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype".
     14 
     15    ClassElement : static MethodDefinition
     16      1. Return ClassElementEvaluation of MethodDefinition with arguments homeObject, enumerable and "static".
     17 
     18    GeneratorMethod : * ClassElementName (UniqueFormalParameters) { GeneratorBody }
     19      ...
     20      12. Perform ? DefineOrdinaryMethod(key, homeObject, closure, _enumerable).
     21 
     22    ClassElement : MethodDefinition
     23    ClassElement : static MethodDefinition
     24      1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable.
     25      2. Return empty.
     26 
     27    ClassElementName : PrivateIdentifier
     28      1. Let bindingName be StringValue of PrivateIdentifier.
     29      ...
     30      5. If scopeEnvRec's binding for bindingName is uninitialized,
     31        a. Let field be NewPrivateName(bindingName).
     32        b. Perform ! scopeEnvRec.InitializeBinding(bindingName, field).
     33      6. Otherwise,
     34        a. Let field be scopeEnvRec.GetBindingValue(bindingName).
     35      7. Assert: field.[[Description]] is bindingName.
     36      8. Return field.
     37 
     38    DefineOrdinaryMethod(key, homeObject, closure, enumerable)
     39      1. Perform SetFunctionName(closure, key).
     40      2. If key is a Private Name,
     41        a. Assert: key does not have a [[Kind]] field.
     42        b. Set key.[[Kind]] to "method".
     43        c. Set key.[[Value]] to closure.
     44        d. Set key.[[Brand]] to homeObject.
     45      3. Else,
     46        a. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}.
     47        b. Perform ? DefinePropertyOrThrow(homeObject, key, desc).
     48 
     49 ---*/
     50 
     51 
     52 class C {
     53  static * #method() {};
     54 
     55  static getPrivateMethod() {
     56    return this.#method;
     57  }
     58 }
     59 
     60 assert.sameValue(C.getPrivateMethod().name, "#method");
     61 
     62 reportCompare(0, 0);