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

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 850343006: Linter API updates. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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 | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | pkg/analyzer/lib/src/services/lint.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/resolver.dart
===================================================================
--- pkg/analyzer/lib/src/generated/resolver.dart (revision 43022)
+++ pkg/analyzer/lib/src/generated/resolver.dart (working copy)
@@ -9202,57 +9202,7 @@
}
}
-/// 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() {
- TimeCounter_TimeCounterHandle timeCounter =
- PerformanceStatistics.lint.start();
- try {
- _compilationUnits.forEach((cu) {
- if (cu.element != null) {
- _generate(cu, cu.element.source);
- }
- });
- } finally {
- timeCounter.stop();
- }
- }
-
- 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)));
- }
-}
-
/**
* This class is used to replace uses of `HashMap<String, ExecutableElement>` which are not as
* performant as this class.
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | pkg/analyzer/lib/src/services/lint.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698