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

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

Issue 841813002: Linter analyzer plumbing. (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
Index: pkg/analyzer/lib/src/generated/resolver.dart
===================================================================
--- pkg/analyzer/lib/src/generated/resolver.dart (revision 42670)
+++ pkg/analyzer/lib/src/generated/resolver.dart (working copy)
@@ -1299,7 +1299,8 @@
// TODO(jwren) After dartbug.com/13732, revisit this, we should be able to
// remove the (x is! TypeParameterType) checks.
AstNode parent = node.parent;
- if (parent is ConditionalExpression && (node == parent.thenExpression || node == parent.elseExpression)) {
+ if (parent is ConditionalExpression &&
+ (node == parent.thenExpression || node == parent.elseExpression)) {
Expression thenExpression = parent.thenExpression;
DartType thenType;
if (thenExpression is AsExpression) {
@@ -5138,7 +5139,49 @@
}
}
+
/**
+ * Traverses a library's worth of dart code at a time to generate lint warnings
+ * over the set of sources.
+ *
+ * See [LintCode].
+ */
+class LintGenerator {
+
+ final List<CompilationUnit> _compilationUnits;
+ final AnalysisErrorListener _errorListener;
+
+ LintGenerator(this._compilationUnits, this._errorListener);
+
+ 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);
+ unit.accept(new LintVerifier(errorReporter));
+ }
+}
+
+class LintVerifier extends RecursiveAstVisitor<Object> {
+
+ final ErrorReporter _reporter;
+
+ LintVerifier(this._reporter);
+}
+
+
+/**
* Instances of the class {@code HtmlTagInfo} record information about the tags used in an HTML
* file.
*/

Powered by Google App Engine
This is Rietveld 408576698