Mercurial > projects > dang
diff sema/DType.d @ 83:9e90694f5da0 new_gen
Parse array indexing, and allow reading from arrays
author | Anders Halager <halager@gmail.com> |
---|---|
date | Fri, 02 May 2008 19:54:22 +0200 |
parents | 110c7e1c4ca2 |
children | eb5b2c719a39 |
line wrap: on
line diff
--- a/sema/DType.d Fri May 02 19:51:58 2008 +0200 +++ b/sema/DType.d Fri May 02 19:54:22 2008 +0200 @@ -50,10 +50,6 @@ /// Return a DInteger if this is one, otherwise return null DInteger asInteger() { return null; } - // Is this type a DPointer - //bool isPointer() { return false; } - // DPointer asPointer() { return null; } - int opEquals(Object o) { if (auto t = cast(DType)o) @@ -90,6 +86,9 @@ */ bool hasImplicitConversionTo(DType that) { return false; } + /** + Get a type representing a pointer to this type (from int to int*) + */ DPointer getPointerTo() { if(myPointer !is null) @@ -97,7 +96,11 @@ myPointer = new DPointer(this); return myPointer; } + private DPointer myPointer; + /** + Get a type representing a static array of this type with length 'size' + */ DArray getAsArray(int size) { if(size in myArray) @@ -105,6 +108,7 @@ myArray[size] = new DArray(this, size); return myArray[size]; } + private DArray[int] myArray; static DInteger Bool, @@ -113,9 +117,6 @@ static DType Void; - private DPointer myPointer; - private DArray[int] myArray; - static this() { Void = new DType("void");