| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /// Summarizes the information produced by the checker. | 5 /// Summarizes the information produced by the checker. |
| 6 library dev_compiler.src.report; | 6 library dev_compiler.src.report; |
| 7 | 7 |
| 8 import 'dart:math' show max; | 8 import 'dart:math' show max; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/source.dart' show Source; | 10 import 'package:analyzer/src/generated/source.dart' show Source; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 void log(Message message) { | 103 void log(Message message) { |
| 104 if (message is StaticInfo) { | 104 if (message is StaticInfo) { |
| 105 assert((message.node as dynamic).root.element.source == _current); | 105 assert((message.node as dynamic).root.element.source == _current); |
| 106 } | 106 } |
| 107 // TODO(sigmund): convert to use span information from AST (issue #73) | 107 // TODO(sigmund): convert to use span information from AST (issue #73) |
| 108 final span = message is MessageWithSpan | 108 final span = message is MessageWithSpan |
| 109 ? message.span | 109 ? message.span |
| 110 : _file.span(message.begin, message.end); | 110 : _file.span(message.begin, message.end); |
| 111 final level = message.level; | 111 final level = message.level; |
| 112 final color = useColors ? colorOf(level.name) : null; | 112 final color = useColors ? colorOf(level.name) : null; |
| 113 _checkerLogger.log(level, span.message(message.message, color: color)); | 113 final text = '[${message.runtimeType}] ${message.message}'; |
| 114 _checkerLogger.log(level, span.message(text, color: color)); |
| 114 } | 115 } |
| 115 | 116 |
| 116 void clearLibrary(Uri uri) {} | 117 void clearLibrary(Uri uri) {} |
| 117 void clearHtml(Uri uri) {} | 118 void clearHtml(Uri uri) {} |
| 118 void clearAll() {} | 119 void clearAll() {} |
| 119 } | 120 } |
| 120 | 121 |
| 121 /// A reporter that gathers all the information in a [GlobalSummary]. | 122 /// A reporter that gathers all the information in a [GlobalSummary]. |
| 122 class SummaryReporter implements CheckerReporter { | 123 class SummaryReporter implements CheckerReporter { |
| 123 GlobalSummary result = new GlobalSummary(); | 124 GlobalSummary result = new GlobalSummary(); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 | 376 |
| 376 visitMessage(MessageSummary message) { | 377 visitMessage(MessageSummary message) { |
| 377 var kind = message.kind; | 378 var kind = message.kind; |
| 378 errorCount.putIfAbsent(currentPackage, () => <String, int>{}); | 379 errorCount.putIfAbsent(currentPackage, () => <String, int>{}); |
| 379 errorCount[currentPackage].putIfAbsent(kind, () => 0); | 380 errorCount[currentPackage].putIfAbsent(kind, () => 0); |
| 380 errorCount[currentPackage][kind]++; | 381 errorCount[currentPackage][kind]++; |
| 381 totals.putIfAbsent(kind, () => 0); | 382 totals.putIfAbsent(kind, () => 0); |
| 382 totals[kind]++; | 383 totals[kind]++; |
| 383 } | 384 } |
| 384 } | 385 } |
| OLD | NEW |