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

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

Issue 59283007: List scripts in library and display script source (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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 7025 matching lines...) Expand 10 before | Expand all | Expand 10 after
7036 } 7036 }
7037 7037
7038 7038
7039 const char* Script::ToCString() const { 7039 const char* Script::ToCString() const {
7040 return "Script"; 7040 return "Script";
7041 } 7041 }
7042 7042
7043 7043
7044 void Script::PrintToJSONStream(JSONStream* stream, bool ref) const { 7044 void Script::PrintToJSONStream(JSONStream* stream, bool ref) const {
7045 JSONObject jsobj(stream); 7045 JSONObject jsobj(stream);
7046 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
7047 intptr_t id = ring->GetIdForObject(raw());
7048 jsobj.AddProperty("type", JSONType(ref));
7049 jsobj.AddProperty("id", id);
7050 const String& name = String::Handle(url());
7051 jsobj.AddProperty("name", name.ToCString());
7052 if (ref) {
7053 return;
7054 }
7055 const String& source = String::Handle(Source());
7056 jsobj.AddProperty("source", source.ToCString());
7046 } 7057 }
7047 7058
7048 7059
7049 DictionaryIterator::DictionaryIterator(const Library& library) 7060 DictionaryIterator::DictionaryIterator(const Library& library)
7050 : array_(Array::Handle(library.dictionary())), 7061 : array_(Array::Handle(library.dictionary())),
7051 // Last element in array is a Smi indicating the number of entries used. 7062 // Last element in array is a Smi indicating the number of entries used.
7052 size_(Array::Handle(library.dictionary()).Length() - 1), 7063 size_(Array::Handle(library.dictionary()).Length() - 1),
7053 next_ix_(0) { 7064 next_ix_(0) {
7054 MoveToNextObject(); 7065 MoveToNextObject();
7055 } 7066 }
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
8123 } 8134 }
8124 } 8135 }
8125 { 8136 {
8126 JSONArray jsarr(&jsobj, "libraries"); 8137 JSONArray jsarr(&jsobj, "libraries");
8127 Library& lib = Library::Handle(); 8138 Library& lib = Library::Handle();
8128 for (intptr_t i = 0; i < num_imports(); i++) { 8139 for (intptr_t i = 0; i < num_imports(); i++) {
8129 lib = ImportLibraryAt(i); 8140 lib = ImportLibraryAt(i);
8130 jsarr.AddValue(lib); 8141 jsarr.AddValue(lib);
8131 } 8142 }
8132 } 8143 }
8144 {
8145 JSONArray jsarr(&jsobj, "scripts");
8146 Array& scripts = Array::Handle(LoadedScripts());
8147 Script& script = Script::Handle();
8148 for (intptr_t i = 0; i < scripts.Length(); i++) {
8149 script ^= scripts.At(i);
8150 jsarr.AddValue(script);
8151 }
8152 }
8133 } 8153 }
8134 8154
8135 8155
8136 RawLibrary* LibraryPrefix::GetLibrary(int index) const { 8156 RawLibrary* LibraryPrefix::GetLibrary(int index) const {
8137 if ((index >= 0) || (index < num_imports())) { 8157 if ((index >= 0) || (index < num_imports())) {
8138 const Array& imports = Array::Handle(this->imports()); 8158 const Array& imports = Array::Handle(this->imports());
8139 Namespace& import = Namespace::Handle(); 8159 Namespace& import = Namespace::Handle();
8140 import ^= imports.At(index); 8160 import ^= imports.At(index);
8141 return import.library(); 8161 return import.library();
8142 } 8162 }
(...skipping 7601 matching lines...) Expand 10 before | Expand all | Expand 10 after
15744 return "_MirrorReference"; 15764 return "_MirrorReference";
15745 } 15765 }
15746 15766
15747 15767
15748 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 15768 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
15749 JSONObject jsobj(stream); 15769 JSONObject jsobj(stream);
15750 } 15770 }
15751 15771
15752 15772
15753 } // namespace dart 15773 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698