Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: runtime/vm/mirrors_api_impl.cc

Issue 23851038: Add Dart_QualifiedClassName. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17 matching lines...) Expand all
28 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object)); 28 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
29 if (obj.IsType() || obj.IsClass()) { 29 if (obj.IsType() || obj.IsClass()) {
30 const Class& cls = (obj.IsType()) ? 30 const Class& cls = (obj.IsType()) ?
31 Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj); 31 Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj);
32 return Api::NewHandle(isolate, cls.UserVisibleName()); 32 return Api::NewHandle(isolate, cls.UserVisibleName());
33 } else { 33 } else {
34 RETURN_TYPE_ERROR(isolate, object, Class/Type); 34 RETURN_TYPE_ERROR(isolate, object, Class/Type);
35 } 35 }
36 } 36 }
37 37
38 DART_EXPORT Dart_Handle Dart_QualifiedClassName(Dart_Handle object) {
39 Isolate* isolate = Isolate::Current();
40 DARTSCOPE(isolate);
41 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
42 if (obj.IsType() || obj.IsClass()) {
43 const Class& cls = (obj.IsType()) ?
44 Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj);
45 return Dart_NewStringFromCString(cls.ToCString());
46 } else {
47 RETURN_TYPE_ERROR(isolate, object, Class/Type);
48 }
49 }
50
38 // --- Function and Variable Reflection --- 51 // --- Function and Variable Reflection ---
39 52
40 // Outside of the vm, we expose setter names with a trailing '='. 53 // Outside of the vm, we expose setter names with a trailing '='.
41 static bool HasExternalSetterSuffix(const String& name) { 54 static bool HasExternalSetterSuffix(const String& name) {
42 return name.CharAt(name.Length() - 1) == '='; 55 return name.CharAt(name.Length() - 1) == '=';
43 } 56 }
44 57
45 58
46 static RawString* RemoveExternalSetterSuffix(const String& name) { 59 static RawString* RemoveExternalSetterSuffix(const String& name) {
47 ASSERT(HasExternalSetterSuffix(name)); 60 ASSERT(HasExternalSetterSuffix(name));
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 RETURN_TYPE_ERROR(isolate, closure, Instance); 373 RETURN_TYPE_ERROR(isolate, closure, Instance);
361 } 374 }
362 375
363 ASSERT(ClassFinalizer::AllClassesFinalized()); 376 ASSERT(ClassFinalizer::AllClassesFinalized());
364 377
365 RawFunction* rf = Closure::function(closure_obj); 378 RawFunction* rf = Closure::function(closure_obj);
366 return Api::NewHandle(isolate, rf); 379 return Api::NewHandle(isolate, rf);
367 } 380 }
368 381
369 } // namespace dart 382 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698