diff trunk/src/dil/ast/Types.d @ 689:8e38774d562b

Added some methods to ArrayType.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Tue, 22 Jan 2008 14:59:12 +0100
parents 1ae72234db26
children 19a34b69cc7d
line wrap: on
line diff
--- a/trunk/src/dil/ast/Types.d	Tue Jan 22 14:37:46 2008 +0100
+++ b/trunk/src/dil/ast/Types.d	Tue Jan 22 14:59:12 2008 +0100
@@ -138,7 +138,7 @@
 /// Associative array: T[T]
 class ArrayType : TypeNode
 {
-  Expression e, e2;
+  Expression e1, e2;
   TypeNode assocType;
 
   this(TypeNode t)
@@ -147,12 +147,12 @@
     mixin(set_kind);
   }
 
-  this(TypeNode t, Expression e, Expression e2)
+  this(TypeNode t, Expression e1, Expression e2)
   {
     this(t);
-    addChild(e);
+    addChild(e1);
     addOptChild(e2);
-    this.e = e;
+    this.e1 = e1;
     this.e2 = e2;
   }
 
@@ -162,6 +162,26 @@
     addChild(assocType);
     this.assocType = assocType;
   }
+
+  bool isDynamic()
+  {
+    return !assocType && !e1;
+  }
+
+  bool isStatic()
+  {
+    return e1 && !e2;
+  }
+
+  bool isSlice()
+  {
+    return e1 && e2;
+  }
+
+  bool isAssociative()
+  {
+    return assocType !is null;
+  }
 }
 
 /// ReturnType "function" "(" Parameters? ")"