Index: pkg/analyzer/lib/src/task/dart.dart |
diff --git a/pkg/analyzer/lib/src/task/dart.dart b/pkg/analyzer/lib/src/task/dart.dart |
index 408db9e179fd4428465287be74c85d0dd8830b46..063a7d9ab2793a40ac1a328dd4c0d97c936345d7 100644 |
--- a/pkg/analyzer/lib/src/task/dart.dart |
+++ b/pkg/analyzer/lib/src/task/dart.dart |
@@ -2815,13 +2815,16 @@ class GenerateLintsTask extends SourceBasedAnalysisTask { |
// |
List<AstVisitor> visitors = <AstVisitor>[]; |
+ bool timeVisits = analysisOptions.enableTiming; |
List<Linter> linters = getLints(context); |
for (Linter linter in linters) { |
AstVisitor visitor = linter.getVisitor(); |
if (visitor != null) { |
linter.reporter = errorReporter; |
- visitors |
- .add(new TimedAstVisitor(visitor, lintRegistry.getTimer(linter))); |
+ if (timeVisits) { |
+ visitor = new TimedAstVisitor(visitor, lintRegistry.getTimer(linter)); |
+ } |
+ visitors.add(visitor); |
} |
} |