Skip to content

Commit

Permalink
Simplify.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanLarsson committed Apr 26, 2020
1 parent 002ab9c commit c14d313
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions ReflectionAnalyzers/Helpers/NameOf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ member.Symbol is ITypeSymbol ||
return true;
}

targetName = context.SemanticModel.IsAccessible(context.Node.SpanStart, member.Symbol)
? $"{TypeOfString(member.Symbol.ContainingType)}.{member.Symbol.Name}"
: $"\"{member.Symbol.Name}\"";
targetName = $"{TypeOfString(member.Symbol.ContainingType)}.{member.Symbol.Name}";
return true;

string TypeOfString(ITypeSymbol t)
Expand Down
3 changes: 1 addition & 2 deletions ReflectionAnalyzers/NodeAnalzers/GetXAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,7 @@ private static bool ShouldUseNameof(ReflectedMember member, Name name, SyntaxNod
literal.IsKind(SyntaxKind.StringLiteralExpression) &&
member.Symbol is { } &&
IsMatch() &&
NameOf.TryGetExpressionText(member, context, out var expressionText) &&
!expressionText.StartsWith("\"", StringComparison.OrdinalIgnoreCase))
NameOf.TryGetExpressionText(member, context, out var expressionText))
{
nameText = $"nameof({expressionText})";
location = literal.GetLocation();
Expand Down

0 comments on commit c14d313

Please sign in to comment.