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 "include/dart_debugger_api.h" | 5 #include "include/dart_debugger_api.h" |
6 | 6 |
7 #include "vm/dart_api_impl.h" | 7 #include "vm/dart_api_impl.h" |
8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
9 #include "vm/debugger.h" | 9 #include "vm/debugger.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 CURRENT_FUNC, library_id); | 600 CURRENT_FUNC, library_id); |
601 } | 601 } |
602 const GrowableObjectArray& import_list = | 602 const GrowableObjectArray& import_list = |
603 GrowableObjectArray::Handle(GrowableObjectArray::New(8)); | 603 GrowableObjectArray::Handle(GrowableObjectArray::New(8)); |
604 | 604 |
605 String& prefix_name = String::Handle(isolate); | 605 String& prefix_name = String::Handle(isolate); |
606 Library& imported = Library::Handle(isolate); | 606 Library& imported = Library::Handle(isolate); |
607 intptr_t num_imports = lib.num_imports(); | 607 intptr_t num_imports = lib.num_imports(); |
608 for (int i = 0; i < num_imports; i++) { | 608 for (int i = 0; i < num_imports; i++) { |
609 import_list.Add(prefix_name); // Null prefix name means no prefix. | 609 import_list.Add(prefix_name); // Null prefix name means no prefix. |
610 imported = lib.ImportAt(i); | 610 imported = lib.ImportLibraryAt(i); |
611 ASSERT(!imported.IsNull()); | 611 ASSERT(!imported.IsNull()); |
612 ASSERT(Smi::IsValid(imported.index())); | 612 ASSERT(Smi::IsValid(imported.index())); |
613 import_list.Add(Smi::Handle(Smi::New(imported.index()))); | 613 import_list.Add(Smi::Handle(Smi::New(imported.index()))); |
614 } | 614 } |
615 LibraryPrefixIterator it(lib); | 615 LibraryPrefixIterator it(lib); |
616 LibraryPrefix& prefix = LibraryPrefix::Handle(isolate); | 616 LibraryPrefix& prefix = LibraryPrefix::Handle(isolate); |
617 while (it.HasNext()) { | 617 while (it.HasNext()) { |
618 prefix = it.GetNext(); | 618 prefix = it.GetNext(); |
619 prefix_name = prefix.name(); | 619 prefix_name = prefix.name(); |
620 ASSERT(!prefix_name.IsNull()); | 620 ASSERT(!prefix_name.IsNull()); |
621 prefix_name = String::Concat(prefix_name, | 621 prefix_name = String::Concat(prefix_name, |
622 String::Handle(isolate, Symbols::Dot())); | 622 String::Handle(isolate, Symbols::Dot())); |
623 for (int i = 0; i < prefix.num_libs(); i++) { | 623 for (int i = 0; i < prefix.num_imports(); i++) { |
624 imported = prefix.GetLibrary(i); | 624 imported = prefix.GetLibrary(i); |
625 import_list.Add(prefix_name); | 625 import_list.Add(prefix_name); |
626 import_list.Add(Smi::Handle(Smi::New(imported.index()))); | 626 import_list.Add(Smi::Handle(Smi::New(imported.index()))); |
627 } | 627 } |
628 } | 628 } |
629 return Api::NewHandle(isolate, Array::MakeArray(import_list)); | 629 return Api::NewHandle(isolate, Array::MakeArray(import_list)); |
630 } | 630 } |
631 | 631 |
632 | 632 |
633 DART_EXPORT Dart_Handle Dart_GetLibraryURL(intptr_t library_id) { | 633 DART_EXPORT Dart_Handle Dart_GetLibraryURL(intptr_t library_id) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 if (lib.IsNull()) { | 691 if (lib.IsNull()) { |
692 return Api::NewError("%s: %"Pd" is not a valid library id", | 692 return Api::NewError("%s: %"Pd" is not a valid library id", |
693 CURRENT_FUNC, library_id); | 693 CURRENT_FUNC, library_id); |
694 } | 694 } |
695 lib.set_debuggable(is_debuggable); | 695 lib.set_debuggable(is_debuggable); |
696 return Api::True(isolate); | 696 return Api::True(isolate); |
697 } | 697 } |
698 | 698 |
699 | 699 |
700 } // namespace dart | 700 } // namespace dart |
OLD | NEW |