private static bool RequiresInnerExceptionPassing(ThrowStatementModel throwStatementModel)
        {
            if (!throwStatementModel.IsDirectExceptionInstantiation)
            {
                return(false);
            }

            if (throwStatementModel.IsRethrow)
            {
                return(false);
            }

            var outerCatchClause = throwStatementModel.FindOuterCatchClause();

            if (outerCatchClause == null)
            {
                return(false);
            }

            if (!outerCatchClause.IsExceptionTypeSpecified)
            {
                return(true);
            }

            if (!outerCatchClause.HasVariable)
            {
                return(true);
            }

            return(!throwStatementModel.IsInnerExceptionPassed(outerCatchClause.Variable.VariableName.Name));
        }
 /// <summary>Performs analyze of throw <paramref name="throwStatement"/>.</summary>
 /// <param name="throwStatement">Throw statement model to analyze.</param>
 public override void Visit(ThrowStatementModel throwStatement)
 {
     if (throwStatement != null && RequiresInnerExceptionPassing(throwStatement))
     {
         var highlighting = new ThrowFromCatchWithNoInnerExceptionHighlighting(throwStatement);
         ServiceLocator.StageProcess.AddHighlighting(highlighting, throwStatement.DocumentRange);
     }
 }
 /// <summary>Performs analyze of throw <paramref name="throwStatement"/>.</summary>
 /// <param name="throwStatement">Throw statement model to analyze.</param>
 public override void Visit(ThrowStatementModel throwStatement)
 {
     if (throwStatement != null && RequiresInnerExceptionPassing(throwStatement))
     {
         var highlighting = new ThrowFromCatchWithNoInnerExceptionHighlighting(throwStatement);
         ServiceLocator.StageProcess.AddHighlighting(highlighting, throwStatement.DocumentRange);
     }
 }
        private static bool RequiresInnerExceptionPassing(ThrowStatementModel throwStatementModel)
        {
            if (!throwStatementModel.IsDirectExceptionInstantiation)
                return false;

            if (throwStatementModel.IsRethrow)
                return false;

            var outerCatchClause = throwStatementModel.FindOuterCatchClause();
            if (outerCatchClause == null)
                return false;

            if (!outerCatchClause.IsExceptionTypeSpecified)
                return true;

            if (!outerCatchClause.HasVariable)
                return true;

            return !throwStatementModel.IsInnerExceptionPassed(outerCatchClause.Variable.VariableName.Name);
        }
 /// <summary>Initializes a new instance of the <see cref="ThrowFromCatchWithNoInnerExceptionHighlighting"/> class. </summary>
 /// <param name="throwStatement">The throw statement. </param>
 internal ThrowFromCatchWithNoInnerExceptionHighlighting(ThrowStatementModel throwStatement)
 {
     ThrowStatement = throwStatement;
 }
Пример #6
0
 /// <summary>Performs analyze of throw <paramref name="throwStatement"/>.</summary>
 /// <param name="throwStatement">Throw statement model to analyze.</param>
 public virtual void Visit(ThrowStatementModel throwStatement)
 {
 }
 /// <summary>Initializes a new instance of the <see cref="ThrowFromCatchWithNoInnerExceptionHighlighting"/> class. </summary>
 /// <param name="throwStatement">The throw statement. </param>
 internal ThrowFromCatchWithNoInnerExceptionHighlighting(ThrowStatementModel throwStatement)
 {
     ThrowStatement = throwStatement;
 }
 /// <summary>Performs analyze of throw <paramref name="throwStatement"/>.</summary>
 /// <param name="throwStatement">Throw statement model to analyze.</param>
 public virtual void Visit(ThrowStatementModel throwStatement)
 {
 }