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

Unified Diff: tool/input_sdk/private/debugger.dart

Issue 2189673002: StackTrace formatters (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: "Return cleanup Created 4 years, 5 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/dart_sdk.js ('k') | tool/sdk_expected_errors.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tool/input_sdk/private/debugger.dart
diff --git a/tool/input_sdk/private/debugger.dart b/tool/input_sdk/private/debugger.dart
index 0f470d9d1e2905d32b76e9ae5321459f4c9ff229..252b2c84e9ccd1fe459af121085b60105bedbfa7 100644
--- a/tool/input_sdk/private/debugger.dart
+++ b/tool/input_sdk/private/debugger.dart
@@ -312,7 +312,7 @@ class JsonMLFormatter {
// This is stylistically a bit ugly but it eases distinguishing Dart and
// JS objects.
var element = new JsonMLElement('span')
- ..setStyle('background-color: #d9edf7')
+ ..setStyle('background-color: #d9edf7;')
..createTextChild(c);
return element.toJsonML();
}
@@ -325,7 +325,10 @@ class JsonMLFormatter {
'padding-left: 0px;'
'margin-top: 0px;'
'margin-bottom: 0px;'
- 'margin-left: 12px');
+ 'margin-left: 12px;');
+ if (object is StackTrace) {
+ body.addStyle('color: rgb(196, 26, 22);');
+ }
var children = _simpleFormatter.children(object);
for (NameValuePair child in children) {
var li = body.createChild('li');
@@ -374,6 +377,7 @@ class DartFormatter {
new IterableFormatter(),
new MapEntryFormatter(),
new IterableSpanFormatter(),
+ new StackTraceFormatter(),
new ClassMetadataFormatter(),
new HeritageClauseFormatter(),
new LibraryModuleFormatter(),
@@ -835,6 +839,25 @@ class IterableSpanFormatter implements Formatter {
List<NameValuePair> children(object) => object.children();
}
+class StackTraceFormatter implements Formatter {
+ accept(object) => object is StackTrace;
+
+ String preview(object) => 'StackTrace';
+
+ bool hasChildren(object) => true;
+
+ // Using the stack_trace formatting would be ideal, but adding the
+ // dependency or re-writing the code is too messy, so each line of the
+ // StackTrace will be added as its own child.
+ List<NameValuePair> children(object) => object
+ .toString()
+ .split('\n')
+ .map((line) => new NameValuePair(
+ value: line.replaceFirst(new RegExp(r'^\s+at\s'), ''),
+ hideName: true))
+ .toList();
+}
+
/// This entry point is automatically invoked by the code generated by
/// Dart Dev Compiler
registerDevtoolsFormatter() {
« no previous file with comments | « lib/runtime/dart_sdk.js ('k') | tool/sdk_expected_errors.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698