services/codebase_analyzer library

AST-based Dart code analyzer for finding API usages semantically.

This is the core analysis engine of the upgrade helper. Unlike regex-based search, it uses package:analyzer to parse Dart files into ASTs and then visits nodes to find exact API usages with full type resolution, enclosing scope information, and import source tracking.

Two analysis modes are supported:

  • Resolved (default): Full type resolution via getResolvedUnit. Slower but produces accurate ApiMatch.resolvedType and ApiMatch.importSource.
  • Unresolved: Fast parse via getParsedUnit. Only matches by name without type info. Useful for quick scans.