System.Management.Pash.Implementation.ExecutionVisitor.VisitNamedBlockWithTraps C# (CSharp) Method

VisitNamedBlockWithTraps() private method

private VisitNamedBlockWithTraps ( System.Management.Automation.Language.NamedBlockAst namedBlockAst ) : AstVisitAction
namedBlockAst System.Management.Automation.Language.NamedBlockAst
return AstVisitAction
        private AstVisitAction VisitNamedBlockWithTraps(NamedBlockAst namedBlockAst)
        {
            foreach (StatementAst statement in namedBlockAst.Statements)
            {
                try
                {
                    VisitStatement(statement);
                }
                catch (FlowControlException)
                {
                    // flow control as Exit, Return, Break, and Continue doesn't concern the user and is propagated
                    throw;
                }
                catch (Exception ex)
                {
                    TrapStatementAst trapStatementAst = FindMatchingTrapStatement(namedBlockAst.Traps, ex);
                    if (trapStatementAst == null)
                    {
                        throw;
                    }

                    SetUnderscoreVariable(ex);
                    AstVisitAction visitAction = VisitTrapBody(trapStatementAst);

                    if (visitAction != AstVisitAction.Continue)
                    {
                        return AstVisitAction.SkipChildren;
                    }
                }
            }

            return AstVisitAction.SkipChildren;
        }
ExecutionVisitor