-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GH-153] - simplifying SubstituteConstructorAnalysis with operations api
- Loading branch information
Showing
3 changed files
with
50 additions
and
80 deletions.
There are no files selected for viewing
18 changes: 2 additions & 16 deletions
18
src/NSubstitute.Analyzers.CSharp/DiagnosticAnalyzers/SubstituteConstructorAnalysis.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,14 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Microsoft.CodeAnalysis; | ||
using Microsoft.CodeAnalysis.CSharp.Syntax; | ||
using NSubstitute.Analyzers.CSharp.Extensions; | ||
using Microsoft.CodeAnalysis.CSharp.Syntax; | ||
using NSubstitute.Analyzers.Shared.DiagnosticAnalyzers; | ||
|
||
namespace NSubstitute.Analyzers.CSharp.DiagnosticAnalyzers | ||
{ | ||
internal class SubstituteConstructorAnalysis : AbstractSubstituteConstructorAnalysis<InvocationExpressionSyntax, ArgumentSyntax> | ||
internal class SubstituteConstructorAnalysis : AbstractSubstituteConstructorAnalysis<InvocationExpressionSyntax> | ||
{ | ||
public static SubstituteConstructorAnalysis Instance { get; } = new SubstituteConstructorAnalysis(); | ||
|
||
private SubstituteConstructorAnalysis() | ||
{ | ||
} | ||
|
||
protected override IList<ArgumentSyntax> GetInvocationArguments(InvocationExpressionSyntax invocationExpression) | ||
{ | ||
return invocationExpression.ArgumentList?.Arguments.ToList(); | ||
} | ||
|
||
protected override IList<SyntaxNode> GetParameterExpressionsFromArrayArgument(ArgumentSyntax syntaxNode) | ||
{ | ||
return syntaxNode.Expression.GetParameterExpressionsFromArrayArgument()?.Select<ExpressionSyntax, SyntaxNode>(syntax => syntax).ToList(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 2 additions & 17 deletions
19
src/NSubstitute.Analyzers.VisualBasic/DiagnosticAnalyzers/SubstituteConstructorAnalysis.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,14 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Microsoft.CodeAnalysis; | ||
using Microsoft.CodeAnalysis.VisualBasic.Syntax; | ||
using Microsoft.CodeAnalysis.VisualBasic.Syntax; | ||
using NSubstitute.Analyzers.Shared.DiagnosticAnalyzers; | ||
using NSubstitute.Analyzers.VisualBasic.Extensions; | ||
|
||
namespace NSubstitute.Analyzers.VisualBasic.DiagnosticAnalyzers | ||
{ | ||
internal class SubstituteConstructorAnalysis : AbstractSubstituteConstructorAnalysis<InvocationExpressionSyntax, ArgumentSyntax> | ||
internal class SubstituteConstructorAnalysis : AbstractSubstituteConstructorAnalysis<InvocationExpressionSyntax> | ||
{ | ||
public static SubstituteConstructorAnalysis Instance { get; } = new SubstituteConstructorAnalysis(); | ||
|
||
private SubstituteConstructorAnalysis() | ||
{ | ||
} | ||
|
||
protected override IList<ArgumentSyntax> GetInvocationArguments(InvocationExpressionSyntax invocationExpression) | ||
{ | ||
return invocationExpression.ArgumentList?.Arguments.ToList(); | ||
} | ||
|
||
protected override IList<SyntaxNode> GetParameterExpressionsFromArrayArgument(ArgumentSyntax syntaxNode) | ||
{ | ||
return syntaxNode.GetExpression().GetParameterExpressionsFromArrayArgument()? | ||
.Select<ExpressionSyntax, SyntaxNode>(syntax => syntax).ToList(); | ||
} | ||
} | ||
} |