analyzeScopeHierarchy method

String analyzeScopeHierarchy(
  1. List<ZenScope> scopes
)

Analyze scope hierarchy

Implementation

String analyzeScopeHierarchy(List<ZenScope> scopes) {
  final buffer = StringBuffer();

  buffer.writeln('=== SCOPE HIERARCHY ANALYSIS ===\n');

  // Find root scopes (those without parents)
  final rootScopes =
      scopes.where((s) => s.parent == null && !s.isDisposed).toList();

  if (rootScopes.isEmpty) {
    buffer.writeln('No root scopes found');
    return buffer.toString();
  }

  for (final rootScope in rootScopes) {
    _analyzeScope(rootScope, buffer, 0);
  }

  return buffer.toString();
}