예제 #1
0
 public override void ConstructForGenericStatement(ForGenericStatement node)
 {
     this.WriteIndented("for ");
     for (var i = 0; i < node.Variables.Count; i++)
     {
         this.ConstructVariableExpression(node.Variables[i]);
         if (i < node.Variables.Count - 1)
         {
             this.Write(", ");
         }
     }
     this.Write(" in ");
     for (var i = 0; i < node.Generators.Count; i++)
     {
         this.ConstructInternal(node.Generators[i]);
         if (i < node.Generators.Count - 1)
         {
             this.Write(", ");
         }
     }
     this.WriteLine(" do");
     this.Indent( );
     this.ConstructStatementList(node.Body);
     this.Outdent( );
     this.WriteIndented("end");
     if (node.HasSemicolon)
     {
         this.Write(";");
     }
 }
예제 #2
0
        protected virtual Object[] AnalyseForGenericStatement(ForGenericStatement node, params Object[] args)
        {
            foreach (VariableExpression var in node.Variables)
            {
                this.Analyse(var);
            }

            foreach (ASTNode gen in node.Generators)
            {
                this.Analyse(gen);
            }

            this.Analyse(node.Body);

            return(null);
        }
예제 #3
0
        protected virtual ASTNode FoldForGenericStatement(ForGenericStatement node, params Object[] args)
        {
            node.SetVariables(this.FoldNodeList(node.Variables));
            node.SetGenerators(this.FoldNodeList(node.Generators));

            if (node.Variables.Count == 0 || node.Generators.Count == 0)
            {
                throw new Exception("Cannot have a generic for without variables or generators.");
            }
            if (node.Body == null)
            {
                throw new Exception("Cannot have a generic for with a null body.");
            }
            node.SetBody(this.FoldStatementList(node.Body));

            return(node);
        }
예제 #4
0
 protected override ASTNode FoldForGenericStatement(ForGenericStatement node, params Object[] args)
 {
     node.SetBody(( StatementList )this.Fold(node.Body));
     return(node);
 }
예제 #5
0
 public abstract void ConstructForGenericStatement(ForGenericStatement node);