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

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

Issue 23994007: Properly handle exceptions that arise when reflectively invoking a constructor/factory. (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 | « 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/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 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 // Factories get type arguments. 1159 // Factories get type arguments.
1160 args.SetAt(0, type_arguments); 1160 args.SetAt(0, type_arguments);
1161 } 1161 }
1162 1162
1163 // Invoke the constructor and return the new object. 1163 // Invoke the constructor and return the new object.
1164 const Object& result = 1164 const Object& result =
1165 Object::Handle(DartEntry::InvokeFunction(redirected_constructor, 1165 Object::Handle(DartEntry::InvokeFunction(redirected_constructor,
1166 args, 1166 args,
1167 args_descriptor_array)); 1167 args_descriptor_array));
1168 if (result.IsError()) { 1168 if (result.IsError()) {
1169 return result.raw(); 1169 ThrowInvokeError(Error::Cast(result));
1170 UNREACHABLE();
1170 } 1171 }
1171 1172
1172 // Factories may return null. 1173 // Factories may return null.
1173 ASSERT(result.IsInstance() || result.IsNull()); 1174 ASSERT(result.IsInstance() || result.IsNull());
1174 1175
1175 if (redirected_constructor.IsConstructor()) { 1176 if (redirected_constructor.IsConstructor()) {
1176 return new_object.raw(); 1177 return new_object.raw();
1177 } else { 1178 } else {
1178 return result.raw(); 1179 return result.raw();
1179 } 1180 }
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 } 1406 }
1406 1407
1407 1408
1408 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { 1409 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) {
1409 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); 1410 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
1410 const Field& field = Field::Handle(ref.GetFieldReferent()); 1411 const Field& field = Field::Handle(ref.GetFieldReferent());
1411 return field.type(); 1412 return field.type();
1412 } 1413 }
1413 1414
1414 } // namespace dart 1415 } // 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