Beispiel #1
0
        public ScriptPrinter Write(ScriptNode node)
        {
            if (node != null)
            {
                bool pushedWhileLoop = false;
                if (node is ScriptLoopStatementBase)
                {
                    _isWhileLoop.Push(node is ScriptWhileStatement);
                    pushedWhileLoop = true;
                }
                try
                {
                    WriteBegin(node);

                    // Reset comma before node
                    if (node is IScriptTerminal)
                    {
                        _hasComma = false;
                    }

                    node.PrintTo(this);
                    WriteEnd(node);
                }
                finally
                {
                    if (pushedWhileLoop)
                    {
                        _isWhileLoop.Pop();
                    }
                }
            }
            return(this);
        }