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

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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 if (cls.IsSignatureClass()) { 325 if (cls.IsSignatureClass()) {
326 if (cls.IsCanonicalSignatureClass()) { 326 if (cls.IsCanonicalSignatureClass()) {
327 // We represent function types as canonical signature classes. 327 // We represent function types as canonical signature classes.
328 return CreateFunctionTypeMirror(cls, type); 328 return CreateFunctionTypeMirror(cls, type);
329 } else { 329 } else {
330 // We represent typedefs as non-canonical signature classes. 330 // We represent typedefs as non-canonical signature classes.
331 return CreateTypedefMirror(cls, type, is_declaration, owner_mirror); 331 return CreateTypedefMirror(cls, type, is_declaration, owner_mirror);
332 } 332 }
333 } 333 }
334 334
335 const Error& error = Error::Handle(cls.EnsureIsFinalized(Isolate::Current()));
336 if (!error.IsNull()) {
337 ThrowInvokeError(error);
zra 2014/01/08 23:02:54 After many other calls to ThrowInvokeError() there
rmacnak 2014/01/09 00:17:58 Done.
338 }
339
335 const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0); 340 const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0);
336 const Bool& is_mixin_app_alias = Bool::Get(cls.is_mixin_app_alias()); 341 const Bool& is_mixin_app_alias = Bool::Get(cls.is_mixin_app_alias());
337 342
338 const Array& args = Array::Handle(Array::New(7)); 343 const Array& args = Array::Handle(Array::New(7));
339 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls))); 344 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls)));
340 args.SetAt(1, type); 345 args.SetAt(1, type);
341 // We do not set the names of anonymous mixin applications because the mirrors 346 // We do not set the names of anonymous mixin applications because the mirrors
342 // use a different naming convention than the VM (lib.S with lib.M and S&M 347 // use a different naming convention than the VM (lib.S with lib.M and S&M
343 // respectively). 348 // respectively).
344 if (!cls.IsAnonymousMixinApplication()) { 349 if (!cls.IsAnonymousMixinApplication()) {
(...skipping 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after
2046 2051
2047 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) { 2052 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) {
2048 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); 2053 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
2049 const Field& field = Field::Handle(ref.GetFieldReferent()); 2054 const Field& field = Field::Handle(ref.GetFieldReferent());
2050 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1)); 2055 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1));
2051 const AbstractType& type = AbstractType::Handle(field.type()); 2056 const AbstractType& type = AbstractType::Handle(field.type());
2052 return InstantiateType(type, instantiator); 2057 return InstantiateType(type, instantiator);
2053 } 2058 }
2054 2059
2055 } // namespace dart 2060 } // 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