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

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

Issue 68103016: When ClassMirrors are created by enumerating members of a LibraryMirror, have the ClassMirror use t… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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
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/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/exceptions.h" 10 #include "vm/exceptions.h"
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 return CreateFunctionTypeMirror(cls, type); 342 return CreateFunctionTypeMirror(cls, type);
343 } else { 343 } else {
344 // We represent typedefs as non-canonical signature classes. 344 // We represent typedefs as non-canonical signature classes.
345 return CreateTypedefMirror(cls, type, is_declaration, owner_mirror); 345 return CreateTypedefMirror(cls, type, is_declaration, owner_mirror);
346 } 346 }
347 } 347 }
348 348
349 const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0); 349 const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0);
350 const Bool& is_mixin_typedef = Bool::Get(cls.is_mixin_typedef()); 350 const Bool& is_mixin_typedef = Bool::Get(cls.is_mixin_typedef());
351 351
352 const Array& args = Array::Handle(Array::New(6)); 352 const Array& args = Array::Handle(Array::New(7));
353 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls))); 353 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls)));
354 args.SetAt(1, type); 354 args.SetAt(1, type);
355 // We do not set the names of anonymous mixin applications because the mirrors 355 // We do not set the names of anonymous mixin applications because the mirrors
356 // use a different naming convention than the VM (lib.S with lib.M and S&M 356 // use a different naming convention than the VM (lib.S with lib.M and S&M
357 // respectively). 357 // respectively).
358 if (!cls.IsAnonymousMixinApplication()) { 358 if (!cls.IsAnonymousMixinApplication()) {
359 args.SetAt(2, String::Handle(cls.Name())); 359 args.SetAt(2, String::Handle(cls.Name()));
360 } 360 }
361 args.SetAt(3, is_generic); 361 args.SetAt(3, owner_mirror);
362 args.SetAt(4, is_mixin_typedef); 362 args.SetAt(4, is_generic);
363 args.SetAt(5, cls.NumTypeParameters() == 0 ? Bool::False() : is_declaration); 363 args.SetAt(5, is_mixin_typedef);
364 args.SetAt(6, cls.NumTypeParameters() == 0 ? Bool::False() : is_declaration);
364 return CreateMirror(Symbols::_LocalClassMirrorImpl(), args); 365 return CreateMirror(Symbols::_LocalClassMirrorImpl(), args);
365 } 366 }
366 367
367 368
368 static RawInstance* CreateLibraryMirror(const Library& lib) { 369 static RawInstance* CreateLibraryMirror(const Library& lib) {
369 const Array& args = Array::Handle(Array::New(3)); 370 const Array& args = Array::Handle(Array::New(3));
370 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(lib))); 371 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(lib)));
371 String& str = String::Handle(); 372 String& str = String::Handle();
372 str = lib.name(); 373 str = lib.name();
373 args.SetAt(1, str); 374 args.SetAt(1, str);
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1960 } 1961 }
1961 1962
1962 1963
1963 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { 1964 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) {
1964 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); 1965 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
1965 const Field& field = Field::Handle(ref.GetFieldReferent()); 1966 const Field& field = Field::Handle(ref.GetFieldReferent());
1966 return field.type(); 1967 return field.type();
1967 } 1968 }
1968 1969
1969 } // namespace dart 1970 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | tests/lib/mirrors/hierarchy_invariants_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698