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 "vm/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 10291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10302 info.scope_id, | 10302 info.scope_id, |
10303 info.index, | 10303 info.index, |
10304 info.begin_pos, | 10304 info.begin_pos, |
10305 info.end_pos, | 10305 info.end_pos, |
10306 var_name.ToCString()); | 10306 var_name.ToCString()); |
10307 } | 10307 } |
10308 } | 10308 } |
10309 | 10309 |
10310 | 10310 |
10311 const char* LocalVarDescriptors::ToCString() const { | 10311 const char* LocalVarDescriptors::ToCString() const { |
| 10312 if (IsNull()) { |
| 10313 return "LocalVarDescriptors(NULL)"; |
| 10314 } |
10312 intptr_t len = 1; // Trailing '\0'. | 10315 intptr_t len = 1; // Trailing '\0'. |
10313 String& var_name = String::Handle(); | 10316 String& var_name = String::Handle(); |
10314 for (intptr_t i = 0; i < Length(); i++) { | 10317 for (intptr_t i = 0; i < Length(); i++) { |
10315 RawLocalVarDescriptors::VarInfo info; | 10318 RawLocalVarDescriptors::VarInfo info; |
10316 var_name = GetName(i); | 10319 var_name = GetName(i); |
10317 if (var_name.IsNull()) { | 10320 if (var_name.IsNull()) { |
10318 var_name = Symbols::Empty().raw(); | 10321 var_name = Symbols::Empty().raw(); |
10319 } | 10322 } |
10320 GetInfo(i, &info); | 10323 GetInfo(i, &info); |
10321 len += PrintVarInfo(NULL, 0, i, var_name, info); | 10324 len += PrintVarInfo(NULL, 0, i, var_name, info); |
10322 } | 10325 } |
10323 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len); | 10326 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len + 1); |
| 10327 buffer[0] = '\0'; |
10324 intptr_t num_chars = 0; | 10328 intptr_t num_chars = 0; |
10325 for (intptr_t i = 0; i < Length(); i++) { | 10329 for (intptr_t i = 0; i < Length(); i++) { |
10326 RawLocalVarDescriptors::VarInfo info; | 10330 RawLocalVarDescriptors::VarInfo info; |
10327 var_name = GetName(i); | 10331 var_name = GetName(i); |
10328 if (var_name.IsNull()) { | 10332 if (var_name.IsNull()) { |
10329 var_name = Symbols::Empty().raw(); | 10333 var_name = Symbols::Empty().raw(); |
10330 } | 10334 } |
10331 GetInfo(i, &info); | 10335 GetInfo(i, &info); |
10332 num_chars += PrintVarInfo((buffer + num_chars), | 10336 num_chars += PrintVarInfo((buffer + num_chars), |
10333 (len - num_chars), | 10337 (len - num_chars), |
(...skipping 8386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18720 return tag_label.ToCString(); | 18724 return tag_label.ToCString(); |
18721 } | 18725 } |
18722 | 18726 |
18723 | 18727 |
18724 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 18728 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
18725 Instance::PrintJSONImpl(stream, ref); | 18729 Instance::PrintJSONImpl(stream, ref); |
18726 } | 18730 } |
18727 | 18731 |
18728 | 18732 |
18729 } // namespace dart | 18733 } // namespace dart |
OLD | NEW |