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

Side by Side Diff: runtime/lib/mirrors.cc

Issue 22849015: Provide a way to get a Type back from a ClassMirror. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address comments Created 7 years, 4 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 | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | tests/lib/lib.status » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "lib/invocation_mirror.h" 5 #include "lib/invocation_mirror.h"
6 #include "vm/bootstrap_natives.h" 6 #include "vm/bootstrap_natives.h"
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/exceptions.h" 9 #include "vm/exceptions.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 298
299 DEFINE_NATIVE_ENTRY(Mirrors_makeLocalMirrorSystem, 0) { 299 DEFINE_NATIVE_ENTRY(Mirrors_makeLocalMirrorSystem, 0) {
300 return CreateMirrorSystem(); 300 return CreateMirrorSystem();
301 } 301 }
302 302
303 303
304 DEFINE_NATIVE_ENTRY(Mirrors_makeLocalClassMirror, 1) { 304 DEFINE_NATIVE_ENTRY(Mirrors_makeLocalClassMirror, 1) {
305 GET_NON_NULL_NATIVE_ARGUMENT(Type, type, arguments->NativeArgAt(0)); 305 GET_NON_NULL_NATIVE_ARGUMENT(Type, type, arguments->NativeArgAt(0));
306 const Class& cls = Class::Handle(type.type_class()); 306 const Class& cls = Class::Handle(type.type_class());
307 ASSERT(!cls.IsNull()); 307 ASSERT(!cls.IsNull());
308 return CreateClassMirror(cls, 308 // Strip the type for generics only.
309 AbstractType::Handle(), 309 if (cls.NumTypeParameters() == 0) {
310 Instance::null_instance()); 310 return CreateClassMirror(cls,
311 type,
312 Object::null_instance());
313 } else {
314 return CreateClassMirror(cls,
315 AbstractType::Handle(),
316 Object::null_instance());
317 }
311 } 318 }
312 319
313 320
314 DEFINE_NATIVE_ENTRY(Mirrors_makeLocalTypeMirror, 1) { 321 DEFINE_NATIVE_ENTRY(Mirrors_makeLocalTypeMirror, 1) {
315 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0)); 322 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
316 return CreateTypeMirror(type); 323 return CreateTypeMirror(type);
317 } 324 }
318 325
319 326
320 static void ThrowMirroredCompilationError(const String& message) { 327 static void ThrowMirroredCompilationError(const String& message) {
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 } 1301 }
1295 1302
1296 1303
1297 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { 1304 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) {
1298 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); 1305 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
1299 const Field& field = Field::Handle(ref.GetFieldReferent()); 1306 const Field& field = Field::Handle(ref.GetFieldReferent());
1300 return field.type(); 1307 return field.type();
1301 } 1308 }
1302 1309
1303 } // namespace dart 1310 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | tests/lib/lib.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698