Mercurial > projects > dang
diff sema/DType.d @ 181:59cd211a1bd3
Better support for function pointers
author | Anders Halager <halager@gmail.com> |
---|---|
date | Fri, 25 Jul 2008 01:39:01 +0200 |
parents | 2a1a635bd531 |
children |
line wrap: on
line diff
--- a/sema/DType.d Fri Jul 25 01:21:07 2008 +0200 +++ b/sema/DType.d Fri Jul 25 01:39:01 2008 +0200 @@ -61,6 +61,11 @@ /// Return a DFunction if this is one, otherwise return null DFunction asFunction() { return null; } + /// Is this type a DFunction or a pointer to one + bool isCallable() { return false; } + /// Return a DFunction if this one is available + DFunction asCallable() { return null; } + /// Returns true for integers, reals and complex numbers bool isArithmetic() { return false; } @@ -607,6 +612,8 @@ override bool isPointer() { return true; } override DPointer asPointer() { return this; } + bool isCallable() { return pointerOf.isFunction(); } + DFunction asCallable() { return pointerOf.asFunction(); } int byteSize() { return DType.Int.byteSize; } @@ -655,6 +662,8 @@ override bool isFunction() { return true; } override DFunction asFunction() { return this; } + bool isCallable() { return true; } + DFunction asCallable() { return this; } override bool hasImplicitConversionTo(DType that) {