collectScopesRecursively static method

void collectScopesRecursively(
  1. ZenScope scope,
  2. List<ZenScope> collection
)

Recursively collect all scopes starting from a given scope

Implementation

static void collectScopesRecursively(
    ZenScope scope, List<ZenScope> collection) {
  // Add the current scope
  collection.add(scope);

  // Recursively add all child scopes
  for (final child in scope.childScopes) {
    collectScopesRecursively(child, collection);
  }
}