| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 | 6 |
| 7 #include "vm/dart_entry.h" | 7 #include "vm/dart_entry.h" |
| 8 #include "vm/debugger.h" | 8 #include "vm/debugger.h" |
| 9 #include "vm/json_stream.h" | 9 #include "vm/json_stream.h" |
| 10 #include "vm/message.h" | 10 #include "vm/message.h" |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); | 570 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); |
| 571 va_end(args); | 571 va_end(args); |
| 572 ASSERT(len == len2); | 572 ASSERT(len == len2); |
| 573 stream_->buffer_.AddChar('"'); | 573 stream_->buffer_.AddChar('"'); |
| 574 stream_->AddEscapedUTF8String(p); | 574 stream_->AddEscapedUTF8String(p); |
| 575 stream_->buffer_.AddChar('"'); | 575 stream_->buffer_.AddChar('"'); |
| 576 free(p); | 576 free(p); |
| 577 } | 577 } |
| 578 | 578 |
| 579 | 579 |
| 580 void JSONObject::AddLocation(const Script& script, |
| 581 intptr_t token_pos, |
| 582 intptr_t end_token_pos) { |
| 583 JSONObject location(this, "location"); |
| 584 location.AddProperty("type", "SourceLocation"); |
| 585 location.AddProperty("script", script); |
| 586 location.AddProperty("tokenPos", token_pos); |
| 587 if (end_token_pos >= 0) { |
| 588 location.AddProperty("endTokenPos", end_token_pos); |
| 589 } |
| 590 } |
| 591 |
| 592 |
| 593 |
| 580 void JSONObject::AddPropertyF(const char* name, | 594 void JSONObject::AddPropertyF(const char* name, |
| 581 const char* format, ...) const { | 595 const char* format, ...) const { |
| 582 stream_->PrintPropertyName(name); | 596 stream_->PrintPropertyName(name); |
| 583 va_list args; | 597 va_list args; |
| 584 va_start(args, format); | 598 va_start(args, format); |
| 585 intptr_t len = OS::VSNPrint(NULL, 0, format, args); | 599 intptr_t len = OS::VSNPrint(NULL, 0, format, args); |
| 586 va_end(args); | 600 va_end(args); |
| 587 char* p = reinterpret_cast<char*>(malloc(len+1)); | 601 char* p = reinterpret_cast<char*>(malloc(len+1)); |
| 588 va_start(args, format); | 602 va_start(args, format); |
| 589 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); | 603 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 607 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); | 621 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); |
| 608 va_end(args); | 622 va_end(args); |
| 609 ASSERT(len == len2); | 623 ASSERT(len == len2); |
| 610 stream_->buffer_.AddChar('"'); | 624 stream_->buffer_.AddChar('"'); |
| 611 stream_->AddEscapedUTF8String(p); | 625 stream_->AddEscapedUTF8String(p); |
| 612 stream_->buffer_.AddChar('"'); | 626 stream_->buffer_.AddChar('"'); |
| 613 free(p); | 627 free(p); |
| 614 } | 628 } |
| 615 | 629 |
| 616 } // namespace dart | 630 } // namespace dart |
| OLD | NEW |