// This file was procedurally generated from the following sources:
// - src/computed-property-names/computed-property-name-from-multiplicative-expression-mult.case
// - src/computed-property-names/evaluation/class-expression-accessors.template
/*---
description: Computed property name from multiplicative expression "multiply" (ComputedPropertyName in ClassExpression)
esid: prod-ComputedPropertyName
features: [computed-property-names]
flags: [generated]
info: |
    ClassExpression:
      classBindingIdentifier opt ClassTail

    ClassTail:
      ClassHeritage opt { ClassBody opt }

    ClassBody:
      ClassElementList

    ClassElementList:
      ClassElement

    ClassElement:
      MethodDefinition

    MethodDefinition:
      PropertyName ...
      get PropertyName ...
      set PropertyName ...

    PropertyName:
      ComputedPropertyName

    ComputedPropertyName:
      [ AssignmentExpression ]
---*/


let C = class {
  get [1 * 1]() {
    return 1;
  }

  set [1 * 1](v) {
    return 1;
  }

  static get [1 * 1]() {
    return 1;
  }

  static set [1 * 1](v) {
    return 1;
  }
};

let c = new C();

assert.sameValue(
  c[1 * 1],
  1
);
assert.sameValue(
  c[1 * 1] = 1,
  1
);

assert.sameValue(
  C[1 * 1],
  1
);
assert.sameValue(
  C[1 * 1] = 1,
  1
);
assert.sameValue(
  c[String(1 * 1)],
  1
);
assert.sameValue(
  c[String(1 * 1)] = 1,
  1
);

assert.sameValue(
  C[String(1 * 1)],
  1
);
assert.sameValue(
  C[String(1 * 1)] = 1,
  1
);
