示例#1
0
        public void Visit(SteSwitchCase code)
        {
            TextComposer.AppendAtNewLine("switch (");

            code.SwitchExpression.AcceptVisitor(this);

            TextComposer
            .AppendLine(")")
            .AppendLine("{")
            .IncreaseIndentation();

            foreach (var item in code.CasesList)
            {
                item.AcceptVisitor(this);
            }

            if (code.DefaultCode != null)
            {
                TextComposer.AppendLineAtNewLine("default:").IncreaseIndentation();
                code.DefaultCode.AcceptVisitor(this);
                TextComposer.AppendLineAtNewLine("break;");
            }

            TextComposer
            .DecreaseIndentation()
            .AppendLineAtNewLine("}");
        }
示例#2
0
        public void Visit(TccTryCatchItem code)
        {
            TextComposer.AppendLineAtNewLine("catch (");

            code.CatchException.AcceptVisitor(this);

            TextComposer
            .AppendLine(")")
            .AppendLine("{")
            .IncreaseIndentation();

            code.CatchCode.AcceptVisitor(this);

            TextComposer
            .DecreaseIndentation()
            .AppendLineAtNewLine("}");
        }
示例#3
0
        public void Visit(TccSwitchCaseItem code)
        {
            TextComposer.AppendAtNewLine("case ");

            code.CaseValue.AcceptVisitor(this);

            TextComposer.AppendLine(":").IncreaseIndentation();

            code.CaseCode.AcceptVisitor(this);

            if (code.BreakCase)
            {
                TextComposer.AppendLineAtNewLine("break;");
            }

            TextComposer.DecreaseIndentation();
        }
示例#4
0
        public void Visit(SteTryCatch code)
        {
            TextComposer
            .AppendLineAtNewLine("try")
            .AppendLine("{")
            .IncreaseIndentation();

            code.TryCode.AcceptVisitor(this);

            TextComposer
            .DecreaseIndentation()
            .AppendLineAtNewLine("}");

            if (code.CatchItems.Count == 0)
            {
                TextComposer
                .AppendLineAtNewLine("catch")
                .AppendLine("{")
                .AppendLine("}");
            }
            else
            {
                foreach (var item in code.CatchItems)
                {
                    item.AcceptVisitor(this);
                }
            }

            if (code.FinallyCode != null)
            {
                TextComposer
                .AppendLineAtNewLine("finally")
                .AppendLine("{")
                .IncreaseIndentation();

                code.FinallyCode.AcceptVisitor(this);

                TextComposer
                .DecreaseIndentation()
                .AppendLineAtNewLine("}");
            }
        }
 internal void GenerateEndRegion()
 {
     TextComposer.AppendLineAtNewLine(@"#endregion");
 }
 internal void GenerateBeginRegion(string regionText)
 {
     TextComposer.AppendLineAtNewLine(@"#region " + regionText);
 }