2 overrides of GetExpression
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
2252
public override SyntaxNode?
GetExpression
(SyntaxNode declaration)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (1)
CodeGeneration\VisualBasicSyntaxGenerator.vb (1)
2784
Public Overrides Function
GetExpression
(declaration As SyntaxNode) As SyntaxNode
64 references to GetExpression
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
128
var expression = generator.
GetExpression
(node);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\CSharpRemoveAsyncModifierCodeFixProvider.cs (1)
64
=> generator.
GetExpression
(node) == null
Microsoft.CodeAnalysis.CSharp.Features (1)
src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\CSharpRemoveAsyncModifierCodeFixProvider.cs (1)
64
=> generator.
GetExpression
(node) == null
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (37)
CodeGeneration\SyntaxGeneratorTests.cs (37)
3282
Assert.Equal("x", Generator.
GetExpression
(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), initializer: Generator.IdentifierName("x"))).ToString());
3283
Assert.Equal("x", Generator.
GetExpression
(Generator.ParameterDeclaration("p", Generator.IdentifierName("t"), initializer: Generator.IdentifierName("x"))).ToString());
3284
Assert.Equal("x", Generator.
GetExpression
(Generator.LocalDeclarationStatement("loc", initializer: Generator.IdentifierName("x"))).ToString());
3287
Assert.Null(Generator.
GetExpression
(Generator.ValueReturningLambdaExpression("p", [Generator.IdentifierName("x")])));
3289
Assert.Equal("x", Generator.
GetExpression
(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("x"))).ToString());
3290
Assert.Equal("x", Generator.
GetExpression
(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("x"))).ToString());
3291
Assert.Equal("x", Generator.
GetExpression
(Generator.ValueReturningLambdaExpression("p", Generator.IdentifierName("x"))).ToString());
3292
Assert.Equal("x", Generator.
GetExpression
(Generator.VoidReturningLambdaExpression("p", Generator.IdentifierName("x"))).ToString());
3295
Assert.Null(Generator.
GetExpression
(Generator.IdentifierName("e")));
3302
Assert.Equal("x", Generator.
GetExpression
(method).ToString());
3309
Assert.Equal("x", Generator.
GetExpression
(local).ToString());
3316
Assert.Equal("x", Generator.
GetExpression
(Generator.WithExpression(Generator.FieldDeclaration("f", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString());
3317
Assert.Equal("x", Generator.
GetExpression
(Generator.WithExpression(Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString());
3318
Assert.Equal("x", Generator.
GetExpression
(Generator.WithExpression(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), Generator.IdentifierName("x"))).ToString());
3321
Assert.Equal("y", Generator.
GetExpression
(Generator.WithExpression(Generator.ValueReturningLambdaExpression("p", [Generator.IdentifierName("x")]), Generator.IdentifierName("y"))).ToString());
3322
Assert.Equal("y", Generator.
GetExpression
(Generator.WithExpression(Generator.VoidReturningLambdaExpression("p", [Generator.IdentifierName("x")]), Generator.IdentifierName("y"))).ToString());
3325
Assert.Equal("y", Generator.
GetExpression
(Generator.WithExpression(Generator.ValueReturningLambdaExpression("p", Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString());
3326
Assert.Equal("y", Generator.
GetExpression
(Generator.WithExpression(Generator.VoidReturningLambdaExpression("p", Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString());
3327
Assert.Equal("y", Generator.
GetExpression
(Generator.WithExpression(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString());
3328
Assert.Equal("y", Generator.
GetExpression
(Generator.WithExpression(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString());
3331
Assert.Null(Generator.
GetExpression
(Generator.WithExpression(Generator.IdentifierName("e"), Generator.IdentifierName("x"))));
3338
Assert.Equal("y", Generator.
GetExpression
(Generator.WithExpression(method, Generator.IdentifierName("y"))).ToString());
3345
Assert.Equal("y", Generator.
GetExpression
(Generator.WithExpression(local, Generator.IdentifierName("y"))).ToString());
3497
Assert.NotNull(Generator.
GetExpression
(x));
3498
Assert.NotNull(Generator.
GetExpression
(y));
3499
Assert.Null(Generator.
GetExpression
(z));
3500
Assert.Equal("100", Generator.
GetExpression
(x).ToString());
3501
Assert.Equal("300", Generator.
GetExpression
(y).ToString());
3503
Assert.Equal("500", Generator.
GetExpression
(Generator.WithExpression(x, Generator.LiteralExpression(500))).ToString());
3504
Assert.Equal("500", Generator.
GetExpression
(Generator.WithExpression(y, Generator.LiteralExpression(500))).ToString());
3505
Assert.Equal("500", Generator.
GetExpression
(Generator.WithExpression(z, Generator.LiteralExpression(500))).ToString());
3521
Assert.Null(Generator.
GetExpression
(x));
3522
Assert.NotNull(Generator.
GetExpression
(y));
3523
Assert.Equal("p * 10", Generator.
GetExpression
(y).ToString());
3525
Assert.Null(Generator.
GetExpression
(Generator.WithExpression(x, Generator.LiteralExpression(500))));
3526
Assert.Equal("500", Generator.
GetExpression
(Generator.WithExpression(y, Generator.LiteralExpression(500))).ToString());
3827
Assert.Equal("e", Generator.
GetExpression
(xInitialized).ToString());
Microsoft.CodeAnalysis.Features (1)
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
128
var expression = generator.
GetExpression
(node);
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (23)
CodeGeneration\SyntaxGeneratorTests.vb (23)
2881
Assert.Equal("x", Generator.
GetExpression
(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), initializer:=Generator.IdentifierName("x"))).ToString())
2882
Assert.Equal("x", Generator.
GetExpression
(Generator.ParameterDeclaration("p", Generator.IdentifierName("t"), initializer:=Generator.IdentifierName("x"))).ToString())
2883
Assert.Equal("x", Generator.
GetExpression
(Generator.LocalDeclarationStatement("loc", initializer:=Generator.IdentifierName("x"))).ToString())
2886
Assert.Null(Generator.
GetExpression
(Generator.ValueReturningLambdaExpression("p", {Generator.IdentifierName("x")})))
2888
Assert.Equal("x", Generator.
GetExpression
(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("x"))).ToString())
2889
Assert.Equal("x", Generator.
GetExpression
(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("x"))).ToString())
2890
Assert.Equal("x", Generator.
GetExpression
(Generator.ValueReturningLambdaExpression("p", Generator.IdentifierName("x"))).ToString())
2891
Assert.Equal("x", Generator.
GetExpression
(Generator.VoidReturningLambdaExpression("p", Generator.IdentifierName("x"))).ToString())
2893
Assert.Null(Generator.
GetExpression
(Generator.IdentifierName("e")))
2899
Assert.Equal("x", Generator.
GetExpression
(Generator.WithExpression(Generator.FieldDeclaration("f", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString())
2900
Assert.Equal("x", Generator.
GetExpression
(Generator.WithExpression(Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString())
2901
Assert.Equal("x", Generator.
GetExpression
(Generator.WithExpression(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), Generator.IdentifierName("x"))).ToString())
2904
Assert.Equal("y", Generator.
GetExpression
(Generator.WithExpression(Generator.ValueReturningLambdaExpression("p", {Generator.IdentifierName("x")}), Generator.IdentifierName("y"))).ToString())
2905
Assert.Equal("y", Generator.
GetExpression
(Generator.WithExpression(Generator.VoidReturningLambdaExpression("p", {Generator.IdentifierName("x")}), Generator.IdentifierName("y"))).ToString())
2906
Assert.Equal("y", Generator.
GetExpression
(Generator.WithExpression(Generator.ValueReturningLambdaExpression({Generator.IdentifierName("x")}), Generator.IdentifierName("y"))).ToString())
2907
Assert.Equal("y", Generator.
GetExpression
(Generator.WithExpression(Generator.VoidReturningLambdaExpression({Generator.IdentifierName("x")}), Generator.IdentifierName("y"))).ToString())
2908
Assert.Equal("y", Generator.
GetExpression
(Generator.WithExpression(Generator.ValueReturningLambdaExpression("p", Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString())
2909
Assert.Equal("y", Generator.
GetExpression
(Generator.WithExpression(Generator.VoidReturningLambdaExpression("p", Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString())
2910
Assert.Equal("y", Generator.
GetExpression
(Generator.WithExpression(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString())
2911
Assert.Equal("y", Generator.
GetExpression
(Generator.WithExpression(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString())
2917
Assert.Null(Generator.
GetExpression
(Generator.WithExpression(Generator.IdentifierName("e"), Generator.IdentifierName("x"))))
2958
Assert.Null(Generator.
GetExpression
(Generator.WithExpression(Generator.IdentifierName("e"), Generator.IdentifierName("x"))))
3518
Assert.Equal("e", Generator.
GetExpression
(xInitialized).ToString())