Browse Source

[CodeIssues] Don't consider empty catches redundant.

newNRvisualizers
Simon Lindgren 14 years ago
parent
commit
713b88f963
  1. 2
      ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCatchIssue.cs
  2. 6
      ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantCatchTests.cs

2
ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCatchIssue.cs

@ -125,7 +125,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring @@ -125,7 +125,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
{
var firstStatement = catchClause.Body.Statements.FirstOrNullObject();
if (firstStatement.IsNull) {
return true;
return false;
}
var throwStatement = firstStatement as ThrowStatement;
if (throwStatement == null) {

6
ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantCatchTests.cs

@ -152,11 +152,7 @@ class A @@ -152,11 +152,7 @@ class A
}";
TestRefactoringContext context;
var issues = GetIssues(new RedundantCatchIssue(), input, out context);
Assert.AreEqual(1, issues.Count);
CheckFix(context, issues, BaseInput + @"
}
}");
Assert.AreEqual(0, issues.Count);
}
[Test]

Loading…
Cancel
Save