Пример #1
0
        internal override void Execute(
            Array input,
            Pipe outputPipe,
            ref ArrayList resultList,
            ExecutionContext context)
        {
            this.CheckForInterrupts(context);
            Debugger debugger = context.Debugger;

            if (this._initialExpression != null)
            {
                debugger.PushStatement(this._initialExpression);
                try
                {
                    this._initialExpression.Execute(input, (Pipe)null, context);
                }
                finally
                {
                    debugger.PopStatement();
                }
            }
            while (!context.CurrentPipelineStopping)
            {
                if (this._loopExpression != null)
                {
                    debugger.PushStatement(this._loopExpression);
                    object obj;
                    try
                    {
                        obj = this._loopExpression.Execute(input, (Pipe)null, context);
                    }
                    finally
                    {
                        debugger.PopStatement();
                    }
                    if (!LanguagePrimitives.IsTrue(obj))
                    {
                        return;
                    }
                }
                try
                {
                    this._body.Execute(input, outputPipe, ref resultList, context);
                }
                catch (BreakException ex)
                {
                    if (this.MatchLabel(ex.Label))
                    {
                        return;
                    }
                    throw;
                }
                catch (ContinueException ex)
                {
                    if (!this.MatchLabel(ex.Label))
                    {
                        throw;
                    }
                }
                if (this._incrementExpression != null)
                {
                    debugger.PushStatement(this._incrementExpression);
                    try
                    {
                        this._incrementExpression.Execute(input, (Pipe)null, context);
                    }
                    finally
                    {
                        debugger.PopStatement();
                    }
                }
            }
            throw new PipelineStoppedException();
        }