Mercurial > projects > dang
diff gen/CodeGen.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 | 08b6ce45b456 |
line wrap: on
line diff
--- a/gen/CodeGen.d Fri Jul 25 11:04:00 2008 +0200 +++ b/gen/CodeGen.d Fri Jul 25 12:18:05 2008 +0200 @@ -354,6 +354,14 @@ case ExpType.Index: auto indexExp = cast(IndexExp)exp; return loadLValue(genLValue(exp)); + case ExpType.ArrayLiteralExp: + auto arrayLiteralExp = cast(ArrayLiteralExp)exp; + Constant[] c; + foreach (a ; arrayLiteralExp.exps) + c ~= cast(Constant)genExpression(a).value; + return RValue( + ConstantArray.Get( + llvm(arrayLiteralExp.type.asStaticArray.arrayOf), c)); case ExpType.NewExp: auto newExp = cast(NewExp)exp; DClass type = newExp.newType.type().asClass();