tor-browser

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

new-sc-line-method-literal-names-asi.js (1679B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/class-elements/literal-names-asi.case
      3 // - src/class-elements/productions/cls-expr-new-sc-line-method.template
      4 /*---
      5 description: Literal property names with ASI (field definitions followed by a method in a new line with a semicolon)
      6 esid: prod-FieldDefinition
      7 features: [class-fields-public, class]
      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 var C = class {
     25  a
     26  b = 42;;
     27  m() { return 42; }
     28  
     29 }
     30 
     31 var c = new C();
     32 
     33 assert.sameValue(c.m(), 42);
     34 assert.sameValue(c.m, C.prototype.m);
     35 assert(
     36  !Object.prototype.hasOwnProperty.call(c, "m"),
     37  "m doesn't appear as an own property on the C instance"
     38 );
     39 
     40 verifyProperty(C.prototype, "m", {
     41  enumerable: false,
     42  configurable: true,
     43  writable: true,
     44 });
     45 
     46 assert(
     47  !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
     48  "a doesn't appear as an own property on C prototype"
     49 );
     50 assert(
     51  !Object.prototype.hasOwnProperty.call(C, "a"),
     52  "a doesn't appear as an own property on C constructor"
     53 );
     54 
     55 verifyProperty(c, "a", {
     56  value: undefined,
     57  enumerable: true,
     58  writable: true,
     59  configurable: true
     60 });
     61 
     62 assert(
     63  !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
     64  "b doesn't appear as an own property on C prototype"
     65 );
     66 assert(
     67  !Object.prototype.hasOwnProperty.call(C, "b"),
     68  "b doesn't appear as an own property on C constructor"
     69 );
     70 
     71 verifyProperty(c, "b", {
     72  value: 42,
     73  enumerable: true,
     74  writable: true,
     75  configurable: true
     76 });
     77 
     78 reportCompare(0, 0);