Exemplo n.º 1
0
        public override void GenerateJavaScript(JSContext context, System.IO.TextWriter textWriter)
        {
            if (LineTypes == LineTypes.None)
            {
                throw new ApplicationException("Line type not set for line " + LineNumber);
            }

            if ((LineTypes & LineTypes.FunctionStart) > 0)
            {
                textWriter.Write(context.IndentationText);
                textWriter.WriteLine("function line" + LineNumber + "() {");
                context.Indentation++;
            }


            textWriter.Write(context.IndentationText);
            StatementList.GenerateJavaScript(context, textWriter);
            textWriter.WriteLine();

            if ((LineTypes & LineTypes.FunctionEnd) > 0)
            {
                if (!string.IsNullOrEmpty(ReturnText))
                {
                    textWriter.Write(context.IndentationText);
                    textWriter.WriteLine(ReturnText);
                }
                context.Indentation--;
                textWriter.Write(context.IndentationText);
                textWriter.WriteLine("}");
            }
        }