OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #include "bin/dbg_connection.h" | 5 #include "bin/dbg_connection.h" |
6 #include "bin/dbg_message.h" | 6 #include "bin/dbg_message.h" |
7 #include "bin/dartutils.h" | 7 #include "bin/dartutils.h" |
8 #include "bin/thread.h" | 8 #include "bin/thread.h" |
9 #include "bin/utils.h" | 9 #include "bin/utils.h" |
10 | 10 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 194 } |
195 } | 195 } |
196 buf->Printf("]"); | 196 buf->Printf("]"); |
197 } | 197 } |
198 | 198 |
199 | 199 |
200 static void FormatTextualValue(dart::TextBuffer* buf, | 200 static void FormatTextualValue(dart::TextBuffer* buf, |
201 Dart_Handle object, | 201 Dart_Handle object, |
202 intptr_t max_chars, | 202 intptr_t max_chars, |
203 bool expand_list) { | 203 bool expand_list) { |
| 204 ASSERT(!Dart_IsError(object)); |
204 if (Dart_IsList(object)) { | 205 if (Dart_IsList(object)) { |
205 if (expand_list) { | 206 if (expand_list) { |
206 FormatTextualListValue(buf, object, max_chars); | 207 FormatTextualListValue(buf, object, max_chars); |
207 } else { | 208 } else { |
208 buf->Printf("[...]"); | 209 buf->Printf("[...]"); |
209 } | 210 } |
210 } else if (Dart_IsNull(object)) { | 211 } else if (Dart_IsNull(object)) { |
211 buf->Printf("null"); | 212 buf->Printf("null"); |
212 } else if (Dart_IsString(object)) { | 213 } else if (Dart_IsString(object)) { |
213 buf->Printf("\\\""); | 214 buf->Printf("\\\""); |
214 FormatEncodedCharsTrunc(buf, object, max_chars); | 215 FormatEncodedCharsTrunc(buf, object, max_chars); |
215 buf->Printf("\\\""); | 216 buf->Printf("\\\""); |
| 217 } else if (Dart_IsNumber(object) || Dart_IsBoolean(object)) { |
| 218 Dart_Handle text = Dart_ToString(object); |
| 219 ASSERT(!Dart_IsNull(text) && !Dart_IsError(text)); |
| 220 FormatEncodedCharsTrunc(buf, text, max_chars); |
216 } else { | 221 } else { |
217 Dart_Handle text = Dart_ToString(object); | 222 Dart_Handle type = Dart_InstanceGetType(object); |
218 if (Dart_IsNull(text)) { | 223 ASSERT_NOT_ERROR(type); |
219 buf->Printf("null"); | 224 type = Dart_ToString(type); |
220 } else if (Dart_IsError(text)) { | 225 ASSERT_NOT_ERROR(type); |
221 buf->Printf("#ERROR"); | 226 buf->Printf("object of type "); |
222 } else { | 227 FormatEncodedCharsTrunc(buf, type, max_chars); |
223 FormatEncodedCharsTrunc(buf, text, max_chars); | |
224 } | |
225 } | 228 } |
226 } | 229 } |
227 | 230 |
228 | 231 |
229 static void FormatValue(dart::TextBuffer* buf, Dart_Handle object) { | 232 static void FormatValue(dart::TextBuffer* buf, Dart_Handle object) { |
230 bool print_text_field = true; | 233 bool print_text_field = true; |
231 if (Dart_IsNumber(object)) { | 234 if (Dart_IsNumber(object)) { |
232 buf->Printf("\"kind\":\"number\""); | 235 buf->Printf("\"kind\":\"number\""); |
233 } else if (Dart_IsString(object)) { | 236 } else if (Dart_IsString(object)) { |
234 buf->Printf("\"kind\":\"string\""); | 237 buf->Printf("\"kind\":\"string\""); |
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 } else { | 1369 } else { |
1367 ASSERT(kind == kShutdown); | 1370 ASSERT(kind == kShutdown); |
1368 RemoveIsolateMsgQueue(isolate_id); | 1371 RemoveIsolateMsgQueue(isolate_id); |
1369 } | 1372 } |
1370 } | 1373 } |
1371 Dart_ExitScope(); | 1374 Dart_ExitScope(); |
1372 } | 1375 } |
1373 | 1376 |
1374 } // namespace bin | 1377 } // namespace bin |
1375 } // namespace dart | 1378 } // namespace dart |
OLD | NEW |