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..7e3a401d285fc558e4b5ccad1c496633b9967c29 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 IsSyntaxErrorObject(Zone* zone, const Object& obj) { |
| + Isolate* I = Thread::Current()->isolate(); |
| + const Class& error_class = |
| + Class::Handle(I->object_store()->syntax_error_class()); |
|
siva
2016/09/15 18:11:45
Handle(zone, I->object_store()....
as the zone see
hausner
2016/09/15 21:28:28
Done.
|
| + ASSERT(!error_class.IsNull()); |
| + if (obj.GetClassId() == error_class.id()) { |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| + |
| 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 IsSyntaxErrorObject(Z, exc); |
| + } |
| return Api::ClassId(object) == kLanguageErrorCid; |
| } |