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/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/dart_api_state.h" | 10 #include "vm/dart_api_state.h" |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 if (target.IsError()) return target_in; | 507 if (target.IsError()) return target_in; |
508 if (target.IsNull()) { | 508 if (target.IsNull()) { |
509 return Api::NewError("%s expects argument 'target' to be non-null", | 509 return Api::NewError("%s expects argument 'target' to be non-null", |
510 CURRENT_FUNC); | 510 CURRENT_FUNC); |
511 } | 511 } |
512 UNWRAP_AND_CHECK_PARAM(String, expr, expr_in); | 512 UNWRAP_AND_CHECK_PARAM(String, expr, expr_in); |
513 if (target.IsInstance()) { | 513 if (target.IsInstance()) { |
514 return Api::NewHandle(isolate, Instance::Cast(target).Evaluate(expr)); | 514 return Api::NewHandle(isolate, Instance::Cast(target).Evaluate(expr)); |
515 } else if (target.IsClass()) { | 515 } else if (target.IsClass()) { |
516 return Api::NewHandle(isolate, Class::Cast(target).Evaluate(expr)); | 516 return Api::NewHandle(isolate, Class::Cast(target).Evaluate(expr)); |
| 517 } else if (target.IsLibrary()) { |
| 518 return Api::NewHandle(isolate, Library::Cast(target).Evaluate(expr)); |
517 } | 519 } |
518 return Api::NewError("%s: unsupported target type", CURRENT_FUNC); | 520 return Api::NewError("%s: unsupported target type", CURRENT_FUNC); |
519 } | 521 } |
520 | 522 |
521 | 523 |
522 DART_EXPORT Dart_Handle Dart_GetObjClass(Dart_Handle object_in) { | 524 DART_EXPORT Dart_Handle Dart_GetObjClass(Dart_Handle object_in) { |
523 Isolate* isolate = Isolate::Current(); | 525 Isolate* isolate = Isolate::Current(); |
524 DARTSCOPE(isolate); | 526 DARTSCOPE(isolate); |
525 UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in); | 527 UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in); |
526 return Api::NewHandle(isolate, obj.clazz()); | 528 return Api::NewHandle(isolate, obj.clazz()); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 for (int i = 0; i < num_libs; i++) { | 777 for (int i = 0; i < num_libs; i++) { |
776 lib ^= libs.At(i); | 778 lib ^= libs.At(i); |
777 ASSERT(!lib.IsNull()); | 779 ASSERT(!lib.IsNull()); |
778 ASSERT(Smi::IsValid(lib.index())); | 780 ASSERT(Smi::IsValid(lib.index())); |
779 library_id_list.SetAt(i, Smi::Handle(Smi::New(lib.index()))); | 781 library_id_list.SetAt(i, Smi::Handle(Smi::New(lib.index()))); |
780 } | 782 } |
781 return Api::NewHandle(isolate, library_id_list.raw()); | 783 return Api::NewHandle(isolate, library_id_list.raw()); |
782 } | 784 } |
783 | 785 |
784 | 786 |
| 787 DART_EXPORT Dart_Handle Dart_GetLibraryFromId(intptr_t library_id) { |
| 788 Isolate* isolate = Isolate::Current(); |
| 789 ASSERT(isolate != NULL); |
| 790 DARTSCOPE(isolate); |
| 791 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); |
| 792 if (lib.IsNull()) { |
| 793 return Api::NewError("%s: %" Pd " is not a valid library id", |
| 794 CURRENT_FUNC, library_id); |
| 795 } |
| 796 return Api::NewHandle(isolate, lib.raw()); |
| 797 } |
| 798 |
| 799 |
785 DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) { | 800 DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) { |
786 Isolate* isolate = Isolate::Current(); | 801 Isolate* isolate = Isolate::Current(); |
787 ASSERT(isolate != NULL); | 802 ASSERT(isolate != NULL); |
788 DARTSCOPE(isolate); | 803 DARTSCOPE(isolate); |
789 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); | 804 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); |
790 if (lib.IsNull()) { | 805 if (lib.IsNull()) { |
791 return Api::NewError("%s: %" Pd " is not a valid library id", | 806 return Api::NewError("%s: %" Pd " is not a valid library id", |
792 CURRENT_FUNC, library_id); | 807 CURRENT_FUNC, library_id); |
793 } | 808 } |
794 const GrowableObjectArray& import_list = | 809 const GrowableObjectArray& import_list = |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 | 887 |
873 | 888 |
874 DART_EXPORT char* Dart_GetVmStatus(const char* request) { | 889 DART_EXPORT char* Dart_GetVmStatus(const char* request) { |
875 if (strncmp(request, "/isolate/", 9) == 0) { | 890 if (strncmp(request, "/isolate/", 9) == 0) { |
876 return Isolate::GetStatus(request); | 891 return Isolate::GetStatus(request); |
877 } | 892 } |
878 return NULL; | 893 return NULL; |
879 } | 894 } |
880 | 895 |
881 } // namespace dart | 896 } // namespace dart |
OLD | NEW |