2 overrides of WithType
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
2001
public override SyntaxNode
WithType
(SyntaxNode declaration, SyntaxNode type)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (1)
CodeGeneration\VisualBasicSyntaxGenerator.vb (1)
2121
Public Overrides Function
WithType
(declaration As SyntaxNode, type As SyntaxNode) As SyntaxNode
38 references to WithType
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (13)
CodeGeneration\SyntaxGeneratorTests.cs (13)
3217
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString());
3218
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.FieldDeclaration("f", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString());
3219
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString());
3221
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.ParameterDeclaration("p", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString());
3223
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.DelegateDeclaration("t"), Generator.IdentifierName("t"))).ToString());
3225
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.EventDeclaration("ef", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString());
3226
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString());
3228
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "v"), Generator.IdentifierName("t"))).ToString());
3229
Assert.Null(Generator.GetType(Generator.
WithType
(Generator.ClassDeclaration("c"), Generator.IdentifierName("t"))));
3230
Assert.Null(Generator.GetType(Generator.
WithType
(Generator.IdentifierName("x"), Generator.IdentifierName("t"))));
3814
var xTypedT = Generator.
WithType
(declX, Generator.IdentifierName("T"));
3902
Generator.ReplaceNode(declC, declY, Generator.
WithType
(declY, Generator.IdentifierName("T"))),
3911
Generator.ReplaceNode(declC, declZ, Generator.
WithType
(declZ, Generator.IdentifierName("T"))),
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (23)
CodeGeneration\SyntaxGeneratorTests.vb (23)
2786
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.MethodDeclaration("m", returnType:=Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString())
2787
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.MethodDeclaration("m"), Generator.IdentifierName("t"))).ToString())
2788
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.FieldDeclaration("f", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString())
2789
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString())
2790
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.IndexerDeclaration({Generator.ParameterDeclaration("p", Generator.IdentifierName("pt"))}, Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString())
2791
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.ParameterDeclaration("p", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString())
2793
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.DelegateDeclaration("t", returnType:=Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString())
2794
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.DelegateDeclaration("t"), Generator.IdentifierName("t"))).ToString())
2796
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.EventDeclaration("ef", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString())
2797
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString())
2799
Assert.Equal("t", Generator.GetType(Generator.
WithType
(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "v"), Generator.IdentifierName("t"))).ToString())
2800
Assert.Null(Generator.GetType(Generator.
WithType
(Generator.ClassDeclaration("c"), Generator.IdentifierName("t"))))
2801
Assert.Null(Generator.GetType(Generator.
WithType
(Generator.IdentifierName("x"), Generator.IdentifierName("t"))))
2807
Generator.
WithType
(Generator.MethodDeclaration("m", returnType:=Generator.IdentifierName("x")), Nothing),
2812
Generator.
WithType
(Generator.MethodDeclaration("m"), Generator.IdentifierName("x")),
2817
Generator.
WithType
(Generator.MethodDeclaration("m", returnType:=Generator.IdentifierName("x"), modifiers:=DeclarationModifiers.Abstract), Nothing),
2821
Generator.
WithType
(Generator.MethodDeclaration("m", modifiers:=DeclarationModifiers.Abstract), Generator.IdentifierName("x")),
2825
Generator.
WithType
(Generator.DelegateDeclaration("d", returnType:=Generator.IdentifierName("x")), Nothing),
2829
Generator.
WithType
(Generator.DelegateDeclaration("d"), Generator.IdentifierName("x")),
3505
Dim xTypedT = Generator.
WithType
(declX, Generator.IdentifierName("T"))
3597
Generator.ReplaceNode(declC, declX, Generator.
WithType
(declX, Generator.IdentifierName("T"))),
3633
Generator.ReplaceNode(declC, declY, Generator.
WithType
(declY, Generator.IdentifierName("T"))),
3645
Generator.ReplaceNode(declC, declZ, Generator.
WithType
(declZ, Generator.IdentifierName("T"))),
Microsoft.CodeAnalysis.Workspaces (1)
Editing\SyntaxEditorExtensions.cs (1)
32
=> editor.ReplaceNode(declaration, (d, g) => g.
WithType
(d, type));
Microsoft.Interop.LibraryImportGenerator (1)
Analyzers\ConvertToLibraryImportFixer.cs (1)
249
generatedDeclaration = editor.Generator.
WithType
(