122 references to Body
Microsoft.AspNetCore.App.Analyzers (1)
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (1)
371
if (lambdaExpression?.
Body
is BlockSyntax block)
Microsoft.AspNetCore.App.CodeFixes (2)
Authorization\AddAuthorizationBuilderFixer.cs (2)
66
if (lambda.
Body
is BlockSyntax lambdaBlockBody)
70
else if (lambda.
Body
is InvocationExpressionSyntax lambdaExpressionBody)
Microsoft.CodeAnalysis.CSharp (8)
Binder\Binder.IdentifierUsedAsValueFinder.cs (2)
175
return CheckIdentifiersInNode(lambdaSyntax.
Body
, lambdaBodyBinder.GetBinder(lambdaSyntax.
Body
) ?? lambdaBodyBinder);
Lowering\ClosureConversion\ClosureConversion.cs (1)
1450
lambdaOrLambdaBodySyntax = anonymousFunction.
Body
;
Syntax\LambdaUtilities.cs (4)
80
return ((AnonymousFunctionExpressionSyntax)newLambda).
Body
;
126
AnonymousFunctionExpressionSyntax anonymousFunctionExpressionSyntax => anonymousFunctionExpressionSyntax.
Body
,
153
return anonymousFunction.
Body
== node;
293
lambdaBody1 = ((AnonymousFunctionExpressionSyntax)node).
Body
;
Syntax\SyntaxNodeExtensions.cs (1)
188
=> ((AnonymousFunctionExpressionSyntax)lambda).
Body
;
Microsoft.CodeAnalysis.CSharp.CodeStyle (10)
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
309
current == lambda.
Body
)
src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (1)
72
if (whereLambda.
Body
is not BinaryExpressionSyntax(kind: SyntaxKind.IsExpression)
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaHelpers.cs (2)
89
=> declaration.
Body
as ExpressionSyntax;
114
var body = declaration.
Body
as BlockSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (2)
155
SetAlignmentBlockOperation(list, simpleLambda, simpleLambda.
Body
);
158
SetAlignmentBlockOperation(list, parenthesizedLambda, parenthesizedLambda.
Body
);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (4)
230
originalLambdaBody = originalParenthesizedLambda.
Body
;
231
replacedLambdaBody = replacedParenthesizedLambda.
Body
;
246
originalLambdaBody = originalSimpleLambda.
Body
;
247
replacedLambdaBody = replacedSimpleLambda.
Body
;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (5)
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (3)
222
var body = anonymousFunction.
Body
is BlockSyntax block
226
var expressionBody = anonymousFunction.
Body
is ExpressionSyntax expression
230
var semicolonToken = anonymousFunction.
Body
is ExpressionSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
1816
parameter.Identifier.ValueText, lambdaExpression.
Body
);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
142
AnonymousFunctionExpressionSyntax anonymousFunction => anonymousFunction.
Body
,
Microsoft.CodeAnalysis.CSharp.Features (25)
ChangeSignature\CSharpChangeSignatureService.cs (2)
377
lambda.
Body
);
386
return ParenthesizedLambdaExpression(lambda.AsyncKeyword, emptyParameterList, lambda.ArrowToken, lambda.
Body
);
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (1)
393
AnonymousFunctionExpressionSyntax lambda => lambda.
Body
,
EditAndContinue\SyntaxComparer.cs (2)
980
body = simple.
Body
;
991
body = parenthesized.
Body
;
ExtractMethod\CSharpMethodExtractor.cs (1)
62
if (OriginalSelectionWithin(anonymousFunction.
Body
) || OriginalSelectionWithin(anonymousFunction.ExpressionBody))
ExtractMethod\Extensions.cs (2)
47
case SimpleLambdaExpressionSyntax s: return s.
Body
as BlockSyntax;
48
case ParenthesizedLambdaExpressionSyntax p: return p.
Body
as BlockSyntax;
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
100
var oldBody = (ExpressionSyntax)oldLambda.
Body
;
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
309
current == lambda.
Body
)
src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (1)
72
if (whereLambda.
Body
is not BinaryExpressionSyntax(kind: SyntaxKind.IsExpression)
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaHelpers.cs (2)
89
=> declaration.
Body
as ExpressionSyntax;
114
var body = declaration.
Body
as BlockSyntax;
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (3)
222
var body = anonymousFunction.
Body
is BlockSyntax block
226
var expressionBody = anonymousFunction.
Body
is ExpressionSyntax expression
230
var semicolonToken = anonymousFunction.
Body
is ExpressionSyntax
src\Compilers\CSharp\Portable\Syntax\LambdaUtilities.cs (4)
80
return ((AnonymousFunctionExpressionSyntax)newLambda).
Body
;
126
AnonymousFunctionExpressionSyntax anonymousFunctionExpressionSyntax => anonymousFunctionExpressionSyntax.
Body
,
153
return anonymousFunction.
Body
== node;
293
lambdaBody1 = ((AnonymousFunctionExpressionSyntax)node).
Body
;
Structure\Providers\ParenthesizedLambdaExpressionStructureProvider.cs (2)
22
if (lambdaExpression.
Body
.IsMissing)
27
if (lambdaExpression.
Body
is not BlockSyntax lambdaBlock ||
Structure\Providers\SimpleLambdaExpressionStructureProvider.cs (2)
22
if (lambdaExpression.
Body
.IsMissing)
27
if (lambdaExpression.
Body
is not BlockSyntax lambdaBlock ||
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (1)
261
return lambda.
Body
;
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (3)
EditAndContinue\SyntaxUtilitiesTests.cs (3)
217
Assert.Equal(1, SyntaxUtilities.GetSuspensionPoints(l1.
Body
).Count());
218
Assert.Equal(1, SyntaxUtilities.GetSuspensionPoints(l2.
Body
).Count());
219
Assert.Equal(1, SyntaxUtilities.GetSuspensionPoints(l3.
Body
).Count());
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (18)
Semantics\BindingTests.cs (1)
3940
var typeInfo = model.GetTypeInfo(lambda.
Body
);
Semantics\LambdaTests.cs (15)
1178
var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single().
Body
;
1238
var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single().
Body
;
2121
var eReference = lambda.
Body
.DescendantNodes().OfType<IdentifierNameSyntax>().First();
2167
var eReference = lambda.
Body
.DescendantNodes().OfType<IdentifierNameSyntax>().First();
2213
var eReference = lambda.
Body
.DescendantNodes().OfType<IdentifierNameSyntax>().First();
2259
var eReference = lambda.
Body
.DescendantNodes().OfType<IdentifierNameSyntax>().First();
2305
var eReference = lambda.
Body
.DescendantNodes().OfType<IdentifierNameSyntax>().First();
2335
var eReference = lambda.
Body
.DescendantNodes().OfType<IdentifierNameSyntax>().First();
2362
var eReference = lambda.
Body
.DescendantNodes().OfType<IdentifierNameSyntax>().First();
2417
var reference = lambda.
Body
.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First();
2463
var reference = lambda.
Body
.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First();
2509
var reference = lambda.
Body
.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First();
2542
var reference = lambda.
Body
.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First();
2575
var reference = lambda.
Body
.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First();
2612
var reference = lambda.
Body
.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First();
Semantics\NullableReferenceTypesTests.cs (1)
3336
var reference = lambda.
Body
.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First();
Semantics\SuppressAccessibilityChecksTests.cs (1)
123
var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single().
Body
;
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Compilation\SemanticModelAPITests.cs (1)
3128
Body
.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().Single();
Symbols\Source\NullablePublicAPITests.cs (1)
3781
Assert.True(model.TryGetSpeculativeSemanticModel(lambda.
Body
.SpanStart, newStatement, out var speculativeModel));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (24)
Parsing\ExpressionParsingTests.cs (24)
2041
Assert.NotNull(lambda.
Body
);
2042
Assert.Equal("b", lambda.
Body
.ToString());
2059
Assert.Equal(SyntaxKind.RefExpression, lambda.
Body
.Kind());
2060
Assert.Equal("ref b", lambda.
Body
.ToString());
2077
Assert.NotNull(lambda.
Body
);
2078
Assert.Equal(SyntaxKind.Block, lambda.
Body
.Kind());
2079
var b = (BlockSyntax)lambda.
Body
;
2080
Assert.Equal("{ }", lambda.
Body
.ToString());
2099
Assert.NotNull(lambda.
Body
);
2100
Assert.Equal("b", lambda.
Body
.ToString());
2119
Assert.Equal(SyntaxKind.RefExpression, lambda.
Body
.Kind());
2120
Assert.Equal("ref b", lambda.
Body
.ToString());
2139
Assert.NotNull(lambda.
Body
);
2140
Assert.Equal(SyntaxKind.Block, lambda.
Body
.Kind());
2141
var b = (BlockSyntax)lambda.
Body
;
2142
Assert.Equal("{ }", lambda.
Body
.ToString());
2165
Assert.NotNull(lambda.
Body
);
2166
Assert.Equal("b", lambda.
Body
.ToString());
2192
Assert.NotNull(lambda.
Body
);
2193
Assert.Equal("b", lambda.
Body
.ToString());
2217
Assert.NotNull(lambda.
Body
);
2218
Assert.Equal("b", lambda.
Body
.ToString());
2244
Assert.NotNull(lambda.
Body
);
2245
Assert.Equal("b", lambda.
Body
.ToString());
Microsoft.CodeAnalysis.CSharp.Workspaces (22)
CodeGeneration\CSharpSyntaxGenerator.cs (6)
2234
return SyntaxFactory.ParenthesizedLambdaExpression(AsParameterList(parameters), lambda.
Body
)
2254
return ((ParenthesizedLambdaExpressionSyntax)declaration).
Body
as ExpressionSyntax;
2256
return ((SimpleLambdaExpressionSyntax)declaration).
Body
as ExpressionSyntax;
2465
SyntaxKind.AnonymousMethodExpression => (((AnonymousMethodExpressionSyntax)declaration).
Body
as BlockSyntax)?.Statements,
2466
SyntaxKind.ParenthesizedLambdaExpression => (((ParenthesizedLambdaExpressionSyntax)declaration).
Body
as BlockSyntax)?.Statements,
2467
SyntaxKind.SimpleLambdaExpression => (((SimpleLambdaExpressionSyntax)declaration).
Body
as BlockSyntax)?.Statements,
Rename\CSharpRenameRewriterLanguageService.cs (2)
1161
if (lambdaExpression.
Body
is ExpressionSyntax)
1163
return lambdaExpression.
Body
;
Rename\LocalConflictVisitor.cs (2)
115
Visit(node.
Body
);
123
Visit(node.
Body
);
Simplification\CSharpSimplificationService.Expander.cs (3)
115
if (newLambdaExpression.
Body
is ExpressionSyntax)
117
var body = (ExpressionSyntax)lambdaExpression.
Body
;
118
var newBody = (ExpressionSyntax)newLambdaExpression.
Body
;
Simplification\Reducers\CSharpMiscellaneousReducer.cs (1)
102
parenthesizedLambda.
Body
);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (2)
155
SetAlignmentBlockOperation(list, simpleLambda, simpleLambda.
Body
);
158
SetAlignmentBlockOperation(list, parenthesizedLambda, parenthesizedLambda.
Body
);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (4)
230
originalLambdaBody = originalParenthesizedLambda.
Body
;
231
replacedLambdaBody = replacedParenthesizedLambda.
Body
;
246
originalLambdaBody = originalSimpleLambda.
Body
;
247
replacedLambdaBody = replacedSimpleLambda.
Body
;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
1816
parameter.Identifier.ValueText, lambdaExpression.
Body
);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
142
AnonymousFunctionExpressionSyntax anonymousFunction => anonymousFunction.
Body
,
Microsoft.Maui.Controls.BindingSourceGen (2)
BindingSourceGenerator.cs (2)
160
if (lambda.
Body
is not ExpressionSyntax lambdaBody)
162
return Result<ITypeSymbol>.Failure(DiagnosticsFactory.GetterLambdaBodyIsNotExpression(lambda.
Body
.GetLocation()));