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

Unified Diff: lib/src/report.dart

Issue 1419953002: Fix the error message widget (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebase 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 | « lib/runtime/messages_widget.js ('k') | lib/src/server/server.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/report.dart
diff --git a/lib/src/report.dart b/lib/src/report.dart
index 6c74fe1ee2c435217d4c3273bac07f1a8ecb2238..03686fdc811d3b5c98fb5c7a479de10ccff7bbdb 100644
--- a/lib/src/report.dart
+++ b/lib/src/report.dart
@@ -137,7 +137,15 @@ class SummaryReporter implements AnalysisErrorListener {
var span = _toSpan(_context, error);
var summary = _getIndividualSummary(error.source.uri);
if (summary is LibrarySummary) {
- summary.countSourceLines(_context, error.source);
+ summary.recordSourceLines(error.source.uri, () {
+ // TODO(jmesserly): parsing is serious overkill for this.
+ // Should be cached, but still.
+ // On the other hand, if we are going to parse, we could get a much
+ // better source lines of code estimate by excluding things like
+ // comments, blank lines, and closing braces.
+ var unit = _context.parseCompilationUnit(error.source);
+ return unit.lineInfo.getLocation(unit.endToken.end).lineNumber;
+ });
}
summary.messages.add(new MessageSummary(errorCodeName(code),
code.errorSeverity.displayName, span, error.message));
« no previous file with comments | « lib/runtime/messages_widget.js ('k') | lib/src/server/server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698