getScopeDepth static method

int getScopeDepth(
  1. ZenScope targetScope
)

Get hierarchy depth for a specific scope

Implementation

static int getScopeDepth(ZenScope targetScope) {
  int depth = 0;
  ZenScope? current = targetScope.parent;

  while (current != null) {
    depth++;
    current = current.parent;
  }

  return depth;
}