| 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 8526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8537 } | 8537 } |
| 8538 } | 8538 } |
| 8539 return Library::null(); | 8539 return Library::null(); |
| 8540 } | 8540 } |
| 8541 | 8541 |
| 8542 | 8542 |
| 8543 // See also Dart_ScriptGetTokenInfo. | 8543 // See also Dart_ScriptGetTokenInfo. |
| 8544 void Script::PrintJSONImpl(JSONStream* stream, bool ref) const { | 8544 void Script::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 8545 JSONObject jsobj(stream); | 8545 JSONObject jsobj(stream); |
| 8546 AddTypeProperties(&jsobj, "Script", JSONType(), ref); | 8546 AddTypeProperties(&jsobj, "Script", JSONType(), ref); |
| 8547 const String& name = String::Handle(url()); | 8547 const String& uri = String::Handle(url()); |
| 8548 ASSERT(!name.IsNull()); | 8548 ASSERT(!uri.IsNull()); |
| 8549 const String& encoded_url = String::Handle(String::EncodeIRI(name)); | 8549 const String& encoded_uri = String::Handle(String::EncodeIRI(uri)); |
| 8550 ASSERT(!encoded_url.IsNull()); | 8550 ASSERT(!encoded_uri.IsNull()); |
| 8551 const Library& lib = Library::Handle(FindLibrary()); | 8551 const Library& lib = Library::Handle(FindLibrary()); |
| 8552 // TODO(rmacnak): This can fail for eval scripts. Use a ring-id for those. |
| 8552 intptr_t lib_index = (lib.IsNull()) ? -1 : lib.index(); | 8553 intptr_t lib_index = (lib.IsNull()) ? -1 : lib.index(); |
| 8553 jsobj.AddPropertyF("id", "libraries/%" Pd "/scripts/%s", | 8554 jsobj.AddPropertyF("id", "libraries/%" Pd "/scripts/%s", |
| 8554 lib_index, encoded_url.ToCString()); | 8555 lib_index, encoded_uri.ToCString()); |
| 8555 jsobj.AddPropertyStr("name", name); | 8556 jsobj.AddPropertyStr("uri", uri); |
| 8556 jsobj.AddProperty("kind", GetKindAsCString()); | 8557 jsobj.AddProperty("kind", GetKindAsCString()); |
| 8557 if (ref) { | 8558 if (ref) { |
| 8558 return; | 8559 return; |
| 8559 } | 8560 } |
| 8560 jsobj.AddProperty("library", lib); | 8561 jsobj.AddProperty("library", lib); |
| 8561 const String& source = String::Handle(Source()); | 8562 const String& source = String::Handle(Source()); |
| 8562 jsobj.AddProperty("lineOffset", line_offset()); | 8563 jsobj.AddProperty("lineOffset", line_offset()); |
| 8563 jsobj.AddProperty("columnOffset", col_offset()); | 8564 jsobj.AddProperty("columnOffset", col_offset()); |
| 8564 jsobj.AddPropertyStr("source", source); | 8565 jsobj.AddPropertyStr("source", source); |
| 8565 | 8566 |
| (...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9890 | 9891 |
| 9891 void Library::PrintJSONImpl(JSONStream* stream, bool ref) const { | 9892 void Library::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 9892 const char* library_name = String::Handle(name()).ToCString(); | 9893 const char* library_name = String::Handle(name()).ToCString(); |
| 9893 intptr_t id = index(); | 9894 intptr_t id = index(); |
| 9894 ASSERT(id >= 0); | 9895 ASSERT(id >= 0); |
| 9895 JSONObject jsobj(stream); | 9896 JSONObject jsobj(stream); |
| 9896 AddTypeProperties(&jsobj, "Library", JSONType(), ref); | 9897 AddTypeProperties(&jsobj, "Library", JSONType(), ref); |
| 9897 jsobj.AddPropertyF("id", "libraries/%" Pd "", id); | 9898 jsobj.AddPropertyF("id", "libraries/%" Pd "", id); |
| 9898 jsobj.AddProperty("name", library_name); | 9899 jsobj.AddProperty("name", library_name); |
| 9899 const String& library_url = String::Handle(url()); | 9900 const String& library_url = String::Handle(url()); |
| 9900 jsobj.AddPropertyStr("url", library_url); | 9901 jsobj.AddPropertyStr("uri", library_url); |
| 9901 if (ref) { | 9902 if (ref) { |
| 9902 return; | 9903 return; |
| 9903 } | 9904 } |
| 9904 { | 9905 { |
| 9905 JSONArray jsarr(&jsobj, "classes"); | 9906 JSONArray jsarr(&jsobj, "classes"); |
| 9906 ClassDictionaryIterator class_iter(*this); | 9907 ClassDictionaryIterator class_iter(*this); |
| 9907 Class& klass = Class::Handle(); | 9908 Class& klass = Class::Handle(); |
| 9908 while (class_iter.HasNext()) { | 9909 while (class_iter.HasNext()) { |
| 9909 klass = class_iter.GetNextClass(); | 9910 klass = class_iter.GetNextClass(); |
| 9910 if (!klass.IsCanonicalSignatureClass() && | 9911 if (!klass.IsCanonicalSignatureClass() && |
| (...skipping 10890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20801 return tag_label.ToCString(); | 20802 return tag_label.ToCString(); |
| 20802 } | 20803 } |
| 20803 | 20804 |
| 20804 | 20805 |
| 20805 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20806 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20806 Instance::PrintJSONImpl(stream, ref); | 20807 Instance::PrintJSONImpl(stream, ref); |
| 20807 } | 20808 } |
| 20808 | 20809 |
| 20809 | 20810 |
| 20810 } // namespace dart | 20811 } // namespace dart |
| OLD | NEW |