Exemple #1
0
        public override void GenerateJavaScript(JSContext context, System.IO.TextWriter textWriter)
        {
            context.Indentation++;
            textWriter.Write("for (var ");
            _assignment.GenerateJavaScript(context, textWriter);
            textWriter.Write(" ");

            GeneratorHelper.GenerateNode(context, textWriter, _assignment.Variable);

            if (_step > 0)
            {
                textWriter.Write("<=");
            }
            else if (_step < 0)
            {
                textWriter.Write(">=");
            }
            else
            {
                throw new BasicSyntaxErrorException("A step amount of 0 is not allowed.");
            }


            _upperBound.GenerateJavaScript(context, textWriter);
            textWriter.Write("; ");
            GeneratorHelper.GenerateNode(context, textWriter, _assignment.Variable);
            textWriter.Write(" += " + _step);

            textWriter.Write(") {");
        }
Exemple #2
0
 public override void GenerateJavaScript(JSContext context, System.IO.TextWriter textWriter)
 {
     context.Indentation++;
     textWriter.Write("while (");
     _condition.GenerateJavaScript(context, textWriter);
     textWriter.Write(") {");
 }