| 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 lint; | 5 library lint; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/utilities_general.dart'; | |
| 9 import 'package:analyzer/src/generated/engine.dart'; | 8 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/error.dart'; | 9 import 'package:analyzer/src/generated/error.dart'; |
| 11 import 'package:analyzer/src/generated/source.dart'; | 10 import 'package:analyzer/src/generated/source.dart'; |
| 12 import 'package:analyzer/src/generated/visitors.dart'; | 11 import 'package:analyzer/src/generated/visitors.dart'; |
| 13 | 12 |
| 14 | 13 |
| 15 /// Implementers contribute lint warnings via the provided error [reporter]. | 14 /// Implementers contribute lint warnings via the provided error [reporter]. |
| 16 abstract class Linter { | 15 abstract class Linter { |
| 17 /// Used to report lint warnings. | 16 /// Used to report lint warnings. |
| 18 /// NOTE: this is set by the framework before visit begins. | 17 /// NOTE: this is set by the framework before visit begins. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 }); | 50 }); |
| 52 } | 51 } |
| 53 | 52 |
| 54 void _generate(CompilationUnit unit, Source source) { | 53 void _generate(CompilationUnit unit, Source source) { |
| 55 ErrorReporter errorReporter = new ErrorReporter(_errorListener, source); | 54 ErrorReporter errorReporter = new ErrorReporter(_errorListener, source); |
| 56 _linters.forEach((l) => l.reporter = errorReporter); | 55 _linters.forEach((l) => l.reporter = errorReporter); |
| 57 Iterable<AstVisitor> visitors = _linters.map((l) => l.getVisitor()); | 56 Iterable<AstVisitor> visitors = _linters.map((l) => l.getVisitor()); |
| 58 unit.accept(new DelegatingAstVisitor(visitors.where((v) => v != null))); | 57 unit.accept(new DelegatingAstVisitor(visitors.where((v) => v != null))); |
| 59 } | 58 } |
| 60 } | 59 } |
| OLD | NEW |