Пример #1
0
        public override void VisitElseClause(ElseClause node)
        {
            NewLine();
            Append("else");

            var isIf = node.Body is IfStatement;

            if (!isIf)
            {
                NewLine();
                Append("{");
                Indent();
                NewLine();
            }
            else
            {
                Append(" ");
            }

            node.Body.Accept(this);

            if (!isIf)
            {
                Outdent();
                Append("}");
            }
        }
Пример #2
0
        public IfStatement(Node condition, Node body, ElseClause elseClause)
        {
            Condition  = condition;
            Body       = body;
            ElseClause = elseClause;

            SetParent(Condition);
            SetParent(Body);
            SetParent(ElseClause);
        }