OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library analyzer.src.task.dart; | 5 library analyzer.src.task.dart; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
(...skipping 2797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2808 // | 2808 // |
2809 // Prepare inputs. | 2809 // Prepare inputs. |
2810 // | 2810 // |
2811 CompilationUnit unit = getRequiredInput(RESOLVED_UNIT_INPUT); | 2811 CompilationUnit unit = getRequiredInput(RESOLVED_UNIT_INPUT); |
2812 | 2812 |
2813 // | 2813 // |
2814 // Generate lints. | 2814 // Generate lints. |
2815 // | 2815 // |
2816 List<AstVisitor> visitors = <AstVisitor>[]; | 2816 List<AstVisitor> visitors = <AstVisitor>[]; |
2817 | 2817 |
| 2818 bool timeVisits = analysisOptions.enableTiming; |
2818 List<Linter> linters = getLints(context); | 2819 List<Linter> linters = getLints(context); |
2819 for (Linter linter in linters) { | 2820 for (Linter linter in linters) { |
2820 AstVisitor visitor = linter.getVisitor(); | 2821 AstVisitor visitor = linter.getVisitor(); |
2821 if (visitor != null) { | 2822 if (visitor != null) { |
2822 linter.reporter = errorReporter; | 2823 linter.reporter = errorReporter; |
2823 visitors | 2824 if (timeVisits) { |
2824 .add(new TimedAstVisitor(visitor, lintRegistry.getTimer(linter))); | 2825 visitor = new TimedAstVisitor(visitor, lintRegistry.getTimer(linter)); |
| 2826 } |
| 2827 visitors.add(visitor); |
2825 } | 2828 } |
2826 } | 2829 } |
2827 | 2830 |
2828 DelegatingAstVisitor dv = new DelegatingAstVisitor(visitors); | 2831 DelegatingAstVisitor dv = new DelegatingAstVisitor(visitors); |
2829 unit.accept(dv); | 2832 unit.accept(dv); |
2830 | 2833 |
2831 // | 2834 // |
2832 // Record outputs. | 2835 // Record outputs. |
2833 // | 2836 // |
2834 outputs[LINTS] = errorListener.errors; | 2837 outputs[LINTS] = errorListener.errors; |
(...skipping 2512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5347 | 5350 |
5348 @override | 5351 @override |
5349 bool moveNext() { | 5352 bool moveNext() { |
5350 if (_newSources.isEmpty) { | 5353 if (_newSources.isEmpty) { |
5351 return false; | 5354 return false; |
5352 } | 5355 } |
5353 currentTarget = _newSources.removeLast(); | 5356 currentTarget = _newSources.removeLast(); |
5354 return true; | 5357 return true; |
5355 } | 5358 } |
5356 } | 5359 } |
OLD | NEW |