2 overrides of LocalDeclarationStatement
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
3493
public override SyntaxNode
LocalDeclarationStatement
(SyntaxNode? type, string name, SyntaxNode? initializer, bool isConst)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (1)
CodeGeneration\VisualBasicSyntaxGenerator.vb (1)
500
Public Overloads Overrides Function
LocalDeclarationStatement
(type As SyntaxNode, identifier As String, Optional initializer As SyntaxNode = Nothing, Optional isConst As Boolean = False) As SyntaxNode
31 references to LocalDeclarationStatement
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (14)
CodeGeneration\SyntaxGeneratorTests.cs (14)
492
VerifySyntax<LocalDeclarationStatementSyntax>(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("x"), "y"), "x y;");
493
VerifySyntax<LocalDeclarationStatementSyntax>(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z")), "x y = z;");
495
VerifySyntax<LocalDeclarationStatementSyntax>(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("x"), "y", isConst: true), "const x y;");
496
VerifySyntax<LocalDeclarationStatementSyntax>(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z"), isConst: true), "const x y = z;");
2786
Assert.Equal(DeclarationKind.Variable, Generator.GetDeclarationKind(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "loc")));
2809
Assert.Equal("loc", Generator.GetName(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "loc")));
2832
Assert.Equal("loc", Generator.GetName(Generator.WithName(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "x"), "loc")));
2855
Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "loc")));
2879
Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "loc"), Accessibility.Private)));
2903
Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "loc")));
2926
Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "loc"), DeclarationModifiers.Abstract)));
3104
Assert.Equal("t", Generator.GetType(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "v")).ToString());
3124
Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("x"), "v"), Generator.IdentifierName("t"))).ToString());
3214
Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "loc"), Generator.IdentifierName("x"))).ToString());
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (15)
CodeGeneration\SyntaxGeneratorTests.vb (15)
448
VerifySyntax(Of LocalDeclarationStatementSyntax)(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("x"), "y"), "Dim y As x")
449
VerifySyntax(Of LocalDeclarationStatementSyntax)(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z")), "Dim y As x = z")
452
VerifySyntax(Of LocalDeclarationStatementSyntax)(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("x"), "y", isConst:=True), "Const y As x")
453
VerifySyntax(Of LocalDeclarationStatementSyntax)(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z"), isConst:=True), "Const y As x = z")
454
VerifySyntax(Of LocalDeclarationStatementSyntax)(Generator.
LocalDeclarationStatement
(DirectCast(Nothing, SyntaxNode), "y", Generator.IdentifierName("z"), isConst:=True), "Const y = z")
2541
Assert.Equal(DeclarationKind.Variable, Generator.GetDeclarationKind(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "loc")))
2566
Assert.Equal("loc", Generator.GetName(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "loc")))
2591
Assert.Equal("loc", Generator.GetName(Generator.WithName(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "x"), "loc")))
2613
Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "loc")))
2641
Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "loc"), Accessibility.Private)))
2668
Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "loc")))
2690
Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "loc"), DeclarationModifiers.Abstract)))
2734
Assert.Equal("t", Generator.GetType(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "v")).ToString())
2755
Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("x"), "v"), Generator.IdentifierName("t"))).ToString())
2857
Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.
LocalDeclarationStatement
(Generator.IdentifierName("t"), "loc"), Generator.IdentifierName("x"))).ToString())
Microsoft.CodeAnalysis.Workspaces (2)
Editing\SyntaxGenerator.cs (2)
1624
=>
LocalDeclarationStatement
(TypeExpression(type), name, initializer, isConst);
1630
=>
LocalDeclarationStatement
(type: (SyntaxNode?)null, name, initializer);