diff dmd/UnrolledLoopStatement.d @ 56:51605de93870

TupleExp.optimize UnrolledLoopStatement.ctor UnrolledLoopStatement.semantic UnrolledLoopStatement.blockExit OrOrExp.checkSideEffect FuncExp.syntaxCopy FuncLiteralDeclaration.syntaxCopy WhileStatement.hasBreak StructInitializer.toExpression StructLiteralExp.ctor StructLiteralExp.optimize BinExp.commonSemanticAssign ModAssignExp.opId Argument.isLazyArray CommaExp.implicitConvTo CommaExp.castTo TypeClass.isBaseOf createTypeInfoArray TypeTuple.getTypeInfoDeclaration TypeInfoTupleDeclaration.ctor TypeNext.constConv XorExp.implicitConvTo TemplateParameter.isTemplateValueParameter
author korDen
date Sat, 21 Aug 2010 14:16:53 +0400
parents 10317f0c89a5
children cab4c37afb89
line wrap: on
line diff
--- a/dmd/UnrolledLoopStatement.d	Sat Aug 21 13:28:16 2010 +0400
+++ b/dmd/UnrolledLoopStatement.d	Sat Aug 21 14:16:53 2010 +0400
@@ -18,10 +18,10 @@
 {
 	Statements statements;
 
-	this(Loc loc, Statements statements)
+	this(Loc loc, Statements s)
 	{
-		assert(false);
-		super(loc);
+		super(loc);
+		statements = s;
 	}
 
 	Statement syntaxCopy()
@@ -31,7 +31,26 @@
 
 	Statement semantic(Scope sc)
 	{
-		assert(false);
+		//printf("UnrolledLoopStatement.semantic(this = %p, sc = %p)\n", this, sc);
+
+		sc.noctor++;
+		Scope scd = sc.push();
+		scd.sbreak = this;
+		scd.scontinue = this;
+
+		for (size_t i = 0; i < statements.dim; i++)
+		{
+			Statement s = cast(Statement) statements.data[i];
+			if (s)
+			{
+				s = s.semantic(scd);
+				statements.data[i] = cast(void*)s;
+			}
+		}
+
+		scd.pop();
+		sc.noctor--;
+		return this;
 	}
 
 	bool hasBreak()
@@ -51,7 +70,17 @@
 
 	BE blockExit()
 	{
-		assert(false);
+		BE result = BEfallthru;
+		for (size_t i = 0; i < statements.dim; i++)
+		{	
+			Statement s = cast(Statement) statements.data[i];
+			if (s)
+			{
+				int r = s.blockExit();
+				result |= r & ~(BEbreak | BEcontinue);
+			}
+		}
+		return result;
 	}
 
 	bool comeFrom()