| OLD | NEW | 
|---|
| 1 // Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "include/dart_api.h" | 5 #include "include/dart_api.h" | 
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" | 
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" | 
| 8 | 8 | 
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" | 
| 10 #include "lib/stacktrace.h" | 10 #include "lib/stacktrace.h" | 
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 177                               NULL, | 177                               NULL, | 
| 178                               Heap::kNew)) { | 178                               Heap::kNew)) { | 
| 179       ASSERT(malformed_type_error.IsNull());  // Type is a raw Map. | 179       ASSERT(malformed_type_error.IsNull());  // Type is a raw Map. | 
| 180       return instance.raw(); | 180       return instance.raw(); | 
| 181     } | 181     } | 
| 182   } | 182   } | 
| 183   return Instance::null(); | 183   return Instance::null(); | 
| 184 } | 184 } | 
| 185 | 185 | 
| 186 | 186 | 
|  | 187 static bool IsCompiletimeErrorObject(Zone* zone, const Object& obj) { | 
|  | 188   Isolate* I = Thread::Current()->isolate(); | 
|  | 189   const Class& error_class = | 
|  | 190       Class::Handle(zone, I->object_store()->compiletime_error_class()); | 
|  | 191   ASSERT(!error_class.IsNull()); | 
|  | 192   return (obj.GetClassId() == error_class.id()); | 
|  | 193 } | 
|  | 194 | 
|  | 195 | 
| 187 static bool GetNativeStringArgument(NativeArguments* arguments, | 196 static bool GetNativeStringArgument(NativeArguments* arguments, | 
| 188                                     int arg_index, | 197                                     int arg_index, | 
| 189                                     Dart_Handle* str, | 198                                     Dart_Handle* str, | 
| 190                                     void** peer) { | 199                                     void** peer) { | 
| 191   ASSERT(peer != NULL); | 200   ASSERT(peer != NULL); | 
| 192   if (Api::StringGetPeerHelper(arguments, arg_index, peer)) { | 201   if (Api::StringGetPeerHelper(arguments, arg_index, peer)) { | 
| 193     *str = NULL; | 202     *str = NULL; | 
| 194     return true; | 203     return true; | 
| 195   } | 204   } | 
| 196   Thread* thread = arguments->thread(); | 205   Thread* thread = arguments->thread(); | 
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 754   return Api::ClassId(object) == kApiErrorCid; | 763   return Api::ClassId(object) == kApiErrorCid; | 
| 755 } | 764 } | 
| 756 | 765 | 
| 757 | 766 | 
| 758 DART_EXPORT bool Dart_IsUnhandledExceptionError(Dart_Handle object) { | 767 DART_EXPORT bool Dart_IsUnhandledExceptionError(Dart_Handle object) { | 
| 759   return Api::ClassId(object) == kUnhandledExceptionCid; | 768   return Api::ClassId(object) == kUnhandledExceptionCid; | 
| 760 } | 769 } | 
| 761 | 770 | 
| 762 | 771 | 
| 763 DART_EXPORT bool Dart_IsCompilationError(Dart_Handle object) { | 772 DART_EXPORT bool Dart_IsCompilationError(Dart_Handle object) { | 
|  | 773   if (Dart_IsUnhandledExceptionError(object)) { | 
|  | 774     DARTSCOPE(Thread::Current()); | 
|  | 775     const UnhandledException& error = | 
|  | 776         UnhandledException::Cast(Object::Handle(Z, Api::UnwrapHandle(object))); | 
|  | 777     const Instance& exc = Instance::Handle(Z, error.exception()); | 
|  | 778     return IsCompiletimeErrorObject(Z, exc); | 
|  | 779   } | 
| 764   return Api::ClassId(object) == kLanguageErrorCid; | 780   return Api::ClassId(object) == kLanguageErrorCid; | 
| 765 } | 781 } | 
| 766 | 782 | 
| 767 | 783 | 
| 768 DART_EXPORT bool Dart_IsFatalError(Dart_Handle object) { | 784 DART_EXPORT bool Dart_IsFatalError(Dart_Handle object) { | 
| 769   return Api::ClassId(object) == kUnwindErrorCid; | 785   return Api::ClassId(object) == kUnwindErrorCid; | 
| 770 } | 786 } | 
| 771 | 787 | 
| 772 | 788 | 
| 773 DART_EXPORT bool Dart_IsVMRestartRequest(Dart_Handle handle) { | 789 DART_EXPORT bool Dart_IsVMRestartRequest(Dart_Handle handle) { | 
| (...skipping 5810 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6584 | 6600 | 
| 6585 DART_EXPORT bool Dart_IsPrecompiledRuntime() { | 6601 DART_EXPORT bool Dart_IsPrecompiledRuntime() { | 
| 6586 #if defined(DART_PRECOMPILED_RUNTIME) | 6602 #if defined(DART_PRECOMPILED_RUNTIME) | 
| 6587   return true; | 6603   return true; | 
| 6588 #else | 6604 #else | 
| 6589   return false; | 6605   return false; | 
| 6590 #endif | 6606 #endif | 
| 6591 } | 6607 } | 
| 6592 | 6608 | 
| 6593 }  // namespace dart | 6609 }  // namespace dart | 
| OLD | NEW | 
|---|