static int getDepth(const std::shared_ptr<SerializedScope> chain) {
  int depth = 0;
  const SerializedScope *current = chain.get();
  while (current) {
    depth += 1;
    current = current->parentScope.get();
  }
  return depth;
}
static int getDepth(const std::shared_ptr<SerializedScope> chain) {
  int depth = 0;
  const SerializedScope *current = chain.get();
  while (current) {
    depth += 1;
    current = current->parentScope.get();
  }
  return depth;
}