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_mirrors_api.h" | 5 #include "include/dart_mirrors_api.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
9 #include "vm/dart.h" | 9 #include "vm/dart.h" |
10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 DARTSCOPE(isolate); | 316 DARTSCOPE(isolate); |
317 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); | 317 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); |
318 if (lib.IsNull()) { | 318 if (lib.IsNull()) { |
319 RETURN_TYPE_ERROR(isolate, library, Library); | 319 RETURN_TYPE_ERROR(isolate, library, Library); |
320 } | 320 } |
321 const String& name = String::Handle(isolate, lib.name()); | 321 const String& name = String::Handle(isolate, lib.name()); |
322 ASSERT(!name.IsNull()); | 322 ASSERT(!name.IsNull()); |
323 return Api::NewHandle(isolate, name.raw()); | 323 return Api::NewHandle(isolate, name.raw()); |
324 } | 324 } |
325 | 325 |
326 DART_EXPORT Dart_Handle Dart_LibraryId(Dart_Handle library, | |
327 intptr_t* library_id) { | |
328 Isolate* isolate = Isolate::Current(); | |
329 DARTSCOPE(isolate); | |
330 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); | |
331 if (lib.IsNull()) { | |
332 RETURN_TYPE_ERROR(isolate, library, Library); | |
333 } | |
334 if (library_id != NULL) { | |
335 *library_id = lib.index(); | |
336 } | |
337 return Api::Success(); | |
338 } | |
339 | |
340 DART_EXPORT Dart_Handle Dart_LibraryGetClassNames(Dart_Handle library) { | 326 DART_EXPORT Dart_Handle Dart_LibraryGetClassNames(Dart_Handle library) { |
341 Isolate* isolate = Isolate::Current(); | 327 Isolate* isolate = Isolate::Current(); |
342 DARTSCOPE(isolate); | 328 DARTSCOPE(isolate); |
343 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); | 329 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); |
344 if (lib.IsNull()) { | 330 if (lib.IsNull()) { |
345 RETURN_TYPE_ERROR(isolate, library, Library); | 331 RETURN_TYPE_ERROR(isolate, library, Library); |
346 } | 332 } |
347 | 333 |
348 const GrowableObjectArray& names = | 334 const GrowableObjectArray& names = |
349 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New()); | 335 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New()); |
(...skipping 29 matching lines...) Expand all Loading... |
379 RETURN_TYPE_ERROR(isolate, closure, Instance); | 365 RETURN_TYPE_ERROR(isolate, closure, Instance); |
380 } | 366 } |
381 | 367 |
382 ASSERT(ClassFinalizer::AllClassesFinalized()); | 368 ASSERT(ClassFinalizer::AllClassesFinalized()); |
383 | 369 |
384 RawFunction* rf = Closure::function(closure_obj); | 370 RawFunction* rf = Closure::function(closure_obj); |
385 return Api::NewHandle(isolate, rf); | 371 return Api::NewHandle(isolate, rf); |
386 } | 372 } |
387 | 373 |
388 } // namespace dart | 374 } // namespace dart |
OLD | NEW |