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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 RETURN_TYPE_ERROR(Z, library, Library); | 327 RETURN_TYPE_ERROR(Z, library, Library); |
328 } | 328 } |
329 | 329 |
330 const GrowableObjectArray& names = | 330 const GrowableObjectArray& names = |
331 GrowableObjectArray::Handle(Z, GrowableObjectArray::New()); | 331 GrowableObjectArray::Handle(Z, GrowableObjectArray::New()); |
332 ClassDictionaryIterator it(lib); | 332 ClassDictionaryIterator it(lib); |
333 Class& cls = Class::Handle(Z); | 333 Class& cls = Class::Handle(Z); |
334 String& name = String::Handle(Z); | 334 String& name = String::Handle(Z); |
335 while (it.HasNext()) { | 335 while (it.HasNext()) { |
336 cls = it.GetNextClass(); | 336 cls = it.GetNextClass(); |
337 if (cls.IsSignatureClass()) { | 337 name = cls.UserVisibleName(); |
338 if (!cls.IsCanonicalSignatureClass()) { | 338 names.Add(name); |
339 // This is a typedef. Add it to the list of class names. | |
340 name = cls.UserVisibleName(); | |
341 names.Add(name); | |
342 } else { | |
343 // Skip canonical signature classes. These are not named. | |
344 } | |
345 } else { | |
346 name = cls.UserVisibleName(); | |
347 names.Add(name); | |
348 } | |
349 } | 339 } |
350 return Api::NewHandle(T, Array::MakeArray(names)); | 340 return Api::NewHandle(T, Array::MakeArray(names)); |
351 } | 341 } |
352 | 342 |
353 | 343 |
354 // --- Closures Reflection --- | 344 // --- Closures Reflection --- |
355 | 345 |
356 DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure) { | 346 DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure) { |
357 DARTSCOPE(Thread::Current()); | 347 DARTSCOPE(Thread::Current()); |
358 const Instance& closure_obj = Api::UnwrapInstanceHandle(Z, closure); | 348 const Instance& closure_obj = Api::UnwrapInstanceHandle(Z, closure); |
359 if (closure_obj.IsNull() || !closure_obj.IsClosure()) { | 349 if (closure_obj.IsNull() || !closure_obj.IsClosure()) { |
360 RETURN_TYPE_ERROR(Z, closure, Instance); | 350 RETURN_TYPE_ERROR(Z, closure, Instance); |
361 } | 351 } |
362 | 352 |
363 ASSERT(ClassFinalizer::AllClassesFinalized()); | 353 ASSERT(ClassFinalizer::AllClassesFinalized()); |
364 | 354 |
365 RawFunction* rf = Closure::function(closure_obj); | 355 RawFunction* rf = Closure::Cast(closure_obj).function(); |
366 return Api::NewHandle(T, rf); | 356 return Api::NewHandle(T, rf); |
367 } | 357 } |
368 | 358 |
369 } // namespace dart | 359 } // namespace dart |
OLD | NEW |