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

Unified Diff: lib/src/summary.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/src/server/server.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/summary.dart
diff --git a/lib/src/summary.dart b/lib/src/summary.dart
index fc50707798649c272040f5dca8dac31daa7f8041..16861f2a8fd3defecdba07fdd1713f4e7be1ac40 100644
--- a/lib/src/summary.dart
+++ b/lib/src/summary.dart
@@ -7,8 +7,6 @@ library dev_compiler.src.summary;
import 'dart:collection' show HashSet;
-import 'package:analyzer/src/generated/engine.dart' show AnalysisContext;
-import 'package:analyzer/src/generated/source.dart' show Source;
import 'package:source_span/source_span.dart';
/// Summary information computed by the DDC checker.
@@ -123,15 +121,9 @@ class LibrarySummary implements IndividualSummary {
'lines': lines,
};
- void countSourceLines(AnalysisContext context, Source source) {
- if (_uris.add(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(source);
- _lines += unit.lineInfo.getLocation(unit.endToken.end).lineNumber;
+ void recordSourceLines(Uri uri, int computeLines()) {
+ if (_uris.add(uri)) {
+ _lines += computeLines();
}
}
@@ -139,7 +131,8 @@ class LibrarySummary implements IndividualSummary {
static LibrarySummary parse(Map json) =>
new LibrarySummary(json['library_name'],
- messages: json['messages'].map(MessageSummary.parse).toList(),
+ messages: new List<MessageSummary>.from(
+ json['messages'].map(MessageSummary.parse)),
lines: json['lines']);
}
@@ -160,7 +153,9 @@ class HtmlSummary implements IndividualSummary {
void accept(SummaryVisitor visitor) => visitor.visitHtml(this);
static HtmlSummary parse(Map json) => new HtmlSummary(
- json['name'], json['messages'].map(MessageSummary.parse).toList());
+ json['name'],
+ new List<MessageSummary>.from(
+ json['messages'].map(MessageSummary.parse)));
}
/// A single message produced by the checker.
« no previous file with comments | « lib/src/server/server.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698