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

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

Issue 2033433007: Fixed type error in MapEntry and added keyToStringConfig to display the toString() of a key in a Ma… (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 6 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 43d553d2e171c45c9bb0fcb2f113a4915d396d16..975ad5eed40fec8fec195adfc616e45de7b5ae69 100644
--- a/tool/input_sdk/private/debugger.dart
+++ b/tool/input_sdk/private/debugger.dart
@@ -10,12 +10,17 @@ import 'dart:core';
import 'dart:collection';
import 'dart:html' as html;
-/// Config object to pass to devtools to signal that an object should not be
+/// Config String to pass to devtools to signal that an object should not be
/// formatted by the Dart formatter. This is used to specify that an Object
/// should just be displayed using the regular JavaScript view instead of a
/// custom Dart view. For example, this is used to display the JavaScript view
/// of a Dart Function as a child of the regular Function object.
-const skipDartConfig = const Object();
+const skipDartConfig = "skipDartConfig";
+
+/// Config String to pass to devtools to signal that a map key object should
+/// have its toString() displayed by the Dart formatter.
+const keyToStringConfig = "keyToStringConfig";
Jacob 2016/06/03 23:11:50 A cleaner solution would be to have an enum of co
priscillalee 2016/06/07 22:58:01 Used a class JsonMLConfig that simulated an enum i
+
final int maxIterableChildrenToDisplay = 50;
var _devtoolsFormatter = new JsonMLFormatter(new DartFormatter());
@@ -85,8 +90,9 @@ bool hasMethod(object, String name) {
/// [JsonMLFormatter] consumes [NameValuePair] objects and
class NameValuePair {
- NameValuePair({this.name, this.value, bool skipDart})
- : skipDart = skipDart == true;
+ NameValuePair({this.name, this.value, bool skipDart, bool keyToString})
Jacob 2016/06/03 23:11:50 change this to just take an entry of the enum Jso
priscillalee 2016/06/07 22:58:01 Done.
+ : skipDart = skipDart == true,
+ keyToString = keyToString == true;
// Define equality and hashCode so that NameValuePair can be used
// in a Set to dedupe entries with duplicate names.
@@ -96,12 +102,13 @@ class NameValuePair {
final String name;
final Object value;
final bool skipDart;
+ final bool keyToString;
}
class MapEntry {
MapEntry({this.key, this.value});
- final String key;
+ final Object key;
final Object value;
}
@@ -200,6 +207,10 @@ class JsonMLFormatter {
var c = _simpleFormatter.preview(object);
if (c == null) return null;
+ if (identical(config, keyToStringConfig)) {
Jacob 2016/06/03 23:11:50 switch to using == instead of identical
priscillalee 2016/06/07 22:58:01 Done.
+ c = object.toString();
+ }
+
// Indicate this is a Dart Object by using a Dart background color.
// This is stylistically a bit ugly but it eases distinguishing Dart and
// JS objects.
@@ -233,6 +244,9 @@ class JsonMLFormatter {
if (child.skipDart) {
objectTag.addAttribute('config', skipDartConfig);
}
+ if (child.keyToString) {
+ objectTag.addAttribute('config', keyToStringConfig);
+ }
if (!_simpleFormatter.hasChildren(child.value)) {
li.setStyle("padding-left: 13px;");
}
@@ -561,7 +575,7 @@ class MapEntryFormatter implements Formatter {
bool hasChildren(object) => true;
List<NameValuePair> children(object) => <NameValuePair>[
- new NameValuePair(name: 'key', value: object.key),
+ new NameValuePair(name: 'key', value: object.key, keyToString: true),
new NameValuePair(name: 'value', value: object.value)
];
}
« 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