diff dmd/SliceExp.d @ 12:832f71e6f96c

*Exp and *AssignExp arrayOp implementation added (might be a bit incomplete) Some unittest-specific functions implemented
author korDen
date Mon, 12 Apr 2010 15:13:00 +0400
parents 10317f0c89a5
children a8b50ff7f201
line wrap: on
line diff
--- a/dmd/SliceExp.d	Wed Mar 31 16:29:36 2010 +0400
+++ b/dmd/SliceExp.d	Mon Apr 12 15:13:00 2010 +0400
@@ -3,6 +3,10 @@
 import dmd.Expression;
 import dmd.backend.elem;
 import dmd.UnaExp;
+import dmd.Identifier;
+import dmd.IdentifierExp;
+import dmd.ArrayExp;
+import dmd.STC;
 import dmd.InterState;
 import dmd.ScopeDsymbol;
 import dmd.WANT;
@@ -444,12 +448,21 @@
 
 	void buildArrayIdent(OutBuffer buf, Expressions arguments)
 	{
-		assert(false);
+		buf.writestring("Slice");
+		arguments.shift(cast(void*)this);
 	}
 
 	Expression buildArrayLoop(Arguments fparams)
 	{
-		assert(false);
+		Identifier id = Identifier.generateId("p", fparams.dim);
+		Argument param = new Argument(STCconst, type, id, null);
+		fparams.shift(cast(void*)param);
+		Expression e = new IdentifierExp(Loc(0), id);
+		Expressions arguments = new Expressions();
+		Expression index = new IdentifierExp(Loc(0), Id.p);
+		arguments.push(cast(void*)index);
+		e = new ArrayExp(Loc(0), e, arguments);
+		return e;
 	}
 
 	int inlineCost(InlineCostState* ics)