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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 if (location != NULL) { | 301 if (location != NULL) { |
302 location->script_url = Api::NewHandle(isolate, frame->SourceUrl()); | 302 location->script_url = Api::NewHandle(isolate, frame->SourceUrl()); |
303 const Library& lib = Library::Handle(frame->Library()); | 303 const Library& lib = Library::Handle(frame->Library()); |
304 location->library_id = lib.index(); | 304 location->library_id = lib.index(); |
305 location->token_pos = frame->TokenPos(); | 305 location->token_pos = frame->TokenPos(); |
306 } | 306 } |
307 return Api::Success(); | 307 return Api::Success(); |
308 } | 308 } |
309 | 309 |
310 | 310 |
| 311 DART_EXPORT Dart_Handle Dart_GetFunctionOrigin(Dart_Handle function_in) { |
| 312 Isolate* isolate = Isolate::Current(); |
| 313 DARTSCOPE(isolate); |
| 314 UNWRAP_AND_CHECK_PARAM(Function, function, function_in); |
| 315 |
| 316 Dart_Handle state = Api::CheckIsolateState(isolate); |
| 317 if (::Dart_IsError(state)) { |
| 318 return state; |
| 319 } |
| 320 |
| 321 const Class& cls = Class::Handle(function.origin()); |
| 322 if (!cls.IsTopLevel()) { |
| 323 return Dart_NewInteger(cls.id()); |
| 324 } |
| 325 return Api::Null(); |
| 326 } |
| 327 |
| 328 |
311 DART_EXPORT Dart_Handle Dart_GetLocalVariables( | 329 DART_EXPORT Dart_Handle Dart_GetLocalVariables( |
312 Dart_ActivationFrame activation_frame) { | 330 Dart_ActivationFrame activation_frame) { |
313 Isolate* isolate = Isolate::Current(); | 331 Isolate* isolate = Isolate::Current(); |
314 DARTSCOPE(isolate); | 332 DARTSCOPE(isolate); |
315 CHECK_AND_CAST(ActivationFrame, frame, activation_frame); | 333 CHECK_AND_CAST(ActivationFrame, frame, activation_frame); |
316 return Api::NewHandle(isolate, frame->GetLocalVariables()); | 334 return Api::NewHandle(isolate, frame->GetLocalVariables()); |
317 } | 335 } |
318 | 336 |
319 | 337 |
320 DART_EXPORT Dart_Handle Dart_SetBreakpoint( | 338 DART_EXPORT Dart_Handle Dart_SetBreakpoint( |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 return Api::CastIsolate(isolate); | 957 return Api::CastIsolate(isolate); |
940 } | 958 } |
941 | 959 |
942 | 960 |
943 DART_EXPORT Dart_IsolateId Dart_GetIsolateId(Dart_Isolate dart_isolate) { | 961 DART_EXPORT Dart_IsolateId Dart_GetIsolateId(Dart_Isolate dart_isolate) { |
944 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate); | 962 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate); |
945 return isolate->debugger()->GetIsolateId(); | 963 return isolate->debugger()->GetIsolateId(); |
946 } | 964 } |
947 | 965 |
948 } // namespace dart | 966 } // namespace dart |
OLD | NEW |