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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 | 592 |
593 // Construct the super type object, canonicalize it and return. | 593 // Construct the super type object, canonicalize it and return. |
594 Type& instantiated_type = Type::Handle( | 594 Type& instantiated_type = Type::Handle( |
595 Type::New(super_cls, super_type_args_array, Scanner::kDummyTokenIndex)); | 595 Type::New(super_cls, super_type_args_array, Scanner::kDummyTokenIndex)); |
596 ASSERT(!instantiated_type.IsNull()); | 596 ASSERT(!instantiated_type.IsNull()); |
597 instantiated_type.SetIsFinalized(); | 597 instantiated_type.SetIsFinalized(); |
598 return Api::NewHandle(isolate, instantiated_type.Canonicalize()); | 598 return Api::NewHandle(isolate, instantiated_type.Canonicalize()); |
599 } | 599 } |
600 | 600 |
601 | 601 |
| 602 DART_EXPORT Dart_Handle Dart_GetClosureInfo( |
| 603 Dart_Handle closure, |
| 604 Dart_Handle* name, |
| 605 Dart_CodeLocation* location) { |
| 606 Isolate* isolate = Isolate::Current(); |
| 607 DARTSCOPE(isolate); |
| 608 UNWRAP_AND_CHECK_PARAM(Instance, instance, closure); |
| 609 CHECK_NOT_NULL(location); |
| 610 |
| 611 if (!instance.IsClosure()) { |
| 612 return Api::NewError("%s: parameter 0 is not a closure", CURRENT_FUNC); |
| 613 } |
| 614 const Function& func = Function::Handle(Closure::function(instance)); |
| 615 ASSERT(!func.IsNull()); |
| 616 if (name != NULL) { |
| 617 *name = Api::NewHandle(isolate, func.QualifiedUserVisibleName()); |
| 618 } |
| 619 if (location != NULL) { |
| 620 if (func.token_pos() >= 0) { |
| 621 const Class& cls = Class::Handle(func.origin()); |
| 622 ASSERT(!cls.IsNull()); |
| 623 const Library& lib = Library::Handle(isolate, cls.library()); |
| 624 ASSERT(!lib.IsNull()); |
| 625 const Script& script = Script::Handle(cls.script()); |
| 626 ASSERT(!script.IsNull()); |
| 627 location->script_url = Api::NewHandle(isolate, script.url()); |
| 628 location->library_id = lib.index(); |
| 629 location->token_pos = func.token_pos(); |
| 630 } else { |
| 631 location->script_url = Api::NewHandle(isolate, String::null()); |
| 632 location->library_id = -1; |
| 633 location->token_pos = -1; |
| 634 } |
| 635 } |
| 636 return Api::True(); |
| 637 } |
| 638 |
| 639 |
602 DART_EXPORT Dart_Handle Dart_GetClassInfo( | 640 DART_EXPORT Dart_Handle Dart_GetClassInfo( |
603 intptr_t cls_id, | 641 intptr_t cls_id, |
604 Dart_Handle* class_name, | 642 Dart_Handle* class_name, |
605 intptr_t* library_id, | 643 intptr_t* library_id, |
606 intptr_t* super_class_id, | 644 intptr_t* super_class_id, |
607 Dart_Handle* static_fields) { | 645 Dart_Handle* static_fields) { |
608 Isolate* isolate = Isolate::Current(); | 646 Isolate* isolate = Isolate::Current(); |
609 DARTSCOPE(isolate); | 647 DARTSCOPE(isolate); |
610 if (!isolate->class_table()->IsValidIndex(cls_id)) { | 648 if (!isolate->class_table()->IsValidIndex(cls_id)) { |
611 return Api::NewError("%s: %" Pd " is not a valid class id", | 649 return Api::NewError("%s: %" Pd " is not a valid class id", |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 | 940 |
903 | 941 |
904 DART_EXPORT char* Dart_GetVmStatus(const char* request) { | 942 DART_EXPORT char* Dart_GetVmStatus(const char* request) { |
905 if (strncmp(request, "/isolate/", 9) == 0) { | 943 if (strncmp(request, "/isolate/", 9) == 0) { |
906 return Isolate::GetStatus(request); | 944 return Isolate::GetStatus(request); |
907 } | 945 } |
908 return NULL; | 946 return NULL; |
909 } | 947 } |
910 | 948 |
911 } // namespace dart | 949 } // namespace dart |
OLD | NEW |