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

Side by Side Diff: lib/runtime/messages_widget.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, 1 month 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 unified diff | Download patch
« no previous file with comments | « lib/runtime/messages.css ('k') | lib/runtime/messages_widget.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /// This library displays [MessageSummary]s from the Dart Dev Compiler. 5 /// This library displays [MessageSummary]s from the Dart Dev Compiler.
6 library dev_compiler.messages; 6 library dev_compiler.messages;
7 7
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:html'; 9 import 'dart:html';
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 for (var m in messages) { 49 for (var m in messages) {
50 var message = _hyperlinkUrls(_escape(m.message)); 50 var message = _hyperlinkUrls(_escape(m.message));
51 var span = m.span; 51 var span = m.span;
52 var sb = new StringBuffer(); 52 var sb = new StringBuffer();
53 sb.write('<div class="message"><div class="text $level">$message</div>'); 53 sb.write('<div class="message"><div class="text $level">$message</div>');
54 if (span != null) { 54 if (span != null) {
55 sb.write('<div class="location">' 55 sb.write('<div class="location">'
56 ' <span class="location">${span.start.toolString}</span></div>' 56 ' <span class="location">${span.start.toolString}</span></div>'
57 ' <span class="text">'); 57 ' <span class="text">');
58 if (span is SourceSpanWithContext) { 58 if (span is SourceSpanWithContext) {
59 var context = span.context; 59 sb.write(_escape(span.context.substring(0, span.start.column)));
60 sb.write(_escape(context.substring(0, span.start.column)));
61 sb.write('<span class="$level">'); 60 sb.write('<span class="$level">');
62 sb.write(_escape(span.text)); 61 sb.write(_escape(span.text));
63 sb.write('</span>'); 62 sb.write('</span>');
64 sb.write(_escape(context.substring(span.end.column))); 63 var end = span.start.column + span.text.length;
64 sb.write(_escape(span.context.substring(end)));
65 } else { 65 } else {
66 sb.write(_escape(span.text)); 66 sb.write(_escape(span.text));
67 } 67 }
68 sb.write('</span></div></div>'); 68 sb.write('</span></div></div>');
69 } 69 }
70 sb.write('</div>'); 70 sb.write('</div>');
71 71
72 var logElement = new Element.html('$sb', 72 var logElement = new Element.html('$sb',
73 validator: new NodeValidatorBuilder.common() 73 validator: new NodeValidatorBuilder.common()
74 ..allowNavigation(new _OpenUriPolicy())); 74 ..allowNavigation(new _OpenUriPolicy()));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 class _Visitor extends RecursiveSummaryVisitor { 121 class _Visitor extends RecursiveSummaryVisitor {
122 final Map<String, List<MessageSummary>> messagesByLevel = {}; 122 final Map<String, List<MessageSummary>> messagesByLevel = {};
123 123
124 @override 124 @override
125 void visitMessage(MessageSummary message) { 125 void visitMessage(MessageSummary message) {
126 var level = message.level.toLowerCase(); 126 var level = message.level.toLowerCase();
127 messagesByLevel.putIfAbsent(level, () => []); 127 messagesByLevel.putIfAbsent(level, () => []);
128 messagesByLevel[level].add(message); 128 messagesByLevel[level].add(message);
129 } 129 }
130 } 130 }
OLDNEW
« no previous file with comments | « lib/runtime/messages.css ('k') | lib/runtime/messages_widget.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698