Exemple #1
0
 public override void CodeGen(OutputContext output)
 {
     Name.Print(output);
     if (Value != null)
     {
         output.Space();
         output.Print("=");
         output.Space();
         var p    = output.Parent(1);
         var noin = p is AstFor || p is AstForIn;
         output.ParenthesizeForNoin(Value, noin);
     }
 }
Exemple #2
0
        public override void CodeGen(OutputContext output)
        {
            output.Print("for");
            output.Space();
            output.Print("(");
            if (Init != null)
            {
                if (Init is AstDefinitions)
                {
                    Init.Print(output);
                }
                else
                {
                    output.ParenthesizeForNoin(Init, true);
                }

                output.Print(";");
                output.Space();
            }
            else
            {
                output.Print(";");
            }

            if (Condition != null)
            {
                Condition.Print(output);
                output.Print(";");
                output.Space();
            }
            else
            {
                output.Print(";");
            }

            if (Step != null)
            {
                Step.Print(output);
            }

            output.Print(")");
            output.Space();
            output.PrintBody(Body);
        }