| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "lib/stacktrace.h" | 10 #include "lib/stacktrace.h" |
| (...skipping 5317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5328 DART_EXPORT Dart_Handle Dart_RootLibrary() { | 5328 DART_EXPORT Dart_Handle Dart_RootLibrary() { |
| 5329 Thread* thread = Thread::Current(); | 5329 Thread* thread = Thread::Current(); |
| 5330 Isolate* isolate = thread->isolate(); | 5330 Isolate* isolate = thread->isolate(); |
| 5331 CHECK_ISOLATE(isolate); | 5331 CHECK_ISOLATE(isolate); |
| 5332 return Api::NewHandle(thread, isolate->object_store()->root_library()); | 5332 return Api::NewHandle(thread, isolate->object_store()->root_library()); |
| 5333 } | 5333 } |
| 5334 | 5334 |
| 5335 | 5335 |
| 5336 DART_EXPORT Dart_Handle Dart_SetRootLibrary(Dart_Handle library) { | 5336 DART_EXPORT Dart_Handle Dart_SetRootLibrary(Dart_Handle library) { |
| 5337 DARTSCOPE(Thread::Current()); | 5337 DARTSCOPE(Thread::Current()); |
| 5338 const Library& lib = Api::UnwrapLibraryHandle(Z, library); | 5338 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(library)); |
| 5339 if (lib.IsNull()) { | 5339 if (obj.IsNull() || obj.IsLibrary()) { |
| 5340 RETURN_TYPE_ERROR(Z, library, Library); | 5340 Library& lib = Library::Handle(Z); |
| 5341 lib ^= obj.raw(); |
| 5342 T->isolate()->object_store()->set_root_library(lib); |
| 5343 return library; |
| 5341 } | 5344 } |
| 5342 Isolate* isolate = Isolate::Current(); | 5345 RETURN_TYPE_ERROR(Z, library, Library); |
| 5343 isolate->object_store()->set_root_library(lib); | |
| 5344 return library; | |
| 5345 } | 5346 } |
| 5346 | 5347 |
| 5347 | 5348 |
| 5348 DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library, | 5349 DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library, |
| 5349 Dart_Handle class_name) { | 5350 Dart_Handle class_name) { |
| 5350 DARTSCOPE(Thread::Current()); | 5351 DARTSCOPE(Thread::Current()); |
| 5351 const Library& lib = Api::UnwrapLibraryHandle(Z, library); | 5352 const Library& lib = Api::UnwrapLibraryHandle(Z, library); |
| 5352 if (lib.IsNull()) { | 5353 if (lib.IsNull()) { |
| 5353 RETURN_TYPE_ERROR(Z, library, Library); | 5354 RETURN_TYPE_ERROR(Z, library, Library); |
| 5354 } | 5355 } |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6439 | 6440 |
| 6440 DART_EXPORT bool Dart_IsPrecompiledRuntime() { | 6441 DART_EXPORT bool Dart_IsPrecompiledRuntime() { |
| 6441 #if defined(DART_PRECOMPILED_RUNTIME) | 6442 #if defined(DART_PRECOMPILED_RUNTIME) |
| 6442 return true; | 6443 return true; |
| 6443 #else | 6444 #else |
| 6444 return false; | 6445 return false; |
| 6445 #endif | 6446 #endif |
| 6446 } | 6447 } |
| 6447 | 6448 |
| 6448 } // namespace dart | 6449 } // namespace dart |
| OLD | NEW |