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