Chromium Code Reviews| Index: runtime/vm/dart_api_impl.cc |
| diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc |
| index ccda7f0d172d6666140b1b55016e06ce5106d367..5c95641cbbb0ea8ced195c3b98ebb6a452a8cc83 100644 |
| --- a/runtime/vm/dart_api_impl.cc |
| +++ b/runtime/vm/dart_api_impl.cc |
| @@ -184,6 +184,18 @@ static RawInstance* GetMapInstance(Zone* zone, const Object& obj) { |
| } |
| +static bool IsCompiletimeErrorObject(Zone* zone, const Object& obj) { |
| + Isolate* I = Thread::Current()->isolate(); |
| + const Class& error_class = |
| + Class::Handle(zone, I->object_store()->compiletime_error_class()); |
| + ASSERT(!error_class.IsNull()); |
| + if (obj.GetClassId() == error_class.id()) { |
| + return true; |
| + } |
| + return false; |
|
siva
2016/09/16 00:12:09
maybe
return (obj.GetClassId() == error_class.id(
|
| +} |
| + |
| + |
| static bool GetNativeStringArgument(NativeArguments* arguments, |
| int arg_index, |
| Dart_Handle* str, |
| @@ -761,6 +773,13 @@ DART_EXPORT bool Dart_IsUnhandledExceptionError(Dart_Handle object) { |
| DART_EXPORT bool Dart_IsCompilationError(Dart_Handle object) { |
| + if (Dart_IsUnhandledExceptionError(object)) { |
| + DARTSCOPE(Thread::Current()); |
| + const UnhandledException& error = |
| + UnhandledException::Cast(Object::Handle(Z, Api::UnwrapHandle(object))); |
| + const Instance& exc = Instance::Handle(Z, error.exception()); |
| + return IsCompiletimeErrorObject(Z, exc); |
| + } |
| return Api::ClassId(object) == kLanguageErrorCid; |
| } |