Mercurial > projects > dang
comparison ast/Exp.d @ 185:7b274cfdc1dc
Added support for array literals. Codegen is broken, though.
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Fri, 25 Jul 2008 12:18:05 +0200 |
parents | 8ea749b7da91 |
children | fda35d57847e |
comparison
equal
deleted
inserted
replaced
184:86a2ede00e9a | 185:7b274cfdc1dc |
---|---|
34 IdentifierTypeExp, | 34 IdentifierTypeExp, |
35 ArrayTypeExp, | 35 ArrayTypeExp, |
36 StaticArrayTypeExp, | 36 StaticArrayTypeExp, |
37 PointerTypeExp, | 37 PointerTypeExp, |
38 FunctionTypeExp, | 38 FunctionTypeExp, |
39 ArrayLiteralExp, | |
39 } | 40 } |
40 | 41 |
41 abstract class Exp | 42 abstract class Exp |
42 { | 43 { |
43 this(ExpType expType, SLoc loc) | 44 this(ExpType expType, SLoc loc) |
745 VarDecl[] decls; | 746 VarDecl[] decls; |
746 IdentifierTypeExp returnType; | 747 IdentifierTypeExp returnType; |
747 private DType myType; | 748 private DType myType; |
748 } | 749 } |
749 | 750 |
751 class ArrayLiteralExp : Exp | |
752 { | |
753 this(Exp[] exps, SLoc begin, SLoc end) | |
754 { | |
755 super(ExpType.ArrayLiteralExp, begin); | |
756 this.exps = exps; | |
757 this.begin = begin; | |
758 this.end = end; | |
759 } | |
760 | |
761 override DType type() | |
762 { | |
763 return exps[0].type.getAsStaticArray(exps.length); | |
764 } | |
765 | |
766 Exp[] exps; | |
767 SLoc begin, end; | |
768 } | |
769 |