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;
}