Exemplo n.º 1
0
        public CodeStatement Foreach(CodeExpression exp, CodeExpression list, Action xlatLoopBody)
        {
            var c = new CodeForeachStatement(exp, list);

            Scope.Add(c);
            var old = Scope;

            Scope = c.Statements;
            xlatLoopBody();
            Scope = old;
            return(c);
        }
Exemplo n.º 2
0
 public int VisitForeach(CodeForeachStatement f)
 {
     writer.Write("foreach");
     writer.Write(" (");
     writer.Write("var");
     writer.Write(" ");
     f.Variable.Accept(expWriter);
     writer.Write(" ");
     writer.Write("in");
     writer.Write(" ");
     f.Collection.Accept(expWriter);
     writer.Write(")");
     WriteStatements(f.Statements);
     writer.WriteLine();
     return(0);
 }