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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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( | 602 DART_EXPORT Dart_Handle Dart_GetClosureInfo( |
603 Dart_Handle closure, | 603 Dart_Handle closure, |
604 Dart_Handle* name, | 604 Dart_Handle* name, |
| 605 Dart_Handle* signature, |
605 Dart_CodeLocation* location) { | 606 Dart_CodeLocation* location) { |
606 Isolate* isolate = Isolate::Current(); | 607 Isolate* isolate = Isolate::Current(); |
607 DARTSCOPE(isolate); | 608 DARTSCOPE(isolate); |
608 UNWRAP_AND_CHECK_PARAM(Instance, instance, closure); | 609 UNWRAP_AND_CHECK_PARAM(Instance, instance, closure); |
609 CHECK_NOT_NULL(location); | 610 CHECK_NOT_NULL(location); |
610 | 611 |
611 if (!instance.IsClosure()) { | 612 if (!instance.IsClosure()) { |
612 return Api::NewError("%s: parameter 0 is not a closure", CURRENT_FUNC); | 613 return Api::NewError("%s: parameter 0 is not a closure", CURRENT_FUNC); |
613 } | 614 } |
614 const Function& func = Function::Handle(Closure::function(instance)); | 615 const Function& func = Function::Handle(Closure::function(instance)); |
615 ASSERT(!func.IsNull()); | 616 ASSERT(!func.IsNull()); |
616 if (name != NULL) { | 617 if (name != NULL) { |
617 *name = Api::NewHandle(isolate, func.QualifiedUserVisibleName()); | 618 *name = Api::NewHandle(isolate, func.QualifiedUserVisibleName()); |
618 } | 619 } |
| 620 if (signature != NULL) { |
| 621 *signature = Api::NewHandle(isolate, func.UserVisibleSignature()); |
| 622 } |
| 623 |
619 if (location != NULL) { | 624 if (location != NULL) { |
620 if (func.token_pos() >= 0) { | 625 if (func.token_pos() >= 0) { |
621 const Class& cls = Class::Handle(func.origin()); | 626 const Class& cls = Class::Handle(func.origin()); |
622 ASSERT(!cls.IsNull()); | 627 ASSERT(!cls.IsNull()); |
623 const Library& lib = Library::Handle(isolate, cls.library()); | 628 const Library& lib = Library::Handle(isolate, cls.library()); |
624 ASSERT(!lib.IsNull()); | 629 ASSERT(!lib.IsNull()); |
625 const Script& script = Script::Handle(cls.script()); | 630 const Script& script = Script::Handle(cls.script()); |
626 ASSERT(!script.IsNull()); | 631 ASSERT(!script.IsNull()); |
627 location->script_url = Api::NewHandle(isolate, script.url()); | 632 location->script_url = Api::NewHandle(isolate, script.url()); |
628 location->library_id = lib.index(); | 633 location->library_id = lib.index(); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 | 945 |
941 | 946 |
942 DART_EXPORT char* Dart_GetVmStatus(const char* request) { | 947 DART_EXPORT char* Dart_GetVmStatus(const char* request) { |
943 if (strncmp(request, "/isolate/", 9) == 0) { | 948 if (strncmp(request, "/isolate/", 9) == 0) { |
944 return Isolate::GetStatus(request); | 949 return Isolate::GetStatus(request); |
945 } | 950 } |
946 return NULL; | 951 return NULL; |
947 } | 952 } |
948 | 953 |
949 } // namespace dart | 954 } // namespace dart |
OLD | NEW |