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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 DARTSCOPE(isolate); | 535 DARTSCOPE(isolate); |
536 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); | 536 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); |
537 if (lib.IsNull()) { | 537 if (lib.IsNull()) { |
538 return Api::NewError("%s: %" Pd " is not a valid library id", | 538 return Api::NewError("%s: %" Pd " is not a valid library id", |
539 CURRENT_FUNC, library_id); | 539 CURRENT_FUNC, library_id); |
540 } | 540 } |
541 return Api::NewHandle(isolate, isolate->debugger()->GetGlobalFields(lib)); | 541 return Api::NewHandle(isolate, isolate->debugger()->GetGlobalFields(lib)); |
542 } | 542 } |
543 | 543 |
544 | 544 |
| 545 DART_EXPORT Dart_Handle Dart_ActivationFrameEvaluate( |
| 546 Dart_ActivationFrame activation_frame, |
| 547 Dart_Handle expr_in) { |
| 548 Isolate* isolate = Isolate::Current(); |
| 549 DARTSCOPE(isolate); |
| 550 CHECK_AND_CAST(ActivationFrame, frame, activation_frame); |
| 551 UNWRAP_AND_CHECK_PARAM(String, expr, expr_in); |
| 552 return Api::NewHandle(isolate, frame->Evaluate(expr)); |
| 553 } |
| 554 |
| 555 |
545 DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target_in, | 556 DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target_in, |
546 Dart_Handle expr_in) { | 557 Dart_Handle expr_in) { |
547 Isolate* isolate = Isolate::Current(); | 558 Isolate* isolate = Isolate::Current(); |
548 DARTSCOPE(isolate); | 559 DARTSCOPE(isolate); |
549 | 560 |
550 const Object& target = Object::Handle(isolate, Api::UnwrapHandle(target_in)); | 561 const Object& target = Object::Handle(isolate, Api::UnwrapHandle(target_in)); |
551 if (target.IsError()) return target_in; | 562 if (target.IsError()) return target_in; |
552 if (target.IsNull()) { | 563 if (target.IsNull()) { |
553 return Api::NewError("%s expects argument 'target' to be non-null", | 564 return Api::NewError("%s expects argument 'target' to be non-null", |
554 CURRENT_FUNC); | 565 CURRENT_FUNC); |
555 } | 566 } |
556 UNWRAP_AND_CHECK_PARAM(String, expr, expr_in); | 567 UNWRAP_AND_CHECK_PARAM(String, expr, expr_in); |
557 // Type extends Instance, must check first. | 568 // Type extends Instance, must check first. |
558 if (target.IsType()) { | 569 if (target.IsType()) { |
559 const Class& cls = Class::Handle(isolate, Type::Cast(target).type_class()); | 570 const Class& cls = Class::Handle(isolate, Type::Cast(target).type_class()); |
560 return Api::NewHandle(isolate, cls.Evaluate(expr)); | 571 return Api::NewHandle(isolate, cls.Evaluate(expr, |
| 572 Array::empty_array(), |
| 573 Array::empty_array())); |
561 } else if (target.IsInstance()) { | 574 } else if (target.IsInstance()) { |
562 return Api::NewHandle(isolate, Instance::Cast(target).Evaluate(expr)); | 575 const Instance& inst = Instance::Cast(target); |
| 576 return Api::NewHandle(isolate, inst.Evaluate(expr, |
| 577 Array::empty_array(), |
| 578 Array::empty_array())); |
563 } else if (target.IsLibrary()) { | 579 } else if (target.IsLibrary()) { |
564 return Api::NewHandle(isolate, Library::Cast(target).Evaluate(expr)); | 580 const Library& lib = Library::Cast(target); |
| 581 return Api::NewHandle(isolate, lib.Evaluate(expr, |
| 582 Array::empty_array(), |
| 583 Array::empty_array())); |
565 } else if (target.IsClass()) { | 584 } else if (target.IsClass()) { |
566 return Api::NewHandle(isolate, Class::Cast(target).Evaluate(expr)); | 585 const Class& cls = Class::Cast(target); |
| 586 return Api::NewHandle(isolate, cls.Evaluate(expr, |
| 587 Array::empty_array(), |
| 588 Array::empty_array())); |
567 } | 589 } |
568 return Api::NewError("%s: unsupported target type", CURRENT_FUNC); | 590 return Api::NewError("%s: unsupported target type", CURRENT_FUNC); |
569 } | 591 } |
570 | 592 |
571 | 593 |
572 DART_EXPORT Dart_Handle Dart_GetObjClass(Dart_Handle object_in) { | 594 DART_EXPORT Dart_Handle Dart_GetObjClass(Dart_Handle object_in) { |
573 Isolate* isolate = Isolate::Current(); | 595 Isolate* isolate = Isolate::Current(); |
574 DARTSCOPE(isolate); | 596 DARTSCOPE(isolate); |
575 UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in); | 597 UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in); |
576 return Api::NewHandle(isolate, obj.GetType()); | 598 return Api::NewHandle(isolate, obj.GetType()); |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 return Api::CastIsolate(isolate); | 979 return Api::CastIsolate(isolate); |
958 } | 980 } |
959 | 981 |
960 | 982 |
961 DART_EXPORT Dart_IsolateId Dart_GetIsolateId(Dart_Isolate dart_isolate) { | 983 DART_EXPORT Dart_IsolateId Dart_GetIsolateId(Dart_Isolate dart_isolate) { |
962 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate); | 984 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate); |
963 return isolate->debugger()->GetIsolateId(); | 985 return isolate->debugger()->GetIsolateId(); |
964 } | 986 } |
965 | 987 |
966 } // namespace dart | 988 } // namespace dart |
OLD | NEW |