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

Unified Diff: lib/src/report.dart

Issue 1235503010: fixes #219, able to compile multiple entry points (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 5 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: lib/src/report.dart
diff --git a/lib/src/report.dart b/lib/src/report.dart
index e6a256566ab076a1bdaa04da604f29b7a3e9f914..61ab5ce3ba66829f65550bc0434c990be67c743c 100644
--- a/lib/src/report.dart
+++ b/lib/src/report.dart
@@ -18,14 +18,6 @@ import 'summary.dart';
final _checkerLogger = new Logger('dev_compiler.checker');
-SourceSpanWithContext _toSpan(AnalysisContext context, AnalysisError error) {
- var source = error.source;
- var lineInfo = context.computeLineInfo(source);
- var content = context.getContents(source).data;
- var start = error.offset;
- var end = start + error.length;
- return createSpanHelper(lineInfo, start, end, source, content);
-}
/// Simple reporter that logs checker messages as they are seen.
class LogReporter implements AnalysisErrorListener {
final AnalysisContext _context;
@@ -43,11 +35,16 @@ class LogReporter implements AnalysisErrorListener {
level = Level.SEVERE;
}
- var color = useColors ? colorOf(level.name) : null;
-
// TODO(jmesserly): figure out what to do with the error's name.
- var text = '[${errorCodeName(error.errorCode)}] ' + error.message;
- text = _toSpan(_context, error).message(text, color: color);
+ var lineInfo = _context.computeLineInfo(error.source);
+ var location = lineInfo.getLocation(error.offset);
+
+ // [warning] 'foo' is not a... (/Users/.../tmp/foo.dart, line 1, col 2)
+ var text = new StringBuffer()
+ ..write('[${errorCodeName(error.errorCode)}] ')
+ ..write(error.message)
+ ..write(' (${path.prettyUri(error.source.uri)}')
+ ..write(', line ${location.lineNumber}, col ${location.columnNumber})');
// TODO(jmesserly): just print these instead of sending through logger?
_checkerLogger.log(level, text);
@@ -101,6 +98,17 @@ class SummaryReporter implements AnalysisErrorListener {
code.errorSeverity.displayName, span, error.message));
}
+ // TODO(jmesserly): fix to not depend on SourceSpan. This will be really slow
+ // because it will reload source text from disk, for every single message...
+ SourceSpanWithContext _toSpan(AnalysisContext context, AnalysisError error) {
+ var source = error.source;
+ var lineInfo = context.computeLineInfo(source);
+ var content = context.getContents(source).data;
+ var start = error.offset;
+ var end = start + error.length;
+ return createSpanHelper(lineInfo, start, end, source, content);
+ }
+
void clearLibrary(Uri uri) {
(_getIndividualSummary(uri) as LibrarySummary).clear();
}

Powered by Google App Engine
This is Rietveld 408576698