diff lphobos/internal/contract.d @ 473:373489eeaf90

Applied downs' lphobos update
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Mon, 04 Aug 2008 19:28:49 +0200
parents 61615fa85940
children
line wrap: on
line diff
--- a/lphobos/internal/contract.d	Mon Aug 04 19:08:39 2008 +0200
+++ b/lphobos/internal/contract.d	Mon Aug 04 19:28:49 2008 +0200
@@ -1,13 +1,21 @@
 module internal.contract;
 
+import std.string: toString;
 extern(C):
 
 void exit(int);
 
-void _d_assert(bool cond, uint line, char[] msg)
+/*void _d_assert(bool cond, uint line, char[] msg)
 {
     if (!cond) {
         printf("Aborted(%u): %.*s\n", line, msg.length, msg.ptr);
         exit(1);
     }
+}*/
+void _d_assert(string file, uint line) {
+  throw new Exception(file~":"~.toString(line)~": Assertion failed!");
 }
+
+void _d_assert_msg(string msg, string file, uint line) {
+  throw new Exception(file~": "~.toString(line)~": Assertion failed: \""~msg~"\"");
+}