tor-browser

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

same-line-gen-literal-names-asi.js (1694B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/class-elements/literal-names-asi.case
      3 // - src/class-elements/productions/cls-decl-same-line-generator.template
      4 /*---
      5 description: Literal property names with ASI (field definitions followed by a generator method in the same line)
      6 esid: prod-FieldDefinition
      7 features: [class-fields-public, class, generators]
      8 flags: [generated]
      9 includes: [propertyHelper.js]
     10 info: |
     11    ClassElement:
     12      ...
     13      FieldDefinition ;
     14 
     15    FieldDefinition:
     16      ClassElementName Initializer_opt
     17 
     18    ClassElementName:
     19      PropertyName
     20 
     21 ---*/
     22 
     23 
     24 class C {
     25  a
     26  b = 42;; *m() { return 42; }
     27  
     28 }
     29 
     30 var c = new C();
     31 
     32 assert.sameValue(c.m().next().value, 42);
     33 assert.sameValue(c.m, C.prototype.m);
     34 assert(
     35  !Object.prototype.hasOwnProperty.call(c, "m"),
     36  "m doesn't appear as an own property on the C instance"
     37 );
     38 
     39 verifyProperty(C.prototype, "m", {
     40  enumerable: false,
     41  configurable: true,
     42  writable: true,
     43 });
     44 
     45 assert(
     46  !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
     47  "a doesn't appear as an own property on C prototype"
     48 );
     49 assert(
     50  !Object.prototype.hasOwnProperty.call(C, "a"),
     51  "a doesn't appear as an own property on C constructor"
     52 );
     53 
     54 verifyProperty(c, "a", {
     55  value: undefined,
     56  enumerable: true,
     57  writable: true,
     58  configurable: true
     59 });
     60 
     61 assert(
     62  !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
     63  "b doesn't appear as an own property on C prototype"
     64 );
     65 assert(
     66  !Object.prototype.hasOwnProperty.call(C, "b"),
     67  "b doesn't appear as an own property on C constructor"
     68 );
     69 
     70 verifyProperty(c, "b", {
     71  value: 42,
     72  enumerable: true,
     73  writable: true,
     74  configurable: true
     75 });
     76 
     77 reportCompare(0, 0);