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

Side by Side Diff: runtime/vm/json_stream.cc

Issue 1150303004: Switch to using SourceLocation universally in service protocol. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: post merge Created 5 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/json_stream.h ('k') | runtime/vm/message.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « runtime/vm/json_stream.h ('k') | runtime/vm/message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698