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 84b28c50bd123501b512cfd3659fd0727fc6b4df..6a2e255e9ebf2e742dafaf67bb7d5bff9f2f5d59 100644 |
--- a/pkg/analyzer_cli/lib/src/analyzer_impl.dart |
+++ b/pkg/analyzer_cli/lib/src/analyzer_impl.dart |
@@ -121,13 +121,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)); |
Brian Wilkerson
2015/12/16 15:08:43
The original code looks weird to me. Seems like we
skybrian
2015/12/17 04:20:27
Yes that does seem strange, but I think I'd like t
Brian Wilkerson
2015/12/17 15:05:41
sounds good
|
+ } |
+ }); |
} |
+ static final PerformanceTag _prepareErrorsTag = |
Brian Wilkerson
2015/12/16 15:08:43
Don't forget to sort and format the file before co
skybrian
2015/12/17 04:20:27
Formatted. It's not clear to me which order this f
Brian Wilkerson
2015/12/17 15:05:41
The sort function available from either IntelliJ o
|
+ new PerformanceTag("AnalyzerImpl.prepareErrors"); |
+ |
/// Fills [sources]. |
void prepareSources(LibraryElement library) { |
var units = new Set<CompilationUnitElement>(); |
@@ -154,15 +158,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(); |
} |
@@ -175,6 +177,15 @@ class AnalyzerImpl { |
return status; |
} |
+ LibraryElement _resolveLibrary() { |
+ return _resolveLibraryTag.makeCurrentWhile(() { |
+ return context.computeLibraryElement(librarySource); |
+ }); |
+ } |
+ |
+ static final PerformanceTag _resolveLibraryTag = |
+ new PerformanceTag("AnalyzerImpl._resolveLibrary"); |
+ |
bool _isDesiredError(AnalysisError error) { |
if (error.errorCode.type == ErrorType.TODO) { |
return false; |
@@ -215,7 +226,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 |