constructor(rootReference, values, isCompound, sourceNodeMap) {
    /** @type {string} */
    this.rootReference = rootReference;

    /** @type {!Object<string, !ee.api.ValueNode>} */
    this.values = {};
    values.forEach((tuple) => this.values[tuple[0]] = tuple[1]);

    /** @type {?Object<string, number>} */
    this.referenceCounts = isCompound ? this.countReferences() : null;

    /** @type {!Object<string, !ee.api.ValueNode>} */
    this.optimizedValues = {};

    /** @type {!Object<string, string>} */
    this.referenceMap = {};

    /** @type {number} */
    this.nextMappedRef = 0;

    /** @type {!WeakMap} */
    this.sourceNodeMap = sourceNodeMap;
  }
@param {string} rootReference
@param {!Array<!Array<string|!ee.api.ValueNode|?>>} values
@param {boolean} isCompound If true, optimize shared references;
    otherwise, expand all references.
@param {!WeakMap} sourceNodeMap A map of ValueNodes to SourceFrames.