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.services.lint; | 5 library analyzer.src.services.lint; |
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/error/listener.dart'; |
10 import 'package:analyzer/src/generated/engine.dart'; | 11 import 'package:analyzer/src/generated/engine.dart'; |
11 import 'package:analyzer/src/generated/error.dart'; | |
12 import 'package:analyzer/src/task/model.dart'; | 12 import 'package:analyzer/src/task/model.dart'; |
13 import 'package:analyzer/task/model.dart'; | 13 import 'package:analyzer/task/model.dart'; |
14 | 14 |
15 const List<Linter> _noLints = const <Linter>[]; | 15 const List<Linter> _noLints = const <Linter>[]; |
16 | 16 |
17 /// The descriptor used to associate lints with analysis contexts in | 17 /// The descriptor used to associate lints with analysis contexts in |
18 /// configuration data. | 18 /// configuration data. |
19 final ResultDescriptor<List<Linter>> CONFIGURED_LINTS_KEY = | 19 final ResultDescriptor<List<Linter>> CONFIGURED_LINTS_KEY = |
20 new ResultDescriptorImpl('configured.lints', _noLints); | 20 new ResultDescriptorImpl('configured.lints', _noLints); |
21 | 21 |
(...skipping 28 matching lines...) Expand all Loading... |
50 /// Manages lint timing. | 50 /// Manages lint timing. |
51 class LintRegistry { | 51 class LintRegistry { |
52 /// Dictionary mapping lints (by name) to timers. | 52 /// Dictionary mapping lints (by name) to timers. |
53 final Map<String, Stopwatch> timers = new HashMap<String, Stopwatch>(); | 53 final Map<String, Stopwatch> timers = new HashMap<String, Stopwatch>(); |
54 | 54 |
55 /// Get a timer associated with the given lint rule (or create one if none | 55 /// Get a timer associated with the given lint rule (or create one if none |
56 /// exists). | 56 /// exists). |
57 Stopwatch getTimer(Linter linter) => | 57 Stopwatch getTimer(Linter linter) => |
58 timers.putIfAbsent(linter.name, () => new Stopwatch()); | 58 timers.putIfAbsent(linter.name, () => new Stopwatch()); |
59 } | 59 } |
OLD | NEW |