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 #ifndef VM_DART_API_IMPL_H_ | 5 #ifndef VM_DART_API_IMPL_H_ |
6 #define VM_DART_API_IMPL_H_ | 6 #define VM_DART_API_IMPL_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/native_arguments.h" | 9 #include "vm/native_arguments.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 #define RETURN_TYPE_ERROR(isolate, dart_handle, type) \ | 77 #define RETURN_TYPE_ERROR(isolate, dart_handle, type) \ |
78 do { \ | 78 do { \ |
79 const Object& tmp = \ | 79 const Object& tmp = \ |
80 Object::Handle(isolate, Api::UnwrapHandle((dart_handle))); \ | 80 Object::Handle(isolate, Api::UnwrapHandle((dart_handle))); \ |
81 if (tmp.IsNull()) { \ | 81 if (tmp.IsNull()) { \ |
82 return Api::NewError("%s expects argument '%s' to be non-null.", \ | 82 return Api::NewError("%s expects argument '%s' to be non-null.", \ |
83 CURRENT_FUNC, #dart_handle); \ | 83 CURRENT_FUNC, #dart_handle); \ |
84 } else if (tmp.IsError()) { \ | 84 } else if (tmp.IsError()) { \ |
85 return dart_handle; \ | 85 return dart_handle; \ |
86 } else { \ | |
87 return Api::NewError("%s expects argument '%s' to be of type %s.", \ | |
88 CURRENT_FUNC, #dart_handle, #type); \ | |
89 } \ | 86 } \ |
| 87 return Api::NewError("%s expects argument '%s' to be of type %s.", \ |
| 88 CURRENT_FUNC, #dart_handle, #type); \ |
90 } while (0) | 89 } while (0) |
91 | 90 |
92 | 91 |
93 #define RETURN_NULL_ERROR(parameter) \ | 92 #define RETURN_NULL_ERROR(parameter) \ |
94 return Api::NewError("%s expects argument '%s' to be non-null.", \ | 93 return Api::NewError("%s expects argument '%s' to be non-null.", \ |
95 CURRENT_FUNC, #parameter); | 94 CURRENT_FUNC, #parameter); |
96 | 95 |
97 | 96 |
98 #define CHECK_LENGTH(length, max_elements) \ | 97 #define CHECK_LENGTH(length, max_elements) \ |
99 do { \ | 98 do { \ |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 if (isolate->no_callback_scope_depth() != 0) { \ | 279 if (isolate->no_callback_scope_depth() != 0) { \ |
281 return reinterpret_cast<Dart_Handle>(Api::AcquiredError(isolate)); \ | 280 return reinterpret_cast<Dart_Handle>(Api::AcquiredError(isolate)); \ |
282 } \ | 281 } \ |
283 | 282 |
284 #define ASSERT_CALLBACK_STATE(isolate) \ | 283 #define ASSERT_CALLBACK_STATE(isolate) \ |
285 ASSERT(isolate->no_callback_scope_depth() == 0) | 284 ASSERT(isolate->no_callback_scope_depth() == 0) |
286 | 285 |
287 } // namespace dart. | 286 } // namespace dart. |
288 | 287 |
289 #endif // VM_DART_API_IMPL_H_ | 288 #endif // VM_DART_API_IMPL_H_ |
OLD | NEW |