function setLocEnd(node, index) {
    if (node.range) {
      node.range[1] = index;
    } else {
      node.end = index;
    }
  }
@param {{range?: [number, number], end?: number}} node
@param {number} index