Mercurial > projects > dang
diff sema/DType.d @ 81:110c7e1c4ca2 new_gen
Now you can declare array
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Fri, 02 May 2008 18:23:33 +0200 |
parents | 682e20aa224f |
children | 9e90694f5da0 |
line wrap: on
line diff
--- a/sema/DType.d Fri May 02 17:33:50 2008 +0200 +++ b/sema/DType.d Fri May 02 18:23:33 2008 +0200 @@ -98,6 +98,14 @@ return myPointer; } + DArray getAsArray(int size) + { + if(size in myArray) + return myArray[size]; + myArray[size] = new DArray(this, size); + return myArray[size]; + } + static DInteger Bool, Byte, UByte, Short, UShort, @@ -106,6 +114,7 @@ static DType Void; private DPointer myPointer; + private DArray[int] myArray; static this() { @@ -199,18 +208,20 @@ class DArray : DType { - this(DType arrayOf, DType actual = null) + this(DType arrayOf, int size, DType actual = null) { super(id, actual); this.arrayOf = arrayOf; + this.size = size; } override bool isArray() { return true; } override DArray asArray() { return this; } - int byteSize() { return arrayOf.byteSize; } + int byteSize() { return arrayOf.byteSize * size; } DType arrayOf; + const int size; } class DPointer : DType