sonygod / sharpkit

Automatically exported from code.google.com/p/sharpkit
0 stars 0 forks source link

Support for empty initialization for loop #147

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It's sometimes useful to not initialize a variable in for loops. As a 
simplified example:

var offset = new Pos();
var queue = new LayoutQueue();

var poly = queue.Start();
for (; queue.HasMore(); poly = queue.Next())
{
    offset.Translate(poly);
    ....
}

if (poly.IsClosed)
{
    paintPoly(poly);
    ...
}

The SharpKit compiler refuses the for loop with:

"SharpKit.Compiler.CompilerException: Sequence contains no elements ---> 
System.InvalidOperationException: Sequence contains no elements"

I can work around it by putting in a dummy variable but it would be nice to 
have support.

Original issue reported on code.google.com by co...@gravill.com on 15 Jun 2012 at 10:42

GoogleCodeExporter commented 9 years ago
SharpKit v5 - v4.28.0000

Original comment by co...@gravill.com on 15 Jun 2012 at 10:43

GoogleCodeExporter commented 9 years ago
I'll fix it, thanks!

Original comment by DanelK...@gmail.com on 16 Jun 2012 at 6:55

GoogleCodeExporter commented 9 years ago

Original comment by DanelK...@gmail.com on 16 Jun 2012 at 12:32