2 overrides of WithName
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
1899
public override SyntaxNode
WithName
(SyntaxNode declaration, string name)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (1)
CodeGeneration\VisualBasicSyntaxGenerator.vb (1)
1982
Public Overrides Function
WithName
(declaration As SyntaxNode, name As String) As SyntaxNode
47 references to WithName
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (21)
CodeGeneration\SyntaxGeneratorTests.cs (21)
2920
Assert.Equal("c", Generator.GetName(Generator.
WithName
(Generator.ClassDeclaration("x"), "c")));
2921
Assert.Equal("s", Generator.GetName(Generator.
WithName
(Generator.StructDeclaration("x"), "s")));
2922
Assert.Equal("i", Generator.GetName(Generator.
WithName
(Generator.EnumDeclaration("x"), "i")));
2923
Assert.Equal("e", Generator.GetName(Generator.
WithName
(Generator.EnumDeclaration("x"), "e")));
2924
Assert.Equal("d", Generator.GetName(Generator.
WithName
(Generator.DelegateDeclaration("x"), "d")));
2925
Assert.Equal("m", Generator.GetName(Generator.
WithName
(Generator.MethodDeclaration("x"), "m")));
2926
Assert.Equal("", Generator.GetName(Generator.
WithName
(Generator.ConstructorDeclaration(), ".ctor")));
2927
Assert.Equal("p", Generator.GetName(Generator.
WithName
(Generator.ParameterDeclaration("x"), "p")));
2928
Assert.Equal("p", Generator.GetName(Generator.
WithName
(Generator.PropertyDeclaration("x", Generator.IdentifierName("t")), "p")));
2930
Assert.Equal("f", Generator.GetName(Generator.
WithName
(Generator.FieldDeclaration("x", Generator.IdentifierName("t")), "f")));
2931
Assert.Equal("v", Generator.GetName(Generator.
WithName
(Generator.EnumMember("x"), "v")));
2932
Assert.Equal("ef", Generator.GetName(Generator.
WithName
(Generator.EventDeclaration("x", Generator.IdentifierName("t")), "ef")));
2933
Assert.Equal("ep", Generator.GetName(Generator.
WithName
(Generator.CustomEventDeclaration("x", Generator.IdentifierName("t")), "ep")));
2934
Assert.Equal("n", Generator.GetName(Generator.
WithName
(Generator.NamespaceDeclaration("x"), "n")));
2935
Assert.Equal("u", Generator.GetName(Generator.
WithName
(Generator.NamespaceImportDeclaration("x"), "u")));
2936
Assert.Equal("loc", Generator.GetName(Generator.
WithName
(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "x"), "loc")));
2937
Assert.Equal("a", Generator.GetName(Generator.
WithName
(Generator.Attribute("x"), "a")));
3819
var xNamedQ = Generator.
WithName
(declX, "Q");
3934
Generator.ReplaceNode(declC, declX, Generator.
WithName
(declX, "Q")),
4142
var xNamedQ = Generator.
WithName
(attrX, "Q");
4322
var xNamedQ = Generator.
WithName
(attrX, "Q");
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (25)
CodeGeneration\SyntaxGeneratorTests.vb (25)
2616
Assert.Equal("c", Generator.GetName(Generator.
WithName
(Generator.ClassDeclaration("x"), "c")))
2617
Assert.Equal("s", Generator.GetName(Generator.
WithName
(Generator.StructDeclaration("x"), "s")))
2618
Assert.Equal("i", Generator.GetName(Generator.
WithName
(Generator.EnumDeclaration("x"), "i")))
2619
Assert.Equal("e", Generator.GetName(Generator.
WithName
(Generator.EnumDeclaration("x"), "e")))
2620
Assert.Equal("d", Generator.GetName(Generator.
WithName
(Generator.DelegateDeclaration("x"), "d")))
2621
Assert.Equal("m", Generator.GetName(Generator.
WithName
(Generator.MethodDeclaration("x"), "m")))
2622
Assert.Equal("m", Generator.GetName(Generator.
WithName
(Generator.MethodDeclaration("x", modifiers:=DeclarationModifiers.Abstract), "m")))
2623
Assert.Equal("", Generator.GetName(Generator.
WithName
(Generator.ConstructorDeclaration(), ".ctor")))
2624
Assert.Equal("p", Generator.GetName(Generator.
WithName
(Generator.ParameterDeclaration("x"), "p")))
2625
Assert.Equal("p", Generator.GetName(Generator.
WithName
(Generator.PropertyDeclaration("x", Generator.IdentifierName("t")), "p")))
2626
Assert.Equal("p", Generator.GetName(Generator.
WithName
(Generator.PropertyDeclaration("x", Generator.IdentifierName("t"), modifiers:=DeclarationModifiers.Abstract), "p")))
2627
Assert.Equal("X", Generator.GetName(Generator.
WithName
(Generator.IndexerDeclaration({Generator.ParameterDeclaration("i")}, Generator.IdentifierName("t")), "X")))
2628
Assert.Equal("X", Generator.GetName(Generator.
WithName
(Generator.IndexerDeclaration({Generator.ParameterDeclaration("i")}, Generator.IdentifierName("t"), modifiers:=DeclarationModifiers.Abstract), "X")))
2629
Assert.Equal("f", Generator.GetName(Generator.
WithName
(Generator.FieldDeclaration("x", Generator.IdentifierName("t")), "f")))
2630
Assert.Equal("v", Generator.GetName(Generator.
WithName
(Generator.EnumMember("x"), "v")))
2631
Assert.Equal("ef", Generator.GetName(Generator.
WithName
(Generator.EventDeclaration("x", Generator.IdentifierName("t")), "ef")))
2632
Assert.Equal("ep", Generator.GetName(Generator.
WithName
(Generator.CustomEventDeclaration("x", Generator.IdentifierName("t")), "ep")))
2633
Assert.Equal("n", Generator.GetName(Generator.
WithName
(Generator.NamespaceDeclaration("x"), "n")))
2634
Assert.Equal("u", Generator.GetName(Generator.
WithName
(Generator.NamespaceImportDeclaration("x"), "u")))
2635
Assert.Equal("loc", Generator.GetName(Generator.
WithName
(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "x"), "loc")))
2636
Assert.Equal("a", Generator.GetName(Generator.
WithName
(Generator.Attribute("x"), "a")))
3510
Dim xNamedQ = Generator.
WithName
(declX, "Q")
3617
Generator.ReplaceNode(declC, declX, Generator.
WithName
(declX, "Q")),
3742
Dim xNamedQ = Generator.
WithName
(declX, "Q")
3868
Dim xRenamedQ = Generator.
WithName
(declX, "Q")
Microsoft.CodeAnalysis.Workspaces (1)
Editing\SyntaxEditorExtensions.cs (1)
29
=> editor.ReplaceNode(declaration, (d, g) => g.
WithName
(d, name));