Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2606)

Unified Diff: analyzer/lib/src/services/lint.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « analyzer/lib/src/plugin/options_plugin.dart ('k') | analyzer/lib/src/string_source.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: analyzer/lib/src/services/lint.dart
diff --git a/analyzer/lib/src/services/lint.dart b/analyzer/lib/src/services/lint.dart
deleted file mode 100644
index 9dd51a0e41319bdf55d7645305ae528d9a6fc415..0000000000000000000000000000000000000000
--- a/analyzer/lib/src/services/lint.dart
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library lint;
-
-import 'package:analyzer/src/generated/ast.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/error.dart';
-import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/generated/visitors.dart';
-
-/// Implementers contribute lint warnings via the provided error [reporter].
-abstract class Linter {
- /// Used to report lint warnings.
- /// NOTE: this is set by the framework before visit begins.
- ErrorReporter reporter;
-
- /// Return a visitor to be passed to compilation units to perform lint
- /// analysis.
- /// Lint errors are reported via this [Linter]'s error [reporter].
- AstVisitor getVisitor();
-}
-
-/// Traverses a library's worth of dart code at a time to generate lint warnings
-/// over the set of sources.
-///
-/// See [LintCode].
-class LintGenerator {
-
- /// A global container for contributed linters.
- static final List<Linter> LINTERS = <Linter>[];
-
- final Iterable<CompilationUnit> _compilationUnits;
- final AnalysisErrorListener _errorListener;
- final Iterable<Linter> _linters;
-
- LintGenerator(this._compilationUnits, this._errorListener,
- [Iterable<Linter> linters])
- : _linters = linters != null ? linters : LINTERS;
-
- void generate() {
- PerformanceStatistics.lint.makeCurrentWhile(() {
- _compilationUnits.forEach((cu) {
- if (cu.element != null) {
- _generate(cu, cu.element.source);
- }
- });
- });
- }
-
- void _generate(CompilationUnit unit, Source source) {
- ErrorReporter errorReporter = new ErrorReporter(_errorListener, source);
- _linters.forEach((l) => l.reporter = errorReporter);
- Iterable<AstVisitor> visitors = _linters.map((l) => l.getVisitor());
- unit.accept(new DelegatingAstVisitor(visitors.where((v) => v != null)));
- }
-}
« no previous file with comments | « analyzer/lib/src/plugin/options_plugin.dart ('k') | analyzer/lib/src/string_source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698