Index: pkg/analyzer_cli/lib/src/analyzer_impl.dart |
diff --git a/pkg/analyzer_cli/lib/src/analyzer_impl.dart b/pkg/analyzer_cli/lib/src/analyzer_impl.dart |
index d54178e5663d67b90adea189c38ee3f4a371b00d..1add1e58c8e3d1c8b019a0a100ad98053f54b185 100644 |
--- a/pkg/analyzer_cli/lib/src/analyzer_impl.dart |
+++ b/pkg/analyzer_cli/lib/src/analyzer_impl.dart |
@@ -122,13 +122,17 @@ class AnalyzerImpl { |
/// Fills [errorInfos] using [sources]. |
void prepareErrors() { |
- for (Source source in sources) { |
- context.computeErrors(source); |
- |
- errorInfos.add(context.getErrors(source)); |
- } |
+ return _prepareErrorsTag.makeCurrentWhile(() { |
+ for (Source source in sources) { |
+ context.computeErrors(source); |
+ errorInfos.add(context.getErrors(source)); |
+ } |
+ }); |
} |
+ static final PerformanceTag _prepareErrorsTag = |
+ new PerformanceTag("AnalyzerImpl.prepareErrors"); |
+ |
/// Fills [sources]. |
void prepareSources(LibraryElement library) { |
var units = new Set<CompilationUnitElement>(); |
@@ -155,15 +159,13 @@ class AnalyzerImpl { |
"${librarySource.fullName} is a part and can not be analyzed."); |
return ErrorSeverity.ERROR; |
} |
- // Resolve library. |
- var libraryElement = context.computeLibraryElement(librarySource); |
- // Prepare source and errors. |
+ var libraryElement = _resolveLibrary(); |
prepareSources(libraryElement); |
prepareErrors(); |
// Print errors and performance numbers. |
if (printMode == 1) { |
- _printErrorsAndPerf(); |
+ _printErrors(); |
} else if (printMode == 2) { |
_printColdPerf(); |
} |
@@ -205,7 +207,7 @@ class AnalyzerImpl { |
outSink.writeln("total-cold:$totalTime"); |
} |
- _printErrorsAndPerf() { |
+ _printErrors() { |
// The following is a hack. We currently print out to stderr to ensure that |
// when in batch mode we print to stderr, this is because the prints from |
// batch are made to stderr. The reason that options.shouldBatch isn't used |
@@ -249,6 +251,15 @@ class AnalyzerImpl { |
return new ProcessedSeverity(severity, isOverridden); |
} |
+ LibraryElement _resolveLibrary() { |
+ return _resolveLibraryTag.makeCurrentWhile(() { |
+ return context.computeLibraryElement(librarySource); |
+ }); |
+ } |
+ |
+ static final PerformanceTag _resolveLibraryTag = |
+ new PerformanceTag("AnalyzerImpl._resolveLibrary"); |
+ |
/// Compute the severity of the error; however: |
/// * if [options.enableTypeChecks] is false, then de-escalate checked-mode |
/// compile time errors to a severity of [ErrorSeverity.INFO]. |