2 overrides of GetParameters
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
2144
public override IReadOnlyList<SyntaxNode>
GetParameters
(SyntaxNode declaration)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (1)
CodeGeneration\VisualBasicSyntaxGenerator.vb (1)
2700
Public Overrides Function
GetParameters
(declaration As SyntaxNode) As IReadOnlyList(Of SyntaxNode)
56 references to GetParameters
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\AddParameterEditor.cs (1)
28
var existingParameters = generator.
GetParameters
(declaration);
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (23)
CodeGeneration\SyntaxGeneratorTests.cs (23)
3236
Assert.Equal(0, Generator.
GetParameters
(Generator.MethodDeclaration("m")).Count);
3237
Assert.Equal(1, Generator.
GetParameters
(Generator.MethodDeclaration("m", parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count);
3238
Assert.Equal(2, Generator.
GetParameters
(Generator.MethodDeclaration("m", parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))])).Count);
3240
Assert.Equal(0, Generator.
GetParameters
(Generator.ConstructorDeclaration()).Count);
3241
Assert.Equal(1, Generator.
GetParameters
(Generator.ConstructorDeclaration(parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count);
3242
Assert.Equal(2, Generator.
GetParameters
(Generator.ConstructorDeclaration(parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))])).Count);
3247
Assert.Equal(0, Generator.
GetParameters
(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("expr"))).Count);
3248
Assert.Equal(1, Generator.
GetParameters
(Generator.ValueReturningLambdaExpression("p1", Generator.IdentifierName("expr"))).Count);
3250
Assert.Equal(0, Generator.
GetParameters
(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("expr"))).Count);
3251
Assert.Equal(1, Generator.
GetParameters
(Generator.VoidReturningLambdaExpression("p1", Generator.IdentifierName("expr"))).Count);
3253
Assert.Equal(0, Generator.
GetParameters
(Generator.DelegateDeclaration("d")).Count);
3254
Assert.Equal(1, Generator.
GetParameters
(Generator.DelegateDeclaration("d", parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count);
3256
Assert.Equal(0, Generator.
GetParameters
(Generator.ClassDeclaration("c")).Count);
3257
Assert.Equal(0, Generator.
GetParameters
(Generator.IdentifierName("x")).Count);
3263
Assert.Equal(1, Generator.
GetParameters
(Generator.AddParameters(Generator.MethodDeclaration("m"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count);
3264
Assert.Equal(1, Generator.
GetParameters
(Generator.AddParameters(Generator.ConstructorDeclaration(), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count);
3267
Assert.Equal(1, Generator.
GetParameters
(Generator.AddParameters(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("expr")), [Generator.LambdaParameter("p")])).Count);
3268
Assert.Equal(1, Generator.
GetParameters
(Generator.AddParameters(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("expr")), [Generator.LambdaParameter("p")])).Count);
3270
Assert.Equal(1, Generator.
GetParameters
(Generator.AddParameters(Generator.DelegateDeclaration("d"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count);
3272
Assert.Equal(1, Generator.
GetParameters
(Generator.AddParameters(Generator.ClassDeclaration("c"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count);
3273
Assert.Equal(1, Generator.
GetParameters
(Generator.AddParameters(Generator.StructDeclaration("c"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count);
3274
Assert.Equal(1, Generator.
GetParameters
(Generator.AddParameters(Generator.InterfaceDeclaration("c"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count);
3275
Assert.Equal(0, Generator.
GetParameters
(Generator.AddParameters(Generator.IdentifierName("x"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count);
Microsoft.CodeAnalysis.Features (2)
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
144
var parameterNodes = (IReadOnlyList<TParameterSyntax>)generator.
GetParameters
(functionDeclaration);
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (1)
76
var parameterNodes = generator.
GetParameters
(functionDeclaration);
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (26)
CodeGeneration\SyntaxGeneratorTests.vb (26)
2836
Assert.Equal(0, Generator.
GetParameters
(Generator.MethodDeclaration("m")).Count)
2837
Assert.Equal(1, Generator.
GetParameters
(Generator.MethodDeclaration("m", parameters:={Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count)
2838
Assert.Equal(2, Generator.
GetParameters
(Generator.MethodDeclaration("m", parameters:={Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))})).Count)
2840
Assert.Equal(0, Generator.
GetParameters
(Generator.ConstructorDeclaration()).Count)
2841
Assert.Equal(1, Generator.
GetParameters
(Generator.ConstructorDeclaration(parameters:={Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count)
2842
Assert.Equal(2, Generator.
GetParameters
(Generator.ConstructorDeclaration(parameters:={Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))})).Count)
2844
Assert.Equal(0, Generator.
GetParameters
(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).Count)
2846
Assert.Equal(1, Generator.
GetParameters
(Generator.IndexerDeclaration({Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))}, Generator.IdentifierName("t"))).Count)
2847
Assert.Equal(2, Generator.
GetParameters
(Generator.IndexerDeclaration({Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))}, Generator.IdentifierName("t"))).Count)
2849
Assert.Equal(0, Generator.
GetParameters
(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("expr"))).Count)
2850
Assert.Equal(1, Generator.
GetParameters
(Generator.ValueReturningLambdaExpression("p1", Generator.IdentifierName("expr"))).Count)
2852
Assert.Equal(0, Generator.
GetParameters
(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("expr"))).Count)
2853
Assert.Equal(1, Generator.
GetParameters
(Generator.VoidReturningLambdaExpression("p1", Generator.IdentifierName("expr"))).Count)
2855
Assert.Equal(0, Generator.
GetParameters
(Generator.DelegateDeclaration("d")).Count)
2856
Assert.Equal(1, Generator.
GetParameters
(Generator.DelegateDeclaration("d", parameters:={Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count)
2858
Assert.Equal(0, Generator.
GetParameters
(Generator.ClassDeclaration("c")).Count)
2859
Assert.Equal(0, Generator.
GetParameters
(Generator.IdentifierName("x")).Count)
2864
Assert.Equal(1, Generator.
GetParameters
(Generator.AddParameters(Generator.MethodDeclaration("m"), {Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count)
2865
Assert.Equal(1, Generator.
GetParameters
(Generator.AddParameters(Generator.ConstructorDeclaration(), {Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count)
2866
Assert.Equal(3, Generator.
GetParameters
(Generator.AddParameters(Generator.IndexerDeclaration({Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))}, Generator.IdentifierName("t")), {Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2")), Generator.ParameterDeclaration("p3", Generator.IdentifierName("t3"))})).Count)
2868
Assert.Equal(1, Generator.
GetParameters
(Generator.AddParameters(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("expr")), {Generator.LambdaParameter("p")})).Count)
2869
Assert.Equal(1, Generator.
GetParameters
(Generator.AddParameters(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("expr")), {Generator.LambdaParameter("p")})).Count)
2871
Assert.Equal(1, Generator.
GetParameters
(Generator.AddParameters(Generator.DelegateDeclaration("d"), {Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count)
2873
Assert.Equal(0, Generator.
GetParameters
(Generator.AddParameters(Generator.ClassDeclaration("c"), {Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count)
2874
Assert.Equal(0, Generator.
GetParameters
(Generator.AddParameters(Generator.IdentifierName("x"), {Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count)
2875
Assert.Equal(1, Generator.
GetParameters
(Generator.AddParameters(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), {Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))})).Count)
Microsoft.CodeAnalysis.Workspaces (2)
Editing\SyntaxGenerator.cs (1)
1275
=> this.InsertParameters(declaration, this.
GetParameters
(declaration).Count, parameters);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\AddParameterEditor.cs (1)
28
var existingParameters = generator.
GetParameters
(declaration);
Microsoft.Interop.ComInterfaceGenerator (1)
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
247
SyntaxNode generatedParameterSyntax = generator.
GetParameters
(generatedDeclaration)[parameter.Ordinal];
Microsoft.Interop.LibraryImportGenerator (1)
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
247
SyntaxNode generatedParameterSyntax = generator.
GetParameters
(generatedDeclaration)[parameter.Ordinal];