private
{
- alias void function( char[] file, size_t line, char[] msg = null ) assertHandlerType;
+ alias void function( string file, size_t line, string msg = null ) assertHandlerType;
assertHandlerType assertHandler = null;
}
*/
class ArrayBoundsException : Exception
{
- this( char[] file, size_t line )
+ this( string file, size_t line )
{
super( "Array index out of bounds", file, line );
}
}
+/**
+ * Thrown on hidden function error.
+ */
+class HiddenFuncException : Exception
+{
+ this(ClassInfo ci)
+ {
+ super("hidden method called for " ~ ci.name);
+ }
+}
+
+
/**
* Thrown on an assert error.
*/
class AssertException : Exception
{
- this( char[] file, size_t line )
+ this( string file, size_t line )
{
super( "Assertion failure", file, line );
}
- this( char[] msg, char[] file, size_t line )
+ this( string msg, string file, size_t line )
{
super( msg, file, line );
}
info = c;
}
- string toString()
+ override string toString()
{
return "An exception was thrown while finalizing an instance of class " ~ info.name;
}
*/
class OutOfMemoryException : Exception
{
- this( char[] file, size_t line )
+ this( string file, size_t line )
{
super( "Memory allocation failed", file, line );
}
- string toString()
+ override string toString()
{
return msg ? super.toString() : "Memory allocation failed";
}
*/
class SwitchException : Exception
{
- this( char[] file, size_t line )
+ this( string file, size_t line )
{
super( "No appropriate switch clause found", file, line );
}
{
size_t idx;
- this( char[] msg, size_t idx )
+ this( string msg, size_t idx )
{
super( msg );
this.idx = idx;
* file = The name of the file that signaled this error.
* line = The line number on which this error occurred.
*/
-extern (C) void onAssertError( char[] file, size_t line )
+extern (C) void onAssertError( string file, size_t line )
{
if( assertHandler is null )
throw new AssertException( file, line );
* line = The line number on which this error occurred.
* msg = An error message supplied by the user.
*/
-extern (C) void onAssertErrorMsg( char[] file, size_t line, char[] msg )
+extern (C) void onAssertErrorMsg( string file, size_t line, string msg )
{
if( assertHandler is null )
throw new AssertException( msg, file, line );
* Throws:
* ArrayBoundsException.
*/
-extern (C) void onArrayBoundsError( char[] file, size_t line )
+extern (C) void onArrayBoundsError( string file, size_t line )
{
throw new ArrayBoundsException( file, line );
}
* Throws:
* SwitchException.
*/
-extern (C) void onSwitchError( char[] file, size_t line )
+extern (C) void onSwitchError( string file, size_t line )
{
throw new SwitchException( file, line );
}
* Throws:
* UnicodeException.
*/
-extern (C) void onUnicodeError( char[] msg, size_t idx )
+extern (C) void onUnicodeError( string msg, size_t idx )
{
throw new UnicodeException( msg, idx );
}
+
+/********************************************
+ * Called by the compiler generated code.
+ */
+
+extern (C) void _d_hidden_func()
+{ Object o;
+ asm
+ {
+ mov o, EAX;
+ }
+
+ //printf("_d_hidden_func()\n");
+ auto a = new HiddenFuncException(o.classinfo);
+ //printf("assertion %p created\n", a);
+ throw a;
+}