From 234ae5d9d62e8edcd9555c075cb5b1f404ef67a7 Mon Sep 17 00:00:00 2001 From: walter Date: Mon, 13 Oct 2008 17:19:53 +0000 Subject: [PATCH] add hidden function error support git-svn-id: http://svn.dsource.org/projects/druntime/trunk@24 4a9d5153-6564-4b3f-b5e1-7e8e9dac548f --- import/object.di | 2 ++ src/compiler/dmd/dmain2.d | 3 +++ src/core/exception.d | 29 +++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/import/object.di b/import/object.di index 3301d27..ff7ad8d 100644 --- a/import/object.di +++ b/import/object.di @@ -22,6 +22,8 @@ class Object void lock(); void unlock(); } + + static Object factory(string classname); } struct Interface diff --git a/src/compiler/dmd/dmain2.d b/src/compiler/dmd/dmain2.d index 4141920..ec42e66 100644 --- a/src/compiler/dmd/dmain2.d +++ b/src/compiler/dmd/dmain2.d @@ -74,10 +74,13 @@ extern (C) void _d_switch_error( string file, uint line ) onSwitchError( file, line ); } +/+ extern (C) void _d_hidden_func() { // TODO: Figure out what to do with this routine + // it's in exception.d for the moment } ++/ bool _d_isHalting = false; diff --git a/src/core/exception.d b/src/core/exception.d index 1dd603d..e44392a 100644 --- a/src/core/exception.d +++ b/src/core/exception.d @@ -29,6 +29,18 @@ class ArrayBoundsException : Exception } +/** + * Thrown on hidden function error. + */ +class HiddenFuncException : Exception +{ + this(ClassInfo ci) + { + super("hidden method called for " ~ ci.name); + } +} + + /** * Thrown on an assert error. */ @@ -249,3 +261,20 @@ 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; +} -- 2.43.0