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

Unified Diff: lib/devc.dart

Issue 1183733004: fixes #25, most analyzer errors were not computed (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | lib/src/info.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/devc.dart
diff --git a/lib/devc.dart b/lib/devc.dart
index 2e3687bb224ac0b07ce60e58e314649e9b997d57..a5ea96a24c529c1e7b082b7556213ec536106095 100644
--- a/lib/devc.dart
+++ b/lib/devc.dart
@@ -9,7 +9,8 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io';
-import 'package:analyzer/src/generated/error.dart' as analyzer;
+import 'package:analyzer/src/generated/error.dart'
+ show AnalysisError, ErrorSeverity, ErrorType;
import 'package:analyzer/src/generated/engine.dart'
show AnalysisContext, ChangeSet;
import 'package:analyzer/src/generated/source.dart' show Source;
@@ -27,7 +28,7 @@ import 'src/codegen/html_codegen.dart';
import 'src/codegen/js_codegen.dart';
import 'src/dependency_graph.dart';
import 'src/info.dart'
- show AnalyzerError, CheckerResults, LibraryInfo, LibraryUnit;
+ show AnalyzerMessage, CheckerResults, LibraryInfo, LibraryUnit;
import 'src/options.dart';
import 'src/report.dart';
import 'src/utils.dart';
@@ -201,11 +202,21 @@ class Compiler implements AbstractCompiler {
/// Log any errors encountered when resolving [source] and return whether any
/// errors were found.
bool logErrors(Source source) {
- List<analyzer.AnalysisError> errors = context.getErrors(source).errors;
+ context.computeErrors(source);
+ List<AnalysisError> errors = context.getErrors(source).errors;
bool failure = false;
if (errors.isNotEmpty) {
for (var error in errors) {
- var message = new AnalyzerError.from(error);
+ // Always skip TODOs.
+ if (error.errorCode.type == ErrorType.TODO) continue;
+
+ // Skip hints for now. In the future these could be turned on via flags.
+ if (error.errorCode.errorSeverity.ordinal <
+ ErrorSeverity.WARNING.ordinal) {
+ continue;
+ }
+
+ var message = new AnalyzerMessage.from(error);
if (message.level == Level.SEVERE) failure = true;
_reporter.log(message);
}
« no previous file with comments | « no previous file | lib/src/info.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698