tor-browser

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

redeclaration-symbol.js (1629B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/class-elements/redeclaration-symbol.case
      3 // - src/class-elements/default/cls-decl.template
      4 /*---
      5 description: Redeclaration of public fields with the same name (field definitions in a class declaration)
      6 esid: prod-FieldDefinition
      7 features: [class-fields-public, class]
      8 flags: [generated]
      9 includes: [propertyHelper.js, compareArray.js]
     10 info: |
     11    2.13.2 Runtime Semantics: ClassDefinitionEvaluation
     12 
     13    ...
     14    30. Set the value of F's [[Fields]] internal slot to fieldRecords.
     15    ...
     16 
     17    2.14 [[Construct]] ( argumentsList, newTarget)
     18 
     19    ...
     20    8. If kind is "base", then
     21      ...
     22      b. Let result be InitializeInstanceFields(thisArgument, F).
     23    ...
     24 
     25    2.9 InitializeInstanceFields ( O, constructor )
     26 
     27    3. Let fieldRecords be the value of constructor's [[Fields]] internal slot.
     28    4. For each item fieldRecord in order from fieldRecords,
     29      a. If fieldRecord.[[static]] is false, then
     30        i. Perform ? DefineField(O, fieldRecord).
     31 
     32 ---*/
     33 var x = [];
     34 var y = Symbol();
     35 
     36 
     37 class C {
     38  [y] = (x.push("a"), "old_value");
     39  [y] = (x.push("b"), "same_value");
     40  [y] = (x.push("c"), "same_value");
     41 }
     42 
     43 var c = new C();
     44 
     45 assert(
     46  !Object.prototype.hasOwnProperty.call(C.prototype, y),
     47  "y does not appear as an own property on C prototype"
     48 );
     49 assert(
     50  !Object.prototype.hasOwnProperty.call(C, y),
     51  "y does not appear as an own property on C constructor"
     52 );
     53 
     54 verifyProperty(c, y, {
     55  value: "same_value",
     56  enumerable: true,
     57  writable: true,
     58  configurable: true
     59 });
     60 
     61 assert.compareArray(x, ["a", "b", "c"]);
     62 
     63 reportCompare(0, 0);