analyze method

InheritanceResult analyze(
  1. String sourceCode
)

Analyzes the given Dart source code and returns inheritance depth metrics.

The sourceCode parameter contains the Dart code to analyze. Returns an InheritanceResult containing the maximum depth and per-class depth information.

Implementation

InheritanceResult analyze(String sourceCode) {
  final parseResult = parseString(
    content: sourceCode,
    featureSet: FeatureSet.latestLanguageVersion(),
    throwIfDiagnostics: false,
  );

  final _InheritanceVisitor visitor = _InheritanceVisitor();
  parseResult.unit.visitChildren(visitor);

  return visitor.getResult();
}