Skip to content

Commit

Permalink
Revert "Fix #CC0060."
Browse files Browse the repository at this point in the history
This reverts commit 50ea8e0.
  • Loading branch information
kindermannhubert committed Jan 16, 2017
1 parent 50ea8e0 commit 8a8dc0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Microsoft.CodeAnalysis;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using System.Collections.Immutable;
using System.Linq;

namespace CodeCracker.CSharp.Usage
{
Expand Down Expand Up @@ -33,7 +33,7 @@ private static void AnalyzeNode(SyntaxNodeAnalysisContext context)
var ctor = (ConstructorDeclarationSyntax)context.Node;
if (!ctor.Modifiers.Any(m => m.IsKind(SyntaxKind.PublicKeyword))) return;

var @class = ctor.Ancestors().FirstOrDefault() as ClassDeclarationSyntax;
var @class = ctor.Ancestors().OfType<ClassDeclarationSyntax>().FirstOrDefault();
if (@class == null) return;
if (!@class.Modifiers.Any(m => m.IsKind(SyntaxKind.AbstractKeyword))) return;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using CodeCracker.CSharp.Usage;
using System.Threading.Tasks;
using CodeCracker.CSharp.Usage;
using Microsoft.CodeAnalysis;
using System.Threading.Tasks;
using Xunit;

namespace CodeCracker.Test.CSharp.Usage
Expand Down Expand Up @@ -66,26 +66,6 @@ private Foo() { /* .. */ }
await VerifyCSharpHasNoDiagnosticsAsync(test);
}

[Fact]
public async Task IgnoresCtorOfStructNestedInAbstractClasses()
{
const string test = @"
public abstract class C
{
public struct S
{
private int x;
public S(int x)
{
this.x = x;
}
}
}";

await VerifyCSharpHasNoDiagnosticsAsync(test);
}

[Fact]
public async Task FixReplacesPublicWithProtectedModifierInAbstractClasses()
{
Expand Down

0 comments on commit 8a8dc0e

Please sign in to comment.