Mercurial > projects > dil
changeset 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 | 839c0c61af2b |
children | eaf6444b6284 |
files | trunk/src/dil/ast/DefaultVisitor.d trunk/src/dil/ast/Types.d trunk/src/dil/translator/German.d |
diffstat | 3 files changed, 27 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/trunk/src/dil/ast/DefaultVisitor.d Tue Jan 22 14:37:46 2008 +0100 +++ b/trunk/src/dil/ast/DefaultVisitor.d Tue Jan 22 14:59:12 2008 +0100 @@ -303,8 +303,8 @@ visitT(t.next); if (t.assocType) visitT(t.assocType); - else if (t.e) - visitE(t.e), t.e2 && visitE(t.e2); + else if (t.e1) + visitE(t.e1), t.e2 && visitE(t.e2); } static if (is(T == FunctionType) || is(T == DelegateType)) visitT(t.returnType), visitN(t.params);
--- 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? ")"
--- a/trunk/src/dil/translator/German.d Tue Jan 22 14:37:46 2008 +0100 +++ b/trunk/src/dil/translator/German.d Tue Jan 22 14:59:12 2008 +0100 @@ -289,7 +289,7 @@ if (n.assocType) put.format("assoziative{} Array{} von ", c1, c2); // visitT(n.assocType); - else if (n.e) + else if (n.e1) { if (n.e2) put.format("gescheibte{} Array{} von ", c1, c2);