| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library analysis_server.src.status.get_handler; | 5 library analysis_server.src.status.get_handler; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 } else { | 684 } else { |
| 685 String typeName = target.runtimeType.toString(); | 685 String typeName = target.runtimeType.toString(); |
| 686 incrementCount(typeCounts, typeName); | 686 incrementCount(typeCounts, typeName); |
| 687 } | 687 } |
| 688 } | 688 } |
| 689 } | 689 } |
| 690 | 690 |
| 691 int lineCount(Set<Source> sources, bool explicit) { | 691 int lineCount(Set<Source> sources, bool explicit) { |
| 692 return sources.fold(0, (int previousTotal, Source source) { | 692 return sources.fold(0, (int previousTotal, Source source) { |
| 693 LineInfo lineInfo = context.getLineInfo(source); | 693 LineInfo lineInfo = context.getLineInfo(source); |
| 694 if (lineInfo == null) { | 694 if (lineInfo is LineInfoWithCount) { |
| 695 if (explicit) { |
| 696 explicitLineInfoCount++; |
| 697 } else { |
| 698 implicitLineInfoCount++; |
| 699 } |
| 700 return previousTotal + lineInfo.lineCount; |
| 701 } else { |
| 695 return previousTotal; | 702 return previousTotal; |
| 696 } | 703 } |
| 697 if (explicit) { | |
| 698 explicitLineInfoCount++; | |
| 699 } else { | |
| 700 implicitLineInfoCount++; | |
| 701 } | |
| 702 return previousTotal + lineInfo.lineCount; | |
| 703 }); | 704 }); |
| 704 } | 705 } |
| 705 explicitSourceCount += explicitSources.length; | 706 explicitSourceCount += explicitSources.length; |
| 706 explicitLineCount += lineCount(explicitSources, true); | 707 explicitLineCount += lineCount(explicitSources, true); |
| 707 implicitSourceCount += implicitSources.length; | 708 implicitSourceCount += implicitSources.length; |
| 708 implicitLineCount += lineCount(implicitSources, false); | 709 implicitLineCount += lineCount(implicitSources, false); |
| 709 }); | 710 }); |
| 710 List<String> sourceTypeNames = sourceTypeCounts.keys.toList(); | 711 List<String> sourceTypeNames = sourceTypeCounts.keys.toList(); |
| 711 sourceTypeNames.sort(); | 712 sourceTypeNames.sort(); |
| 712 List<String> typeNames = typeCounts.keys.toList(); | 713 List<String> typeNames = typeCounts.keys.toList(); |
| (...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2468 */ | 2469 */ |
| 2469 static String makeLink( | 2470 static String makeLink( |
| 2470 String path, Map<String, String> params, String innerHtml, | 2471 String path, Map<String, String> params, String innerHtml, |
| 2471 [bool hasError = false]) { | 2472 [bool hasError = false]) { |
| 2472 Uri uri = new Uri(path: path, queryParameters: params); | 2473 Uri uri = new Uri(path: path, queryParameters: params); |
| 2473 String href = HTML_ESCAPE.convert(uri.toString()); | 2474 String href = HTML_ESCAPE.convert(uri.toString()); |
| 2474 String classAttribute = hasError ? ' class="error"' : ''; | 2475 String classAttribute = hasError ? ' class="error"' : ''; |
| 2475 return '<a href="$href"$classAttribute>$innerHtml</a>'; | 2476 return '<a href="$href"$classAttribute>$innerHtml</a>'; |
| 2476 } | 2477 } |
| 2477 } | 2478 } |
| OLD | NEW |