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

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

Issue 129513002: Ensure a class is finalized before attempting any reflective invocation on it. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 | tests/lib/lib.status » ('j') | 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) 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 if (cls.IsSignatureClass()) { 330 if (cls.IsSignatureClass()) {
331 if (cls.IsCanonicalSignatureClass()) { 331 if (cls.IsCanonicalSignatureClass()) {
332 // We represent function types as canonical signature classes. 332 // We represent function types as canonical signature classes.
333 return CreateFunctionTypeMirror(cls, type); 333 return CreateFunctionTypeMirror(cls, type);
334 } else { 334 } else {
335 // We represent typedefs as non-canonical signature classes. 335 // We represent typedefs as non-canonical signature classes.
336 return CreateTypedefMirror(cls, type, is_declaration, owner_mirror); 336 return CreateTypedefMirror(cls, type, is_declaration, owner_mirror);
337 } 337 }
338 } 338 }
339 339
340 const Error& error = Error::Handle(cls.EnsureIsFinalized(Isolate::Current()));
341 if (!error.IsNull()) {
342 ThrowInvokeError(error);
343 UNREACHABLE();
344 }
345
340 const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0); 346 const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0);
341 const Bool& is_mixin_app_alias = Bool::Get(cls.is_mixin_app_alias()); 347 const Bool& is_mixin_app_alias = Bool::Get(cls.is_mixin_app_alias());
342 348
343 const Array& args = Array::Handle(Array::New(7)); 349 const Array& args = Array::Handle(Array::New(7));
344 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls))); 350 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls)));
345 args.SetAt(1, type); 351 args.SetAt(1, type);
346 // We do not set the names of anonymous mixin applications because the mirrors 352 // We do not set the names of anonymous mixin applications because the mirrors
347 // use a different naming convention than the VM (lib.S with lib.M and S&M 353 // use a different naming convention than the VM (lib.S with lib.M and S&M
348 // respectively). 354 // respectively).
349 if (!cls.IsAnonymousMixinApplication()) { 355 if (!cls.IsAnonymousMixinApplication()) {
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 2061
2056 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) { 2062 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) {
2057 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); 2063 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
2058 const Field& field = Field::Handle(ref.GetFieldReferent()); 2064 const Field& field = Field::Handle(ref.GetFieldReferent());
2059 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1)); 2065 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1));
2060 const AbstractType& type = AbstractType::Handle(field.type()); 2066 const AbstractType& type = AbstractType::Handle(field.type());
2061 return InstantiateType(type, instantiator); 2067 return InstantiateType(type, instantiator);
2062 } 2068 }
2063 2069
2064 } // namespace dart 2070 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698