comparison sema/DType.d @ 160:6cb2f4201e2a

Improved static arrays Here is a list of some stuff that works char[3] s = "hey" char[3] s2 = s; s2[1] = 98 // no support for chars, but 98 = 'b' :) int[2] i; i[0] = 2; Still can't pass static arrays to functions
author Anders Halager <halager@gmail.com>
date Tue, 22 Jul 2008 13:29:20 +0200
parents 6e6355fb5f0f
children dc9bf56b7ace
comparison
equal deleted inserted replaced
159:a2d9121d6dff 160:6cb2f4201e2a
96 difference in the lower bits of their hashes. 96 difference in the lower bits of their hashes.
97 */ 97 */
98 hash_t toHash() 98 hash_t toHash()
99 { 99 {
100 return cast(hash_t)(cast(void*)this); 100 return cast(hash_t)(cast(void*)this);
101 }
102
103 char[] toString()
104 {
105 return id;
101 } 106 }
102 107
103 char[] name() { return id; } 108 char[] name() { return id; }
104 SourceLocation getLoc() { return loc; } 109 SourceLocation getLoc() { return loc; }
105 int byteSize() { return 0; } 110 int byteSize() { return 0; }
471 476
472 class DStaticArray : DType 477 class DStaticArray : DType
473 { 478 {
474 this(DType arrayOf, int size, DType actual = null) 479 this(DType arrayOf, int size, DType actual = null)
475 { 480 {
476 super(id, actual); 481 super(arrayOf.id ~ "[" ~ Integer.toString(size) ~ "]", actual);
477 this.arrayOf = arrayOf; 482 this.arrayOf = arrayOf;
478 this.size = size; 483 this.size = size;
479 } 484 }
480 485
481 override bool isStaticArray() { return true; } 486 override bool isStaticArray() { return true; }