Mercurial > projects > dang
diff ast/Exp.d @ 136:2be29b296081
Lots of changes:
- Parsing classes and interfaces
- Fixed some seg faults in sema
- Supporting "private" to some extend
- And a lot of other small fixes
author | johnsen@johnsen-laptop |
---|---|
date | Fri, 11 Jul 2008 21:47:57 +0200 |
parents | ed815b31479b |
children | a22e3663de89 |
line wrap: on
line diff
--- a/ast/Exp.d Wed Jul 09 13:38:11 2008 +0200 +++ b/ast/Exp.d Fri Jul 11 21:47:57 2008 +0200 @@ -25,6 +25,7 @@ Index, Identifier, ArrayIdentifier, + StaticArrayIdentifier, PointerIdentifier, AssignExp, CallExp, @@ -458,8 +459,8 @@ override DType type() { DType type = target.type(); - if (type.isArray()) - return type.asArray().arrayOf; + if (type.isStaticArray()) + return type.asStaticArray().arrayOf; else if (type.isPointer()) return type.asPointer().pointerOf; else assert(0, "Can only index pointers and arrays"); @@ -542,11 +543,11 @@ Identifier pointerOf; } -class ArrayIdentifier : Identifier +class StaticArrayIdentifier : Identifier { this(Identifier arrayOf, IntegerLit size) { - super(ExpType.ArrayIdentifier, arrayOf.loc); + super(ExpType.StaticArrayIdentifier, arrayOf.loc); this.arrayOf = arrayOf; this.size = Integer.parse(size.get); this.name = arrayOf.name; @@ -554,7 +555,7 @@ override DType type() { - return arrayOf.type.getAsArray(size); + return arrayOf.type.getAsStaticArray(size); } Identifier arrayOf; @@ -563,6 +564,25 @@ private DType myType; } +class ArrayIdentifier : Identifier +{ + this(Identifier arrayOf) + { + super(ExpType.ArrayIdentifier, arrayOf.loc); + this.arrayOf = arrayOf; + this.name = arrayOf.name; + } + + override DType type() + { + return arrayOf.type.getAsArray(); + } + + Identifier arrayOf; + + private DType myType; +} + class Identifier : Exp { this(SLoc loc, char[] name)