private DekiScriptExpressionEvaluationState(DekiScriptEnv env, DekiScriptRuntime runtime, XmlNamespaceManager namespaces, DekiScriptOutputBuffer buffer, SharedState sharedState)
 {
     this.Env        = env;
     this.Namespaces = namespaces;
     this.Buffer     = buffer;
     this.Runtime    = runtime;
     _sharedState    = sharedState;
 }
 //--- Constructor ---
 public DekiScriptExpressionEvaluationState(DekiScriptEvalMode mode, DekiScriptEnv env, DekiScriptRuntime runtime, TimeSpan evaluationTimeout, int maxOutputBufferSize)
 {
     this.Env          = env;
     this.Namespaces   = new XmlNamespaceManager(XDoc.XmlNameTable);
     this.Buffer       = new DekiScriptOutputBuffer(maxOutputBufferSize);
     this.Runtime      = runtime;
     _sharedState      = new SharedState();
     _sharedState.Safe = (mode == DekiScriptEvalMode.EvaluateSafeMode);
     if (evaluationTimeout == TimeSpan.MaxValue)
     {
         return;
     }
     _sharedState.EvaluationTimeout = evaluationTimeout;
     _sharedState.EvaluationTimer   = Stopwatch.StartNew();
 }
        public DekiScriptExpression Visit(DekiScriptSequence expr, DekiScriptExpressionEvaluationState state)
        {
            return(expr);

#if false
            var mode = state.Mode;
            var env  = state.Env;
            if (expr.Kind != DekiScriptSequence.ScopeKind.None)
            {
                env = env.NewLocalScope();
            }
            bool safe = env.IsSafeMode;

            // loop over all expressions and accumulate as many as possible
            var accumulator = new DekiScriptOutputBuffer();
            List <DekiScriptExpression> list = new List <DekiScriptExpression>(expr.List.Length);
            foreach (DekiScriptExpression expression in expr.List)
            {
                DekiScriptExpression value = expression.VisitWith(this, new DekiScriptExpressionEvaluationState(mode, env));

                // check if we can continue to accumulate the values
                if ((accumulator != null) && value is DekiScriptLiteral)
                {
                    accumulator.Append((DekiScriptLiteral)value);
                }
                else
                {
                    // check if the accumulator contains a value to add to the list
                    if (accumulator != null)
                    {
                        list.Add(accumulator.GetResult(safe));
                        accumulator = null;
                    }

                    // check if value is worthile keeping
                    if (!(value is DekiScriptNil))
                    {
                        list.Add(value);
                    }
                }
            }
            if (accumulator != null)
            {
                return(accumulator.GetResult(safe));
            }
            return(DekiScriptSequence.New(expr.Kind, list.ToArray()));
#endif
        }