// // US compiler will convert *for()* statements to *while* statements (we don't want that) // This version simply calls necessary methods to ensure semantic information (aka Entities in boo/us) // for expression inside the for() body will be calculated correctly, but does not convert // for -> while // public override void OnForStatement(ForStatement node) { var method = node.GetAncestor <Method>(); var localsBeforeVisiting = (LocalCollection)method.Locals.Clone(); Visit(node.Iterator); ProcessIterator(node.Iterator, node.Declarations); VisitForStatementBlock(node); // Mark any *local* injected by the above code as *synthetic* in order to // avoid problems with some for() statemets being duplicated in the converted code foreach (var current in method.Locals) { if (!localsBeforeVisiting.Any(candidate => candidate.Matches(current))) { current.IsSynthetic = true; } } }