Skip to content

Commit

Permalink
Added missing assertion; reduced type accessibility; removed unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart Koelman authored and Bart Koelman committed Jul 5, 2018
1 parent 4fb228c commit 7bbf4c3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace CSharpGuidelinesAnalyzer.Test
{
public abstract class CSharpGuidelinesAnalysisTestFixture : AnalysisTestFixture
{
protected void VerifyGuidelineDiagnostic([NotNull] ParsedSourceCode source,
private protected void VerifyGuidelineDiagnostic([NotNull] ParsedSourceCode source,
[NotNull] [ItemNotNull] params string[] messages)
{
Guard.NotNull(source, nameof(source));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace CSharpGuidelinesAnalyzer.Test
{
public sealed class ParsedSourceCode
internal sealed class ParsedSourceCode
{
[NotNull]
public AnalyzerTestContext TestContext { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace CSharpGuidelinesAnalyzer.Test.TestDataBuilders
{
public interface ITestDataBuilder<out T>
internal interface ITestDataBuilder<out T>
{
[NotNull]
// ReSharper disable once UnusedMemberInSuper.Global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public override IdentifierInfo VisitLocalReference([NotNull] ILocalReferenceOper
{
var name = new IdentifierName(operation.Local.Name,
operation.Local.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat));
return new IdentifierInfo(name, operation.Local.Type, "Variable");
return new IdentifierInfo(name, operation.Local.Type);
}

[NotNull]
Expand All @@ -36,7 +36,7 @@ public override IdentifierInfo VisitParameterReference([NotNull] IParameterRefer
var name = new IdentifierName(operation.Parameter.Name,
/* CSharpShortErrorMessageFormat returns 'int', ie. without parameter name */
operation.Parameter.Name);
return new IdentifierInfo(name, operation.Parameter.Type, operation.Parameter.Kind.ToString());
return new IdentifierInfo(name, operation.Parameter.Type);
}

[NotNull]
Expand Down Expand Up @@ -66,15 +66,15 @@ private IdentifierInfo CreateForMemberReferenceExpression([NotNull] IMemberRefer
{
var name = new IdentifierName(operation.Member.Name,
operation.Member.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat));
return new IdentifierInfo(name, memberType, operation.Member.Kind.ToString());
return new IdentifierInfo(name, memberType);
}

[NotNull]
public override IdentifierInfo VisitInvocation([NotNull] IInvocationOperation operation, [CanBeNull] object argument)
{
var name = new IdentifierName(operation.TargetMethod.Name,
operation.TargetMethod.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat));
return new IdentifierInfo(name, operation.TargetMethod.ReturnType, operation.TargetMethod.GetKind());
return new IdentifierInfo(name, operation.TargetMethod.ReturnType);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@ internal sealed class IdentifierInfo
[NotNull]
public ITypeSymbol Type { get; }

[NotNull]
public string Kind { get; }

public IdentifierInfo(IdentifierName name, [NotNull] ITypeSymbol type, [NotNull] string kind)
public IdentifierInfo(IdentifierName name, [NotNull] ITypeSymbol type)
{
Guard.NotNull(type, nameof(type));
Guard.NotNullNorWhiteSpace(kind, nameof(kind));

Name = name;
Type = type;
Kind = kind;
}
}
}

0 comments on commit 7bbf4c3

Please sign in to comment.