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

Unified Diff: runtime/platform/assert.h

Issue 9303031: Add support for lists and backward references when decoding a message to a Dart_CObject object (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased to r3830 Created 8 years, 11 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/include/dart_api.h ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/platform/assert.h
diff --git a/runtime/platform/assert.h b/runtime/platform/assert.h
index 0bfd8eef4c2f3d935c1d9196f4c8894ab207ff33..3d39bab4eeebc59113853e24d7fe9048386ff451 100644
--- a/runtime/platform/assert.h
+++ b/runtime/platform/assert.h
@@ -62,6 +62,9 @@ class DynamicAssertionHelper {
template<typename E, typename A>
void GreaterEqual(const E& left, const A& right);
+
+ template<typename T>
+ void NotNull(const T p);
#endif
private:
@@ -196,6 +199,13 @@ void DynamicAssertionHelper::GreaterEqual(const E& left, const A& right) {
std::string es = ess.str(), as = ass.str();
Fail("expected: %s >= %s", es.c_str(), as.c_str());
}
+
+
+template<typename T>
+void DynamicAssertionHelper::NotNull(const T p) {
+ if (p != NULL) return;
+ Fail("expected: not NULL, found NULL");
+}
#endif
} // namespace dart
@@ -277,6 +287,9 @@ void DynamicAssertionHelper::GreaterEqual(const E& left, const A& right) {
#define EXPECT_GE(left, right) \
dart::Expect(__FILE__, __LINE__).GreaterEqual((left), (right))
+
+#define EXPECT_NOTNULL(ptr) \
+ dart::Expect(__FILE__, __LINE__).NotNull((ptr))
#endif
// TODO(iposva): provide a better way to get extra info on an EXPECT
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698