Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Unified Diff: runtime/vm/dart_api_impl.h

Issue 16973003: Split dart_api.h into multiple parts: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/custom_isolate_test.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.h
===================================================================
--- runtime/vm/dart_api_impl.h (revision 24032)
+++ runtime/vm/dart_api_impl.h (working copy)
@@ -58,6 +58,39 @@
HANDLESCOPE(__temp_isolate__);
+#define RETURN_TYPE_ERROR(isolate, dart_handle, type) \
+ do { \
+ const Object& tmp = \
+ Object::Handle(isolate, Api::UnwrapHandle((dart_handle))); \
+ if (tmp.IsNull()) { \
+ return Api::NewError("%s expects argument '%s' to be non-null.", \
+ CURRENT_FUNC, #dart_handle); \
+ } else if (tmp.IsError()) { \
+ return dart_handle; \
+ } else { \
+ return Api::NewError("%s expects argument '%s' to be of type %s.", \
+ CURRENT_FUNC, #dart_handle, #type); \
+ } \
+ } while (0)
+
+
+#define RETURN_NULL_ERROR(parameter) \
+ return Api::NewError("%s expects argument '%s' to be non-null.", \
+ CURRENT_FUNC, #parameter);
+
+
+#define CHECK_LENGTH(length, max_elements) \
+ do { \
+ intptr_t len = (length); \
+ intptr_t max = (max_elements); \
+ if (len < 0 || len > max) { \
+ return Api::NewError( \
+ "%s expects argument '%s' to be in the range [0..%"Pd"].", \
+ CURRENT_FUNC, #length, max); \
+ } \
+ } while (0)
+
+
class Api : AllStatic {
public:
// Creates a new local handle.
« no previous file with comments | « runtime/vm/custom_isolate_test.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698