Base:
property
Body
Microsoft.CodeAnalysis.CSharp.Syntax.BaseMethodDeclarationSyntax.Body
78 references to Body
Microsoft.CodeAnalysis.CSharp (28)
Binder\Binder.CapturedParametersFinder.cs (1)
121
finder.CheckIdentifiersInNode(s.
Body
, bodyBinder) &&
Binder\Binder_Statements.cs (4)
3754
if (initializer == null && constructor.
Body
== null && constructor.ExpressionBody == null)
3788
constructor.
Body
== null ? null : (BoundBlock)bodyBinder.BindStatement(constructor.
Body
, diagnostics),
3792
constructor.
Body
== null ? diagnostics : BindingDiagnosticBag.Discarded));
Binder\LocalBinderFactory.cs (1)
159
Visit(node.
Body
, enclosing);
Compilation\SyntaxTreeSemanticModel.cs (1)
868
constructorDecl.
Body
?.FullSpan.Contains(span) == true) ?
Compiler\MethodCompiler.cs (1)
2137
addIdentifiers(s.
Body
, identifierMap);
Lowering\Instrumentation\DebugInfoInjector.cs (3)
70
Debug.Assert(ctorDecl.
Body
!= null);
73
var start = ctorDecl.
Body
.OpenBraceToken.SpanStart;
74
var end = ctorDecl.
Body
.OpenBraceToken.Span.End;
Symbols\Source\SourceConstructorSymbol.cs (3)
95
syntax.
Body
, syntax.ExpressionBody, syntax, diagnostics);
258
if (ctorSyntax.
Body
?.Span.Contains(position) == true)
260
offset = position - ctorSyntax.
Body
.Span.Start;
Symbols\Source\SourceMethodSymbolWithAttributes.cs (1)
47
return constructor.Initializer ?? (CSharpSyntaxNode?)constructor.
Body
?? constructor.ExpressionBody;
Syntax.xml.Main.Generated.cs (1)
2068
=> node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Identifier), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), (ConstructorInitializerSyntax?)Visit(node.Initializer), (BlockSyntax?)Visit(node.
Body
), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken));
Syntax.xml.Syntax.Generated.cs (10)
12791
if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || parameterList != this.ParameterList || initializer != this.Initializer || body != this.
Body
|| expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken)
12802
public new ConstructorDeclarationSyntax WithAttributeLists(SyntaxList<AttributeListSyntax> attributeLists) => Update(attributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.
Body
, this.ExpressionBody, this.SemicolonToken);
12804
public new ConstructorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Identifier, this.ParameterList, this.Initializer, this.
Body
, this.ExpressionBody, this.SemicolonToken);
12805
public ConstructorDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, identifier, this.ParameterList, this.Initializer, this.
Body
, this.ExpressionBody, this.SemicolonToken);
12807
public new ConstructorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.Identifier, parameterList, this.Initializer, this.
Body
, this.ExpressionBody, this.SemicolonToken);
12808
public ConstructorDeclarationSyntax WithInitializer(ConstructorInitializerSyntax? initializer) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, initializer, this.
Body
, this.ExpressionBody, this.SemicolonToken);
12812
public new ConstructorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.
Body
, expressionBody, this.SemicolonToken);
12814
public new ConstructorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.
Body
, this.ExpressionBody, semicolonToken);
12825
var body = this.
Body
?? SyntaxFactory.Block();
12831
var body = this.
Body
?? SyntaxFactory.Block();
Syntax\LookupPosition.cs (2)
182
var hasBody = constructorDecl.
Body
!= null || constructorDecl.ExpressionBody != null;
195
constructorDecl.SemicolonToken.Kind() == SyntaxKind.None ? constructorDecl.
Body
!.CloseBraceToken : constructorDecl.SemicolonToken);
Microsoft.CodeAnalysis.CSharp.CodeStyle (6)
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForConstructorsHelper.cs (1)
32
=> declaration.
Body
;
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (3)
312
if (primaryConstructorDeclaration is {
Body
: null, ExpressionBody: null })
391
var body = primaryConstructorDeclaration.ExpressionBody ?? (SyntaxNode?)primaryConstructorDeclaration.
Body
;
399
{
Body
: { } block }
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (2)
134
if (constructorDeclarationNode?.
Body
!= null)
136
AddSuppressWrappingIfOnSingleLineOperation(list, constructorInitializerNode.ColonToken, constructorDeclarationNode.
Body
.CloseBraceToken);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (3)
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
453
Contract.ThrowIfNull(constructorDeclaration.
Body
);
454
foreach (var statement in constructorDeclaration.
Body
.Statements)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (1)
76
if (declaration.
Body
?.TryConvertToArrowExpressionBody(
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
Semantics\OutVarTests.cs (1)
18823
Assert.False(mm.TestOnlyTryGetBoundNodesFromMap(constructorDeclaration.
Body
).IsEmpty);
Microsoft.CodeAnalysis.CSharp.Features (22)
EditAndContinue\BreakpointSpans.cs (2)
461
if (constructorSyntax.
Body
!= null)
463
return CreateSpan(constructorSyntax.
Body
.OpenBraceToken);
EditAndContinue\DeclarationBody\OrdinaryInstanceConstructorDeclarationBody.cs (1)
18
=> (SyntaxNode?)constructor.
Body
?? constructor.ExpressionBody?.Expression!;
EditAndContinue\SyntaxUtilities.cs (2)
45
ConstructorDeclarationSyntax constructorDeclaration when constructorDeclaration.
Body
!= null || constructorDeclaration.ExpressionBody != null
47
? CreateSimpleBody(BlockOrExpression(constructorDeclaration.
Body
, constructorDeclaration.ExpressionBody))
LineSeparators\CSharpLineSeparatorService.cs (3)
163
if (constructorDecl.
Body
!= null &&
164
(constructorDecl.
Body
.OpenBraceToken.IsMissing ||
165
constructorDecl.
Body
.CloseBraceToken.IsMissing))
Organizing\Organizers\ConstructorDeclarationOrganizer.cs (1)
34
syntax.
Body
,
Snippets\CSharpConstructorSnippetProvider.cs (2)
81
static d => d.
Body
!,
88
static d => d.
Body
!,
SolutionCrawler\CSharpDocumentDifferenceService.cs (2)
24
return (constructor.
Body
!= null && GetBlockBodySpan(constructor.
Body
).Contains(span)) ||
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForConstructorsHelper.cs (1)
32
=> declaration.
Body
;
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (3)
312
if (primaryConstructorDeclaration is {
Body
: null, ExpressionBody: null })
391
var body = primaryConstructorDeclaration.ExpressionBody ?? (SyntaxNode?)primaryConstructorDeclaration.
Body
;
399
{
Body
: { } block }
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
453
Contract.ThrowIfNull(constructorDeclaration.
Body
);
454
foreach (var statement in constructorDeclaration.
Body
.Statements)
Structure\Providers\ConstructorDeclarationStructureProvider.cs (3)
24
if (constructorDeclaration.
Body
== null ||
25
constructorDeclaration.
Body
.OpenBraceToken.IsMissing ||
26
constructorDeclaration.
Body
.CloseBraceToken.IsMissing)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (2)
Semantics\ExpressionBodiedMemberTests.cs (2)
540
Assert.Contains("P1", model.LookupNames(tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single().
Body
.Position));
543
.
Body
.DescendantNodes().OfType<AssignmentExpressionSyntax>()
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Symbols\Source\NullablePublicAPITests.cs (1)
4904
.
Body
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (8)
Generated\Syntax.Test.xml.Generated.cs (2)
13490
Assert.Null(node.
Body
);
13493
var newNode = node.WithAttributeLists(node.AttributeLists).WithModifiers(node.Modifiers).WithIdentifier(node.Identifier).WithParameterList(node.ParameterList).WithInitializer(node.Initializer).WithBody(node.
Body
).WithExpressionBody(node.ExpressionBody).WithSemicolonToken(node.SemicolonToken);
Parsing\DeclarationParsingTests.cs (6)
3508
Assert.NotNull(cn.
Body
);
3509
Assert.NotEqual(default, cn.
Body
.OpenBraceToken);
3510
Assert.NotEqual(default, cn.
Body
.CloseBraceToken);
3544
Assert.NotNull(cn.
Body
);
3545
Assert.NotEqual(default, cn.
Body
.OpenBraceToken);
3546
Assert.NotEqual(default, cn.
Body
.CloseBraceToken);
Microsoft.CodeAnalysis.CSharp.Workspaces (4)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
2637
SyntaxKind.ConstructorDeclaration => ((ConstructorDeclarationSyntax)declaration).
Body
?.Statements,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (2)
134
if (constructorDeclarationNode?.
Body
!= null)
136
AddSuppressWrappingIfOnSingleLineOperation(list, constructorInitializerNode.ColonToken, constructorDeclarationNode.
Body
.CloseBraceToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (1)
76
if (declaration.
Body
?.TryConvertToArrowExpressionBody(
Roslyn.Diagnostics.CSharp.Analyzers (3)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (2)
134
if (constructorDeclarationNode?.
Body
!= null)
136
AddSuppressWrappingIfOnSingleLineOperation(list, constructorInitializerNode.ColonToken, constructorDeclarationNode.
Body
.CloseBraceToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (1)
76
if (declaration.
Body
?.TryConvertToArrowExpressionBody(