comparison 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
comparison
equal deleted inserted replaced
179:2a1a635bd531 181:59cd211a1bd3
58 58
59 /// Is this type a DFunction 59 /// Is this type a DFunction
60 bool isFunction() { return false; } 60 bool isFunction() { return false; }
61 /// Return a DFunction if this is one, otherwise return null 61 /// Return a DFunction if this is one, otherwise return null
62 DFunction asFunction() { return null; } 62 DFunction asFunction() { return null; }
63
64 /// Is this type a DFunction or a pointer to one
65 bool isCallable() { return false; }
66 /// Return a DFunction if this one is available
67 DFunction asCallable() { return null; }
63 68
64 /// Returns true for integers, reals and complex numbers 69 /// Returns true for integers, reals and complex numbers
65 bool isArithmetic() { return false; } 70 bool isArithmetic() { return false; }
66 71
67 /// Is this type a DInteger 72 /// Is this type a DInteger
605 this.pointerOf = pointerOf; 610 this.pointerOf = pointerOf;
606 } 611 }
607 612
608 override bool isPointer() { return true; } 613 override bool isPointer() { return true; }
609 override DPointer asPointer() { return this; } 614 override DPointer asPointer() { return this; }
615 bool isCallable() { return pointerOf.isFunction(); }
616 DFunction asCallable() { return pointerOf.asFunction(); }
610 617
611 int byteSize() { return DType.Int.byteSize; } 618 int byteSize() { return DType.Int.byteSize; }
612 619
613 override bool isSame(DType d) 620 override bool isSame(DType d)
614 { 621 {
653 super(id, actual); 660 super(id, actual);
654 } 661 }
655 662
656 override bool isFunction() { return true; } 663 override bool isFunction() { return true; }
657 override DFunction asFunction() { return this; } 664 override DFunction asFunction() { return this; }
665 bool isCallable() { return true; }
666 DFunction asCallable() { return this; }
658 667
659 override bool hasImplicitConversionTo(DType that) 668 override bool hasImplicitConversionTo(DType that)
660 { 669 {
661 return returnType.hasImplicitConversionTo(that); 670 return returnType.hasImplicitConversionTo(that);
662 } 671 }