| Index: runtime/lib/mirrors.cc
|
| ===================================================================
|
| --- runtime/lib/mirrors.cc (revision 25492)
|
| +++ runtime/lib/mirrors.cc (working copy)
|
| @@ -981,6 +981,28 @@
|
| }
|
|
|
|
|
| +static void ThrowMirroredCompilationError(const String& message) {
|
| + Array& args = Array::Handle(Array::New(1));
|
| + args.SetAt(0, message);
|
| +
|
| + Exceptions::ThrowByType(Exceptions::kMirroredCompilationError, args);
|
| + UNREACHABLE();
|
| +}
|
| +
|
| +
|
| +static void ThrowInvokeError(const Error& error) {
|
| + if (error.IsLanguageError()) {
|
| + // A compilation error that was delayed by lazy compilation.
|
| + const LanguageError& compilation_error = LanguageError::Cast(error);
|
| + String& message = String::Handle(compilation_error.message());
|
| + ThrowMirroredCompilationError(message);
|
| + UNREACHABLE();
|
| + }
|
| + Exceptions::PropagateError(error);
|
| + UNREACHABLE();
|
| +}
|
| +
|
| +
|
| DEFINE_NATIVE_ENTRY(DeclarationMirror_metadata, 1) {
|
| const MirrorReference& decl_ref =
|
| MirrorReference::CheckedHandle(arguments->NativeArgAt(0));
|
| @@ -998,7 +1020,11 @@
|
| }
|
|
|
| const Library& library = Library::Handle(klass.library());
|
| - return library.GetMetadata(decl);
|
| + const Object& metadata = Object::Handle(library.GetMetadata(decl));
|
| + if (metadata.IsError()) {
|
| + ThrowInvokeError(Error::Cast(metadata));
|
| + }
|
| + return metadata.raw();
|
| }
|
|
|
|
|
| @@ -1009,28 +1035,6 @@
|
| }
|
|
|
|
|
| -static void ThrowMirroredCompilationError(const String& message) {
|
| - Array& args = Array::Handle(Array::New(1));
|
| - args.SetAt(0, message);
|
| -
|
| - Exceptions::ThrowByType(Exceptions::kMirroredCompilationError, args);
|
| - UNREACHABLE();
|
| -}
|
| -
|
| -
|
| -static void ThrowInvokeError(const Error& error) {
|
| - if (error.IsLanguageError()) {
|
| - // A compilation error that was delayed by lazy compilation.
|
| - const LanguageError& compilation_error = LanguageError::Cast(error);
|
| - String& message = String::Handle(compilation_error.message());
|
| - ThrowMirroredCompilationError(message);
|
| - UNREACHABLE();
|
| - }
|
| - Exceptions::PropagateError(error);
|
| - UNREACHABLE();
|
| -}
|
| -
|
| -
|
| static bool FieldIsUninitialized(const Field& field) {
|
| ASSERT(!field.IsNull());
|
|
|
|
|