410 references to AccessorDeclarationSyntax
Microsoft.CodeAnalysis.CSharp (69)
Binder\Binder.CapturedParametersFinder.cs (1)
128
case
AccessorDeclarationSyntax
s:
Binder\Binder_Statements.cs (2)
3449
AccessorDeclarationSyntax
=> MessageID.IDS_FeatureExpressionBodiedAccessor,
3533
case
AccessorDeclarationSyntax
accessor:
Binder\BinderFactory.BinderFactoryVisitor.cs (1)
256
public override Binder VisitAccessorDeclaration(
AccessorDeclarationSyntax
parent)
Binder\LocalBinderFactory.cs (1)
194
public override void VisitAccessorDeclaration(
AccessorDeclarationSyntax
node)
Compilation\AttributeSemanticModel.cs (1)
164
internal override bool TryGetSpeculativeSemanticModelForMethodBodyCore(SyntaxTreeSemanticModel parentModel, int position,
AccessorDeclarationSyntax
accessor, out PublicSemanticModel? speculativeModel)
Compilation\CSharpSemanticModel.cs (4)
2529
public bool TryGetSpeculativeSemanticModelForMethodBody(int position,
AccessorDeclarationSyntax
accessor, out SemanticModel speculativeModel)
2537
internal abstract bool TryGetSpeculativeSemanticModelForMethodBodyCore(SyntaxTreeSemanticModel parentModel, int position,
AccessorDeclarationSyntax
accessor, out PublicSemanticModel speculativeModel);
3136
public abstract IMethodSymbol GetDeclaredSymbol(
AccessorDeclarationSyntax
declarationSyntax, CancellationToken cancellationToken = default(CancellationToken));
5057
case
AccessorDeclarationSyntax
accessor:
Compilation\InitializerSemanticModel.cs (1)
247
internal override bool TryGetSpeculativeSemanticModelForMethodBodyCore(SyntaxTreeSemanticModel parentModel, int position,
AccessorDeclarationSyntax
accessor, out PublicSemanticModel speculativeModel)
Compilation\MemberSemanticModel.cs (1)
658
public override IMethodSymbol GetDeclaredSymbol(
AccessorDeclarationSyntax
declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
Compilation\MemberSemanticModel.SpeculativeMemberSemanticModel.cs (1)
95
internal override bool TryGetSpeculativeSemanticModelForMethodBodyCore(SyntaxTreeSemanticModel parentModel, int position,
AccessorDeclarationSyntax
accessor, out PublicSemanticModel speculativeModel)
Compilation\MethodBodySemanticModel.cs (1)
199
internal override bool TryGetSpeculativeSemanticModelForMethodBodyCore(SyntaxTreeSemanticModel parentModel, int position,
AccessorDeclarationSyntax
accessor, out PublicSemanticModel speculativeModel)
Compilation\PublicSemanticModel.cs (1)
43
AccessorDeclarationSyntax
or
Compilation\SpeculativeSemanticModelWithMemberModel.cs (2)
316
public override IMethodSymbol GetDeclaredSymbol(
AccessorDeclarationSyntax
declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
546
internal override bool TryGetSpeculativeSemanticModelForMethodBodyCore(SyntaxTreeSemanticModel parentModel, int position,
AccessorDeclarationSyntax
accessor, out PublicSemanticModel? speculativeModel)
Compilation\SyntaxTreeSemanticModel.cs (9)
177
case
AccessorDeclarationSyntax
accessor:
654
internal sealed override bool TryGetSpeculativeSemanticModelForMethodBodyCore(SyntaxTreeSemanticModel parentModel, int position,
AccessorDeclarationSyntax
accessor, out PublicSemanticModel speculativeModel)
790
outsideMemberDecl = !LookupPosition.IsInBody(position, (
AccessorDeclarationSyntax
)memberDecl);
892
var
accessorDecl = (
AccessorDeclarationSyntax
)memberDecl;
1105
var
accessorDecl = (
AccessorDeclarationSyntax
)node;
1297
return (node is MemberDeclarationSyntax) || (node is
AccessorDeclarationSyntax
) ||
1573
public override IMethodSymbol GetDeclaredSymbol(
AccessorDeclarationSyntax
declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
Compiler\MethodCompiler.cs (2)
2024
case
AccessorDeclarationSyntax
:
2049
case
AccessorDeclarationSyntax
s:
CSharpDeclarationComputer.cs (5)
174
foreach (
var
decl in t.AccessorList.Accessors)
214
foreach (
var
decl in t.AccessorList.Accessors)
236
foreach (
var
decl in t.AccessorList.Accessors)
261
var
t = (
AccessorDeclarationSyntax
)node;
CSharpExtensions.cs (2)
1108
public static bool TryGetSpeculativeSemanticModelForMethodBody([NotNullWhen(true)] this SemanticModel? semanticModel, int position,
AccessorDeclarationSyntax
accessor, [NotNullWhen(true)] out SemanticModel? speculativeModel)
1467
public static IMethodSymbol? GetDeclaredSymbol(this SemanticModel? semanticModel,
AccessorDeclarationSyntax
declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (2)
608
AccessorDeclarationSyntax
accessorSyntax = (
AccessorDeclarationSyntax
)syntax;
Parser\LanguageParser.cs (1)
4815
return ((CSharp.Syntax.
AccessorDeclarationSyntax
)decl).Modifiers;
Symbols\Source\ModifierUtils.cs (1)
30
if (readonlyToken.Parent is MethodDeclarationSyntax or
AccessorDeclarationSyntax
or BasePropertyDeclarationSyntax or EventDeclarationSyntax)
Symbols\Source\SourceCustomEventAccessorSymbol.cs (4)
25
AccessorDeclarationSyntax
syntax,
61
internal
AccessorDeclarationSyntax
GetSyntax()
64
return (
AccessorDeclarationSyntax
)syntaxReferenceOpt.GetSyntax();
99
var
syntax = GetSyntax();
Symbols\Source\SourceCustomEventSymbol.cs (4)
76
AccessorDeclarationSyntax
? addSyntax = null;
77
AccessorDeclarationSyntax
? removeSyntax = null;
81
foreach (
AccessorDeclarationSyntax
accessor in syntax.AccessorList.Accessors)
233
private SourceCustomEventAccessorSymbol? CreateAccessorSymbol(CSharpCompilation compilation,
AccessorDeclarationSyntax
? syntaxOpt,
Symbols\Source\SourceMemberMethodSymbol.cs (1)
611
case
AccessorDeclarationSyntax
accessor:
Symbols\Source\SourceMethodSymbolWithAttributes.cs (1)
47
case
AccessorDeclarationSyntax
accessor:
Symbols\Source\SourcePropertyAccessorSymbol.cs (2)
33
AccessorDeclarationSyntax
syntax,
641
return OneOrMany.Create(((
AccessorDeclarationSyntax
)syntax).AttributeLists);
Symbols\Source\SourcePropertySymbol.cs (6)
183
foreach (
var
accessor in syntax.AccessorList!.Accessors)
238
private static
AccessorDeclarationSyntax
GetGetAccessorDeclaration(BasePropertyDeclarationSyntax syntax)
240
foreach (
var
accessor in syntax.AccessorList!.Accessors)
252
private static
AccessorDeclarationSyntax
GetSetAccessorDeclaration(BasePropertyDeclarationSyntax syntax)
254
foreach (
var
accessor in syntax.AccessorList!.Accessors)
401
AccessorDeclarationSyntax
syntax,
Syntax\CSharpSyntaxNode.cs (1)
543
if (parent is MemberDeclarationSyntax || parent is
AccessorDeclarationSyntax
)
Syntax\LookupPosition.cs (2)
65
internal static bool IsInBody(int position,
AccessorDeclarationSyntax
method)
140
internal static bool IsInMethodDeclaration(int position,
AccessorDeclarationSyntax
accessorDecl)
Syntax\PropertyDeclarationSyntax.cs (2)
34
public
AccessorDeclarationSyntax
Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, BlockSyntax? body, SyntaxToken semicolonToken)
44
public static
AccessorDeclarationSyntax
AccessorDeclaration(SyntaxKind kind, BlockSyntax? body)
Syntax\SyntaxExtensions.cs (1)
44
arrowExpr = ((
AccessorDeclarationSyntax
)node).ExpressionBody;
Syntax\SyntaxFactory.cs (4)
2675
public static
AccessorDeclarationSyntax
AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, BlockSyntax body)
2677
public static
AccessorDeclarationSyntax
AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, BlockSyntax body, SyntaxToken semicolonToken)
2679
public static
AccessorDeclarationSyntax
AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, ArrowExpressionClauseSyntax expressionBody)
2681
public static
AccessorDeclarationSyntax
AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
Syntax\SyntaxNormalizer.cs (2)
433
else if (currentToken.Parent is
AccessorDeclarationSyntax
&&
1364
node is
AccessorDeclarationSyntax
||
Microsoft.CodeAnalysis.CSharp.CodeStyle (40)
AnchorIndentationFormattingRule.cs (1)
66
case
AccessorDeclarationSyntax
accessorDeclNode:
ArrowExpressionClausePlacementDiagnosticAnalyzer.cs (1)
63
if (arrowExpressionClause.Parent is
AccessorDeclarationSyntax
)
CSharpAccessibilityFacts.cs (1)
315
AccessorDeclarationSyntax
accessor => accessor.Modifiers,
CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
101
AccessorDeclarationSyntax
accessorDeclaration => accessorDeclaration.Keyword,
CSharpOrderModifiersDiagnosticAnalyzer.cs (1)
52
foreach (
var
accessor in accessorList.Accessors)
CSharpSyntaxFacts.cs (1)
263
AccessorDeclarationSyntax
;
CSharpUseAutoPropertyAnalyzer.cs (5)
176
AccessorDeclarationSyntax
accessorDeclaration =>
184
private static T? GetSingleStatementFromAccessor<T>(
AccessorDeclarationSyntax
? accessorDeclaration) where T : StatementSyntax
196
var
setAccessor = setMethod.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken) as
AccessorDeclarationSyntax
;
209
private static ExpressionSyntax? GetExpressionFromSetter(
AccessorDeclarationSyntax
? setAccessor)
CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
95
AccessorDeclarationSyntax
(SyntaxKind.GetAccessorDeclaration) { Parent: AccessorListSyntax { Parent: BasePropertyDeclarationSyntax baseProperty } } accessor => baseProperty.Type,
EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
110
AccessorDeclarationSyntax
or
FormattingRangeHelper.cs (1)
134
if (parent is
AccessorDeclarationSyntax
)
NewLineUserSettingFormattingRule.cs (2)
160
if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is
AccessorDeclarationSyntax
)
366
if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is
AccessorDeclarationSyntax
)
SuppressFormattingRule.cs (1)
177
if (node is
AccessorDeclarationSyntax
accessorDeclNode)
SyntaxNodeExtensions.cs (3)
183
AccessorDeclarationSyntax
accessor => accessor.AttributeLists,
867
AccessorDeclarationSyntax
accessor => accessor.Modifiers,
881
case
AccessorDeclarationSyntax
accessor: return accessor.WithModifiers(modifiers);
TokenBasedFormattingRule.cs (2)
205
AccessorDeclarationSyntax
)
377
previousToken.IsLastTokenOfNode<
AccessorDeclarationSyntax
>())
UseExpressionBodyForAccessorsHelper.cs (11)
15
UseExpressionBodyHelper<
AccessorDeclarationSyntax
>
32
protected override BlockSyntax? GetBody(
AccessorDeclarationSyntax
declaration)
35
protected override ArrowExpressionClauseSyntax? GetExpressionBody(
AccessorDeclarationSyntax
declaration)
38
protected override SyntaxToken GetSemicolonToken(
AccessorDeclarationSyntax
declaration)
41
protected override
AccessorDeclarationSyntax
WithSemicolonToken(
AccessorDeclarationSyntax
declaration, SyntaxToken token)
44
protected override
AccessorDeclarationSyntax
WithExpressionBody(
AccessorDeclarationSyntax
declaration, ArrowExpressionClauseSyntax? expressionBody)
47
protected override
AccessorDeclarationSyntax
WithBody(
AccessorDeclarationSyntax
declaration, BlockSyntax? body)
50
protected override bool CreateReturnStatementForExpression(SemanticModel semanticModel,
AccessorDeclarationSyntax
declaration)
UseExpressionBodyForIndexersHelper.cs (1)
85
var
getAccessor = GetSingleGetAccessor(declaration.AccessorList);
UseExpressionBodyForPropertiesHelper.cs (1)
85
var
getAccessor = GetSingleGetAccessor(declaration.AccessorList);
UseExpressionBodyHelper`1.cs (4)
50
protected static
AccessorDeclarationSyntax
? GetSingleGetAccessor(AccessorListSyntax? accessorList)
156
var
getAccessor = GetSingleGetAccessor(declaration.AccessorList);
198
if (declaration is
AccessorDeclarationSyntax
or ConstructorDeclarationSyntax)
296
var
accessor = SyntaxFactory.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration);
WrappingFormattingRule.cs (1)
169
if (node is
AccessorDeclarationSyntax
accessorDeclaration && accessorDeclaration.Body != null)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (21)
CSharpCodeGenerationService.cs (4)
335
AccessorDeclarationSyntax
accessor => Cast<TDeclarationNode>(accessor.AddAttributeLists(attributeSyntaxList)),
406
case
AccessorDeclarationSyntax
accessor:
410
var
newAccessor = accessor.WithAttributeLists(newAttributeLists);
500
else if (destinationMember is
AccessorDeclarationSyntax
accessorDeclaration)
CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (3)
59
else if (declaration is
AccessorDeclarationSyntax
{ Parent: AccessorListSyntax { Parent: BasePropertyDeclarationSyntax property } accessorList } accessor)
81
var
currentAccessor = currentAccessorList.Accessors.First(a => a.Kind() == accessor.Kind());
82
var
otherAccessor = currentAccessorList.Accessors.Single(a => a != currentAccessor);
CSharpMakeTypeAbstractCodeFixProvider.cs (1)
42
case
AccessorDeclarationSyntax
accessor:
EventGenerator.cs (3)
141
var accessors = new List<
AccessorDeclarationSyntax
?>
150
private static
AccessorDeclarationSyntax
? GenerateAccessorDeclaration(
163
private static
AccessorDeclarationSyntax
GenerateAccessorDeclaration(
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs\SyntaxTokenExtensions.cs (3)
587
targetToken.Parent.Parent is
AccessorDeclarationSyntax
)
594
targetToken.Parent is
AccessorDeclarationSyntax
)
602
targetToken.Parent.Parent is
AccessorDeclarationSyntax
)
PropertyGenerator.cs (7)
161
var
accessor = accessorList.Accessors[0];
214
private static
AccessorDeclarationSyntax
UseExpressionBodyIfDesired(
215
CSharpCodeGenerationContextInfo info,
AccessorDeclarationSyntax
declaration)
233
SyntaxKind declaratoinKind,
AccessorDeclarationSyntax
accessor, LanguageVersion languageVersion, ExpressionBodyPreference preference,
272
private static
AccessorDeclarationSyntax
? GenerateAccessorDeclaration(
285
private static
AccessorDeclarationSyntax
GenerateAccessorDeclaration(
292
var
declaration = SyntaxFactory.AccessorDeclaration(kind)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (12)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (2)
334
or
AccessorDeclarationSyntax
410
or
AccessorDeclarationSyntax
)
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (10)
468
AccessorDeclarationSyntax
accessorDeclarationNode => ShouldAddBraceForAccessorDeclaration(accessorDeclarationNode),
547
private static bool ShouldAddBraceForAccessorDeclaration(
AccessorDeclarationSyntax
accessorDeclarationNode)
776
AccessorDeclarationSyntax
accessorDeclarationNode => ShouldRemoveBraceForAccessorDeclaration(accessorDeclarationNode, caretPosition),
795
private static bool ShouldRemoveBraceForAccessorDeclaration(
AccessorDeclarationSyntax
accessorDeclarationNode, int caretPosition)
876
AccessorDeclarationSyntax
accessorDeclarationNode => AddBlockToAccessorDeclaration(accessorDeclarationNode, formattingOptions),
921
private static
AccessorDeclarationSyntax
AddBlockToAccessorDeclaration(
922
AccessorDeclarationSyntax
accessorDeclarationNode,
972
AccessorDeclarationSyntax
accessorDeclarationNode => RemoveBodyForAccessorDeclarationNode(accessorDeclarationNode),
1029
private static
AccessorDeclarationSyntax
RemoveBodyForAccessorDeclarationNode(
AccessorDeclarationSyntax
accessorDeclarationNode)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (4)
Structure\AccessorDeclarationStructureTests.cs (1)
17
public class AccessorDeclarationStructureTests : AbstractCSharpSyntaxNodeStructureTests<
AccessorDeclarationSyntax
>
Structure\MetadataAsSource\AccessorDeclarationStructureTests.cs (1)
17
public class AccessorDeclarationStructureTests : AbstractCSharpSyntaxNodeStructureTests<
AccessorDeclarationSyntax
>
SymbolKey\SymbolKeyTestBase.cs (2)
135
else if (node is
AccessorDeclarationSyntax
accessor)
303
else if (node is
AccessorDeclarationSyntax
accessor)
Microsoft.CodeAnalysis.CSharp.Features (117)
ArrowExpressionClausePlacementDiagnosticAnalyzer.cs (1)
63
if (arrowExpressionClause.Parent is
AccessorDeclarationSyntax
)
BraceCompletion\CurlyBraceCompletionService.cs (1)
159
if (currentTokenParentParent is
AccessorDeclarationSyntax
)
Completion\CompletionProviders\OverrideCompletionProvider.cs (1)
229
var
firstAccessor = propertyDeclaration.AccessorList.Accessors[0];
ConvertAutoPropertyToFullProperty\CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (7)
72
private static (
AccessorDeclarationSyntax
getAccessor,
AccessorDeclarationSyntax
setAccessor)
82
var
accessorDeclarationSyntax = (
AccessorDeclarationSyntax
)newAccessor;
110
.WithTrailingTrivia(((
AccessorDeclarationSyntax
)accessor).SemicolonToken.TrailingTrivia));
112
return ((
AccessorDeclarationSyntax
)accessor).WithBody(blockSyntax);
130
var
getAccessor = propertyDeclaration.AccessorList.Accessors[0];
CSharpDeclarationComputer.cs (5)
174
foreach (
var
decl in t.AccessorList.Accessors)
214
foreach (
var
decl in t.AccessorList.Accessors)
236
foreach (
var
decl in t.AccessorList.Accessors)
261
var
t = (
AccessorDeclarationSyntax
)node;
CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
101
AccessorDeclarationSyntax
accessorDeclaration => accessorDeclaration.Keyword,
CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (3)
59
else if (declaration is
AccessorDeclarationSyntax
{ Parent: AccessorListSyntax { Parent: BasePropertyDeclarationSyntax property } accessorList } accessor)
81
var
currentAccessor = currentAccessorList.Accessors.First(a => a.Kind() == accessor.Kind());
82
var
otherAccessor = currentAccessorList.Accessors.Single(a => a != currentAccessor);
CSharpMakeTypeAbstractCodeFixProvider.cs (1)
42
case
AccessorDeclarationSyntax
accessor:
CSharpOrderModifiersDiagnosticAnalyzer.cs (1)
52
foreach (
var
accessor in accessorList.Accessors)
CSharpUseAutoPropertyAnalyzer.cs (5)
176
AccessorDeclarationSyntax
accessorDeclaration =>
184
private static T? GetSingleStatementFromAccessor<T>(
AccessorDeclarationSyntax
? accessorDeclaration) where T : StatementSyntax
196
var
setAccessor = setMethod.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken) as
AccessorDeclarationSyntax
;
209
private static ExpressionSyntax? GetExpressionFromSetter(
AccessorDeclarationSyntax
? setAccessor)
CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
95
AccessorDeclarationSyntax
(SyntaxKind.GetAccessorDeclaration) { Parent: AccessorListSyntax { Parent: BasePropertyDeclarationSyntax baseProperty } } accessor => baseProperty.Type,
Debugging\CSharpProximityExpressionsService.Worker.cs (2)
62
if (_parentStatement.GetAncestorOrThis<
AccessorDeclarationSyntax
>() is (kind:
140
block.Parent is
AccessorDeclarationSyntax
&&
Debugging\LocationInfoGetter.cs (2)
62
var
accessor = memberDeclaration.GetAncestorOrThis<
AccessorDeclarationSyntax
>();
EditAndContinue\BreakpointSpans.cs (3)
214
var
accessor = (
AccessorDeclarationSyntax
)node;
776
private static TextSpan? CreateSpanForAccessors(SyntaxList<
AccessorDeclarationSyntax
> accessors, int position)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (3)
1221
if (declaration is
AccessorDeclarationSyntax
{ Parent: AccessorListSyntax { Parent: PropertyDeclarationSyntax property } list } &&
1686
var
accessorDeclaration = (
AccessorDeclarationSyntax
)node;
EditAndContinue\SyntaxComparer.cs (1)
761
case
AccessorDeclarationSyntax
accessorDeclarationSyntax: return accessorDeclarationSyntax.Body ?? (SyntaxNode?)accessorDeclarationSyntax.ExpressionBody?.Expression;
EditAndContinue\SyntaxUtilities.cs (3)
46
var
accessorDeclaration = (
AccessorDeclarationSyntax
)node;
217
var
firstGetter = accessorList?.Accessors.Where(a => a.IsKind(SyntaxKind.GetAccessorDeclaration)).FirstOrDefault();
EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
110
AccessorDeclarationSyntax
or
ExtractMethod\CSharpMethodExtractor.cs (2)
105
var
accessorNode = basePosition.GetAncestor<
AccessorDeclarationSyntax
>();
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (2)
324
private SyntaxList<
AccessorDeclarationSyntax
> ReplaceAccessors(SyntaxList<
AccessorDeclarationSyntax
> accessors)
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (1)
184
=> node is
AccessorDeclarationSyntax
accessor && accessor.ExpressionBody != null;
ExtractMethod\CSharpSelectionResult.StatementResult.cs (4)
40
AccessorDeclarationSyntax
_ => false,
58
return n is
AccessorDeclarationSyntax
or
61
AccessorDeclarationSyntax
or
78
case
AccessorDeclarationSyntax
access:
ExtractMethod\Extensions.cs (2)
59
case
AccessorDeclarationSyntax
a: return a.Body;
81
AccessorDeclarationSyntax
or
GenerateConstructorFromMembers\CSharpGenerateConstructorFromMembersCodeRefactoringProvider.cs (1)
69
var
getAccessor = propertyDeclaration.AccessorList?.Accessors.FirstOrDefault(a => a.Kind() == SyntaxKind.GetAccessorDeclaration);
InitializeParameter\CSharpInitializeMemberFromParameterCodeRefactoringProvider.cs (4)
61
if (node is
AccessorDeclarationSyntax
accessorDeclaration)
99
private static
AccessorDeclarationSyntax
RemoveThrowNotImplemented(
AccessorDeclarationSyntax
accessorDeclaration)
101
var
result = accessorDeclaration
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
260
case
AccessorDeclarationSyntax
accessor:
InvertIf\CSharpInvertIfCodeRefactoringProvider.cs (2)
73
case
AccessorDeclarationSyntax
:
99
LocalFunctionStatementSyntax or
AccessorDeclarationSyntax
or MemberDeclarationSyntax
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (14)
98
var
accessor =
119
var
getAccessor = CreateGetAccessor(getAndSetMethods, options, languageVersion);
120
var
setAccessor = CreateSetAccessor(semanticModel, generator, getAndSetMethods, options, languageVersion);
162
private static
AccessorDeclarationSyntax
CreateGetAccessor(
165
var
accessorDeclaration = CreateGetAccessorWorker(getAndSetMethods);
171
private static
AccessorDeclarationSyntax
UseExpressionOrBlockBodyIfDesired(
173
AccessorDeclarationSyntax
accessorDeclaration)
205
private static
AccessorDeclarationSyntax
CreateGetAccessorWorker(GetAndSetMethods getAndSetMethods)
209
var
accessor = SyntaxFactory.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration);
230
private static
AccessorDeclarationSyntax
CreateSetAccessor(
234
var
accessorDeclaration = CreateSetAccessorWorker(semanticModel, generator, getAndSetMethods);
238
private static
AccessorDeclarationSyntax
CreateSetAccessorWorker(
248
var
accessor = SyntaxFactory.AccessorDeclaration(SyntaxKind.SetAccessorDeclaration);
252
accessor = (
AccessorDeclarationSyntax
)generator.WithAccessibility(accessor, setMethod.DeclaredAccessibility);
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (4)
125
var
setAccessorDeclaration = (
AccessorDeclarationSyntax
)setMethod.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken);
198
var
getAccessorDeclaration = (
AccessorDeclarationSyntax
)getMethod.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken);
Snippets\AbstractCSharpAutoPropertySnippetProvider.cs (6)
27
protected virtual
AccessorDeclarationSyntax
? GenerateGetAccessorDeclaration(CSharpSyntaxContext syntaxContext, SyntaxGenerator generator)
28
=> (
AccessorDeclarationSyntax
)generator.GetAccessorDeclaration();
30
protected virtual
AccessorDeclarationSyntax
? GenerateSetAccessorDeclaration(CSharpSyntaxContext syntaxContext, SyntaxGenerator generator)
31
=> (
AccessorDeclarationSyntax
)generator.SetAccessorDeclaration();
49
var accessors = new
AccessorDeclarationSyntax
?[]
69
accessorList: SyntaxFactory.AccessorList(new SyntaxList<
AccessorDeclarationSyntax
>(accessors.Where(a => a is not null)!)));
Snippets\CSharpPropgSnippetProvider.cs (2)
29
protected override
AccessorDeclarationSyntax
? GenerateSetAccessorDeclaration(CSharpSyntaxContext syntaxContext, SyntaxGenerator generator)
47
return (
AccessorDeclarationSyntax
)generator.SetAccessorDeclaration(Accessibility.Private);
Snippets\CSharpPropiSnippetProvider.cs (1)
29
protected override
AccessorDeclarationSyntax
? GenerateSetAccessorDeclaration(CSharpSyntaxContext syntaxContext, SyntaxGenerator generator)
Snippets\CSharpPropSnippetProvider.cs (1)
29
protected override
AccessorDeclarationSyntax
? GenerateSetAccessorDeclaration(CSharpSyntaxContext syntaxContext, SyntaxGenerator generator)
Structure\CSharpBlockStructureProvider.cs (1)
20
builder.Add<
AccessorDeclarationSyntax
, AccessorDeclarationStructureProvider>();
Structure\Providers\AccessorDeclarationStructureProvider.cs (3)
12
internal class AccessorDeclarationStructureProvider : AbstractSyntaxNodeStructureProvider<
AccessorDeclarationSyntax
>
16
AccessorDeclarationSyntax
accessorDeclaration,
38
&& (!nextSibling.IsNode || nextSibling.AsNode() is
AccessorDeclarationSyntax
);
UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (6)
58
var
accessor = SyntaxFactory.AccessorDeclaration(SyntaxKind.SetAccessorDeclaration)
64
accessor = (
AccessorDeclarationSyntax
)generator.WithAccessibility(accessor, fieldSymbol.DeclaredAccessibility);
167
var
getter = SyntaxFactory.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration)
175
private static IEnumerable<
AccessorDeclarationSyntax
> GetAccessors(SyntaxList<
AccessorDeclarationSyntax
> accessors)
177
foreach (
var
accessor in accessors)
UseExpressionBody\UseExpressionBodyCodeRefactoringProvider.cs (1)
181
var parent = declaration is
AccessorDeclarationSyntax
UseExpressionBodyForAccessorsHelper.cs (11)
15
UseExpressionBodyHelper<
AccessorDeclarationSyntax
>
32
protected override BlockSyntax? GetBody(
AccessorDeclarationSyntax
declaration)
35
protected override ArrowExpressionClauseSyntax? GetExpressionBody(
AccessorDeclarationSyntax
declaration)
38
protected override SyntaxToken GetSemicolonToken(
AccessorDeclarationSyntax
declaration)
41
protected override
AccessorDeclarationSyntax
WithSemicolonToken(
AccessorDeclarationSyntax
declaration, SyntaxToken token)
44
protected override
AccessorDeclarationSyntax
WithExpressionBody(
AccessorDeclarationSyntax
declaration, ArrowExpressionClauseSyntax? expressionBody)
47
protected override
AccessorDeclarationSyntax
WithBody(
AccessorDeclarationSyntax
declaration, BlockSyntax? body)
50
protected override bool CreateReturnStatementForExpression(SemanticModel semanticModel,
AccessorDeclarationSyntax
declaration)
UseExpressionBodyForIndexersHelper.cs (1)
85
var
getAccessor = GetSingleGetAccessor(declaration.AccessorList);
UseExpressionBodyForPropertiesHelper.cs (1)
85
var
getAccessor = GetSingleGetAccessor(declaration.AccessorList);
UseExpressionBodyHelper`1.cs (4)
50
protected static
AccessorDeclarationSyntax
? GetSingleGetAccessor(AccessorListSyntax? accessorList)
156
var
getAccessor = GetSingleGetAccessor(declaration.AccessorList);
198
if (declaration is
AccessorDeclarationSyntax
or ConstructorDeclarationSyntax)
296
var
accessor = SyntaxFactory.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration);
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (10)
IOperation\IOperationTests_IMethodBodyOperation.cs (10)
978
var
node1 = tree.GetRoot().DescendantNodes().OfType<
AccessorDeclarationSyntax
>().Single();
1000
var
node1 = tree.GetRoot().DescendantNodes().OfType<
AccessorDeclarationSyntax
>().Single();
1035
var
node1 = tree.GetRoot().DescendantNodes().OfType<
AccessorDeclarationSyntax
>().First();
1080
var
node1 = tree.GetRoot().DescendantNodes().OfType<
AccessorDeclarationSyntax
>().First();
1124
var
node1 = tree.GetRoot().DescendantNodes().OfType<
AccessorDeclarationSyntax
>().Single();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (11)
Semantics\InitOnlyMemberTests.cs (3)
3135
AccessorDeclarationSyntax
accessorDecl = root.DescendantNodes().OfType<
AccessorDeclarationSyntax
>().Single();
3137
var
speculatedMethod = accessorDecl.ReplaceNode(accessorDecl.Body, blockStatement);
Semantics\OutVarTests.cs (2)
36116
var
declarationSyntax = tree.GetRoot().DescendantNodes().OfType<
AccessorDeclarationSyntax
>().Single();
Semantics\QueryTests.cs (1)
2357
var unknownAccessorDecls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<
AccessorDeclarationSyntax
>();
Semantics\SuppressAccessibilityChecksTests.cs (3)
215
AccessorDeclarationSyntax
accessorDecl = root.DescendantNodes().OfType<
AccessorDeclarationSyntax
>().Single();
217
var
speculatedMethod = accessorDecl.ReplaceNode(accessorDecl.Body, blockStatement);
SourceGeneration\GeneratorDriverTests_Attributes_FullyQualifiedName.cs (2)
749
var input = ctx.ForAttributeWithMetadataName<
AccessorDeclarationSyntax
>("System.CLSCompliantAttribute");
758
step => Assert.True(step.Outputs.Single().Value is
AccessorDeclarationSyntax
{ RawKind: (int)SyntaxKind.GetAccessorDeclaration }));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (15)
Compilation\SemanticModelAPITests.cs (8)
2310
var
accessorSyntax = tree.GetRoot().DescendantNodes().OfType<
AccessorDeclarationSyntax
>().Single();
2445
var
methodDecl = indexerDecl.AccessorList.Accessors[0];
2448
var
speculatedMethod = methodDecl.ReplaceNode(methodDecl.Body, blockStatement);
2487
var
methodDecl = propertyDecl.AccessorList.Accessors[0];
2490
var
speculatedMethod = methodDecl.ReplaceNode(methodDecl.Body, blockStatement);
2532
var
methodDecl = eventDecl.AccessorList.Accessors[0];
2535
var
speculatedMethod = methodDecl.ReplaceNode(methodDecl.Body, blockStatement);
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (7)
309
foreach (
var
accessorDecl in accessorList)
336
var
getterDecl = indexerDecl.AccessorList.Accessors[0];
337
var
setterDecl = indexerDecl.AccessorList.Accessors[1];
2869
var
explicitPropertyGetterNode = explicitPropertyAccessors[0];
2879
var
explicitPropertySetterNode = explicitPropertyAccessors[1];
3177
var
accessorDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<
AccessorDeclarationSyntax
>().Single();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (13)
Generated\Syntax.Test.xml.Generated.cs (6)
10551
=> SyntaxFactory.AccessorList(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), new SyntaxList<
AccessorDeclarationSyntax
>(), SyntaxFactory.Token(SyntaxKind.CloseBraceToken));
10553
private static
AccessorDeclarationSyntax
GenerateAccessorDeclaration()
13120
var
node = GenerateAccessorDeclaration();
13128
var
newNode = node.WithAttributeLists(node.AttributeLists).WithModifiers(node.Modifiers).WithKeyword(node.Keyword).WithBody(node.Body).WithExpressionBody(node.ExpressionBody).WithSemicolonToken(node.SemicolonToken);
18663
var
oldNode = GenerateAccessorDeclaration();
18679
var
oldNode = GenerateAccessorDeclaration();
Parsing\ParsingErrorRecoveryTests.cs (6)
5659
var
acc = pd.AccessorList.Accessors[0];
5694
var
acc = pd.AccessorList.Accessors[0];
5733
var
acc = pd.AccessorList.Accessors[0];
5767
var
getDecl = accessorDecls[0];
5799
var
getDecl = accessorDecls[0];
5804
var
setDecl = accessorDecls[1];
Syntax\SyntaxTests.cs (1)
153
var
t = SyntaxFactory.AccessorDeclaration(SyntaxKind.UnknownAccessorDeclaration);
Microsoft.CodeAnalysis.CSharp.Workspaces (69)
AnchorIndentationFormattingRule.cs (1)
66
case
AccessorDeclarationSyntax
accessorDeclNode:
CodeGeneration\CSharpSyntaxGenerator.cs (29)
379
var accessors = new List<
AccessorDeclarationSyntax
>();
381
accessors.AddIfNotNull((
AccessorDeclarationSyntax
?)getAccessor);
382
accessors.AddIfNotNull((
AccessorDeclarationSyntax
?)setAccessor);
406
var
accessor = SyntaxFactory.AccessorDeclaration(kind);
433
var list = SyntaxFactory.List(accessorDeclarations.Cast<
AccessorDeclarationSyntax
>());
447
var accessors = new List<
AccessorDeclarationSyntax
>();
497
private static
AccessorDeclarationSyntax
AccessorDeclaration(SyntaxKind kind, IEnumerable<SyntaxNode>? statements)
499
var
ad = SyntaxFactory.AccessorDeclaration(
535
var accessors = new List<
AccessorDeclarationSyntax
>();
654
private static
AccessorDeclarationSyntax
WithBody(
AccessorDeclarationSyntax
accessor)
669
private static
AccessorDeclarationSyntax
WithoutBody(
AccessorDeclarationSyntax
accessor)
1191
AccessorDeclarationSyntax
accessor => accessor.AttributeLists,
1202
AccessorDeclarationSyntax
accessor => accessor.WithAttributeLists(attributeLists),
1652
AccessorDeclarationSyntax
accessor => accessor.WithModifiers(modifiers),
2491
return ((
AccessorDeclarationSyntax
)declaration).Body?.Statements ?? s_EmptyList;
2527
return ((
AccessorDeclarationSyntax
)declaration).WithBody(somebody).WithSemicolonToken(semicolon).WithExpressionBody(null);
2585
private static
AccessorDeclarationSyntax
? AsAccessor(SyntaxNode node, SyntaxKind parentKind)
2595
return (
AccessorDeclarationSyntax
)node;
2604
return (
AccessorDeclarationSyntax
)node;
2613
private static
AccessorDeclarationSyntax
? GetAccessor(SyntaxNode declaration, SyntaxKind kind)
2619
private SyntaxNode WithAccessor(SyntaxNode declaration, SyntaxKind kind,
AccessorDeclarationSyntax
accessor)
2622
private SyntaxNode WithAccessor(SyntaxNode declaration, AccessorListSyntax? accessorList, SyntaxKind kind,
AccessorDeclarationSyntax
? accessor)
2626
var
acc = accessorList.Accessors.FirstOrDefault(a => a.IsKind(kind));
2642
var
accessor = GetAccessor(declaration, SyntaxKind.GetAccessorDeclaration);
2648
var
accessor = GetAccessor(declaration, SyntaxKind.SetAccessorDeclaration);
2660
var
accessor = GetAccessor(declaration, kind);
2668
return this.WithAccessor(declaration, kind, (
AccessorDeclarationSyntax
)this.WithStatements(accessor, statements));
CSharpAccessibilityFacts.cs (1)
315
AccessorDeclarationSyntax
accessor => accessor.Modifiers,
CSharpCodeGenerationService.cs (4)
335
AccessorDeclarationSyntax
accessor => Cast<TDeclarationNode>(accessor.AddAttributeLists(attributeSyntaxList)),
406
case
AccessorDeclarationSyntax
accessor:
410
var
newAccessor = accessor.WithAttributeLists(newAttributeLists);
500
else if (destinationMember is
AccessorDeclarationSyntax
accessorDeclaration)
CSharpSyntaxFacts.cs (1)
263
AccessorDeclarationSyntax
;
EventGenerator.cs (3)
141
var accessors = new List<
AccessorDeclarationSyntax
?>
150
private static
AccessorDeclarationSyntax
? GenerateAccessorDeclaration(
163
private static
AccessorDeclarationSyntax
GenerateAccessorDeclaration(
FormattingRangeHelper.cs (1)
134
if (parent is
AccessorDeclarationSyntax
)
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs\SyntaxNodeExtensions.cs (3)
183
AccessorDeclarationSyntax
accessor => accessor.AttributeLists,
867
AccessorDeclarationSyntax
accessor => accessor.Modifiers,
881
case
AccessorDeclarationSyntax
accessor: return accessor.WithModifiers(modifiers);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs\SyntaxTokenExtensions.cs (3)
587
targetToken.Parent.Parent is
AccessorDeclarationSyntax
)
594
targetToken.Parent is
AccessorDeclarationSyntax
)
602
targetToken.Parent.Parent is
AccessorDeclarationSyntax
)
NewLineUserSettingFormattingRule.cs (2)
160
if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is
AccessorDeclarationSyntax
)
366
if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is
AccessorDeclarationSyntax
)
PropertyGenerator.cs (7)
161
var
accessor = accessorList.Accessors[0];
214
private static
AccessorDeclarationSyntax
UseExpressionBodyIfDesired(
215
CSharpCodeGenerationContextInfo info,
AccessorDeclarationSyntax
declaration)
233
SyntaxKind declaratoinKind,
AccessorDeclarationSyntax
accessor, LanguageVersion languageVersion, ExpressionBodyPreference preference,
272
private static
AccessorDeclarationSyntax
? GenerateAccessorDeclaration(
285
private static
AccessorDeclarationSyntax
GenerateAccessorDeclaration(
292
var
declaration = SyntaxFactory.AccessorDeclaration(kind)
Rename\CSharpRenameRewriterLanguageService.cs (4)
265
&& IsNameConflictWithProperty("get", token.Parent as
AccessorDeclarationSyntax
);
269
&& IsNameConflictWithProperty("set", token.Parent as
AccessorDeclarationSyntax
);
274
&& IsNameConflictWithProperty("set", token.Parent as
AccessorDeclarationSyntax
);
276
private bool IsNameConflictWithProperty(string prefix,
AccessorDeclarationSyntax
? accessor)
SemanticModelReuse\CSharpSemanticModelReuseLanguageService.cs (6)
23
AccessorDeclarationSyntax
>
33
protected override BasePropertyDeclarationSyntax GetBasePropertyDeclaration(
AccessorDeclarationSyntax
accessor)
40
protected override SyntaxList<
AccessorDeclarationSyntax
> GetAccessors(BasePropertyDeclarationSyntax baseProperty)
51
if (current is
AccessorDeclarationSyntax
accessor)
68
if (previousBodyNode is
AccessorDeclarationSyntax
previousAccessorDeclaration &&
69
currentBodyNode is
AccessorDeclarationSyntax
currentAccessorDeclaration &&
SuppressFormattingRule.cs (1)
177
if (node is
AccessorDeclarationSyntax
accessorDeclNode)
TokenBasedFormattingRule.cs (2)
205
AccessorDeclarationSyntax
)
377
previousToken.IsLastTokenOfNode<
AccessorDeclarationSyntax
>())
WrappingFormattingRule.cs (1)
169
if (node is
AccessorDeclarationSyntax
accessorDeclaration && accessorDeclaration.Body != null)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (8)
CodeGeneration\SyntaxGeneratorTests.cs (7)
1362
SyntaxFactory.SingletonList<
AccessorDeclarationSyntax
>(
1421
SyntaxFactory.SingletonList<
AccessorDeclarationSyntax
>(
1445
SyntaxFactory.List<
AccessorDeclarationSyntax
>(
1446
new
AccessorDeclarationSyntax
[] {
3254
VerifySyntax<
AccessorDeclarationSyntax
>(getAccessor,
3278
VerifySyntax<
AccessorDeclarationSyntax
>(newGetAccessor,
3282
VerifySyntax<
AccessorDeclarationSyntax
>(newNewGetAccessor,
Formatting\FormattingTests.cs (1)
4515
new
AccessorDeclarationSyntax
[]
Microsoft.VisualStudio.LanguageServices.CSharp (21)
CodeModel\CSharpCodeModelService.cs (14)
341
else if (parent is
AccessorDeclarationSyntax
accessor)
1148
if (node is
AccessorDeclarationSyntax
or
1523
foreach (
var
accessor in basePropertyDeclaration.AccessorList.Accessors)
2320
var updatedAccessors = new List<
AccessorDeclarationSyntax
>();
2321
foreach (
var
accessor in property.AccessorList.Accessors)
2332
var
updatedAccessor = accessor.WithBody(null).WithSemicolonToken(SyntaxFactory.Token(SyntaxTriviaList.Create(SyntaxFactory.ElasticMarker), SyntaxKind.SemicolonToken, accessor.Body.CloseBraceToken.TrailingTrivia));
2336
var updatedAccessorList = property.AccessorList.WithAccessors(SyntaxFactory.List<
AccessorDeclarationSyntax
>(updatedAccessors));
2360
var updatedAccessors = new List<
AccessorDeclarationSyntax
>();
2361
foreach (
var
accessor in property.AccessorList.Accessors)
2372
var
updatedAccessor = accessor.WithSemicolonToken(default).WithBody(newBody);
2376
var updatedAccessorList = property.AccessorList.WithAccessors(SyntaxFactory.List<
AccessorDeclarationSyntax
>(updatedAccessors));
3557
AccessorDeclarationSyntax
? getAccessor = null;
3558
AccessorDeclarationSyntax
? setAccessor = null;
3560
foreach (
var
accessor in propertyDeclaration.AccessorList.Accessors)
CodeModel\CSharpCodeModelService.NodeLocator.cs (7)
65
return GetStartPoint(text, options, (
AccessorDeclarationSyntax
)node, part);
116
return GetEndPoint(text, (
AccessorDeclarationSyntax
)node, part);
433
private static
AccessorDeclarationSyntax
FindFirstAccessorNode(BasePropertyDeclarationSyntax node)
470
var
firstAccessorNode = FindFirstAccessorNode(node);
508
private static VirtualTreePoint GetStartPoint(SourceText text, LineFormattingOptions options,
AccessorDeclarationSyntax
node, EnvDTE.vsCMPart part)
1024
var
firstAccessorNode = FindFirstAccessorNode(node);
1056
private static VirtualTreePoint GetEndPoint(SourceText text,
AccessorDeclarationSyntax
node, EnvDTE.vsCMPart part)