| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 | 6 |
| 7 #include "vm/assert.h" | 7 #include "vm/assert.h" |
| 8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
| 9 #include "vm/unit_test.h" | 9 #include "vm/unit_test.h" |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 if (!expected.Equals(actual)) { | 23 if (!expected.Equals(actual)) { |
| 24 OS::Print("expected: '%s' actual: '%s'\n", | 24 OS::Print("expected: '%s' actual: '%s'\n", |
| 25 expected.ToCString(), actual.ToCString()); | 25 expected.ToCString(), actual.ToCString()); |
| 26 FATAL("Unhandled_equals fails.\n"); | 26 FATAL("Unhandled_equals fails.\n"); |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 | 29 |
| 30 | 30 |
| 31 void FUNCTION_NAME(Unhandled_invoke)(Dart_NativeArguments args) { | 31 void FUNCTION_NAME(Unhandled_invoke)(Dart_NativeArguments args) { |
| 32 // Invoke the specified entry point. | 32 // Invoke the specified entry point. |
| 33 Dart_Result result = Dart_InvokeStatic(TestCase::lib(), | 33 Dart_Handle result = Dart_InvokeStatic(TestCase::lib(), |
| 34 Dart_NewString("Second"), | 34 Dart_NewString("Second"), |
| 35 Dart_NewString("method2"), | 35 Dart_NewString("method2"), |
| 36 0, | 36 0, |
| 37 NULL); | 37 NULL); |
| 38 ASSERT(Dart_IsValidResult(result)); | 38 ASSERT(Dart_IsValid(result)); |
| 39 ASSERT(Dart_ExceptionOccurred(Dart_GetResult(result))); | 39 ASSERT(Dart_ExceptionOccurred(result)); |
| 40 return; | 40 return; |
| 41 } | 41 } |
| 42 | 42 |
| 43 | 43 |
| 44 void FUNCTION_NAME(Unhandled_invoke2)(Dart_NativeArguments args) { | 44 void FUNCTION_NAME(Unhandled_invoke2)(Dart_NativeArguments args) { |
| 45 // Invoke the specified entry point. | 45 // Invoke the specified entry point. |
| 46 Dart_Result result = Dart_InvokeStatic(TestCase::lib(), | 46 Dart_Handle result = Dart_InvokeStatic(TestCase::lib(), |
| 47 Dart_NewString("Second"), | 47 Dart_NewString("Second"), |
| 48 Dart_NewString("method2"), | 48 Dart_NewString("method2"), |
| 49 0, | 49 0, |
| 50 NULL); | 50 NULL); |
| 51 ASSERT(Dart_IsValidResult(result)); | 51 ASSERT(Dart_IsValid(result)); |
| 52 Dart_Handle retobj = Dart_GetResult(result); | 52 ASSERT(Dart_ExceptionOccurred(result)); |
| 53 ASSERT(Dart_ExceptionOccurred(retobj)); | 53 Dart_Handle exception = Dart_GetException(result); |
| 54 result = Dart_GetException(retobj); | 54 ASSERT(Dart_IsValid(exception)); |
| 55 ASSERT(Dart_IsValidResult(result)); | |
| 56 Dart_Handle exception = Dart_GetResult(result); | |
| 57 Dart_ThrowException(exception); | 55 Dart_ThrowException(exception); |
| 58 UNREACHABLE(); | 56 UNREACHABLE(); |
| 59 return; | 57 return; |
| 60 } | 58 } |
| 61 | 59 |
| 62 | 60 |
| 63 // List all native functions implemented in the vm or core boot strap dart | 61 // List all native functions implemented in the vm or core boot strap dart |
| 64 // libraries so that we can resolve the native function to it's entry | 62 // libraries so that we can resolve the native function to it's entry |
| 65 // point. | 63 // point. |
| 66 #define UNHANDLED_NATIVE_LIST(V) \ | 64 #define UNHANDLED_NATIVE_LIST(V) \ |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); | 130 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); |
| 133 Dart_InvokeStatic(lib, | 131 Dart_InvokeStatic(lib, |
| 134 Dart_NewString("UnhandledExceptionTest"), | 132 Dart_NewString("UnhandledExceptionTest"), |
| 135 Dart_NewString("testMain"), | 133 Dart_NewString("testMain"), |
| 136 0, | 134 0, |
| 137 NULL); | 135 NULL); |
| 138 } | 136 } |
| 139 #endif // TARGET_ARCH_IA32. | 137 #endif // TARGET_ARCH_IA32. |
| 140 | 138 |
| 141 } // namespace dart | 139 } // namespace dart |
| OLD | NEW |