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

Unified Diff: runtime/bin/dbg_message.cc

Issue 146833007: Don’t call toString from debugger (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 11 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 | « no previous file | tests/standalone/debugger/tostring_throws_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/dbg_message.cc
===================================================================
--- runtime/bin/dbg_message.cc (revision 31995)
+++ runtime/bin/dbg_message.cc (working copy)
@@ -201,6 +201,7 @@
Dart_Handle object,
intptr_t max_chars,
bool expand_list) {
+ ASSERT(!Dart_IsError(object));
if (Dart_IsList(object)) {
if (expand_list) {
FormatTextualListValue(buf, object, max_chars);
@@ -213,15 +214,17 @@
buf->Printf("\\\"");
FormatEncodedCharsTrunc(buf, object, max_chars);
buf->Printf("\\\"");
+ } else if (Dart_IsNumber(object) || Dart_IsBoolean(object)) {
+ Dart_Handle text = Dart_ToString(object);
+ ASSERT(!Dart_IsNull(text) && !Dart_IsError(text));
+ FormatEncodedCharsTrunc(buf, text, max_chars);
} else {
- Dart_Handle text = Dart_ToString(object);
- if (Dart_IsNull(text)) {
- buf->Printf("null");
- } else if (Dart_IsError(text)) {
- buf->Printf("#ERROR");
- } else {
- FormatEncodedCharsTrunc(buf, text, max_chars);
- }
+ Dart_Handle type = Dart_InstanceGetType(object);
+ ASSERT_NOT_ERROR(type);
+ type = Dart_ToString(type);
+ ASSERT_NOT_ERROR(type);
+ buf->Printf("object of type ");
+ FormatEncodedCharsTrunc(buf, type, max_chars);
}
}
« no previous file with comments | « no previous file | tests/standalone/debugger/tostring_throws_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698