transformClassElements_(tree) {
    let elements = [];
    let initInstanceVars = [], initStaticVars = [];
    let constructor;
    let constructorIndex = 0;

    tree.elements.forEach((tree) => {
      let initVars;
      if (tree.isStatic) {
        initVars = initStaticVars;
      } else {
        initVars = initInstanceVars;
      }

      switch (tree.type) {
        case GET_ACCESSOR:
        case SET_ACCESSOR:
          elements.push(this.transformAny(tree));
          break;

        case METHOD:
          if (!tree.isStatic && propName(tree) === CONSTRUCTOR) {
            constructor = tree;
            constructorIndex = elements.length;
          } else {
            elements.push(this.transformAny(tree));
          }
          break;

        case PROPERTY_VARIABLE_DECLARATION:
          tree = this.transformAny(tree);
          if (tree.initializer !== null) {
            initVars.push(tree);
          }
          break;

        default:
          throw new Error(`Unexpected class element: ${tree.type}`);
      }
    });

    if (initInstanceVars.length > 0) {
      let initExpression = getInstanceInitExpression(initInstanceVars);

      if (!constructor) {
        constructor = this.getDefaultConstructor_(tree);
      }

      constructor = transformConstructor(constructor, initExpression,
          tree.superClass);
    }

    if (constructor) {
      elements.splice(constructorIndex, 0, constructor);
    }

    return {
      elements,
      initStaticVars,
    };
  }
Transforms post ES6 member variable declarations to valid ES6 classes.

- instance variables are initialized in the constructor,
- static variables are initialized after the class definition,
  through `Object.defineProperty(...)`

  class C {
    x = 42;
  }

To:

  class C {
    constructor() {
      this.x = 42;
    }
  }