425 references to AccessorDeclarationSyntax
ILLink.CodeFixProvider (1)
BaseAttributeCodeFixProvider.cs (1)
114 case LocalFunctionStatementSyntax or BaseMethodDeclarationSyntax or AccessorDeclarationSyntax when targets.HasFlag (AttributeableParentTargets.MethodOrConstructor):
Microsoft.AspNetCore.Components.Analyzers (4)
ComponentParameterAnalyzer.cs (4)
155var getterAccessor = syntax.AccessorList.Accessors[0]; 156var setterAccessor = syntax.AccessorList.Accessors[1]; 181private static IdentifierNameSyntax? GetIdentifierUsedInGetter(AccessorDeclarationSyntax getter) 191private static IdentifierNameSyntax? GetIdentifierUsedInSetter(AccessorDeclarationSyntax setter)
Microsoft.CodeAnalysis.CSharp (75)
Binder\Binder.CapturedParametersFinder.cs (1)
128case AccessorDeclarationSyntax s:
Binder\Binder_Statements.cs (2)
3549AccessorDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedAccessor, 3633case AccessorDeclarationSyntax accessor:
Binder\BinderFactory.BinderFactoryVisitor.cs (1)
262public override Binder VisitAccessorDeclaration(AccessorDeclarationSyntax parent)
Binder\LocalBinderFactory.cs (1)
195public override void VisitAccessorDeclaration(AccessorDeclarationSyntax node)
Compilation\AttributeSemanticModel.cs (1)
164internal override bool TryGetSpeculativeSemanticModelForMethodBodyCore(SyntaxTreeSemanticModel parentModel, int position, AccessorDeclarationSyntax accessor, out PublicSemanticModel? speculativeModel)
Compilation\CSharpSemanticModel.cs (4)
2536public bool TryGetSpeculativeSemanticModelForMethodBody(int position, AccessorDeclarationSyntax accessor, out SemanticModel speculativeModel) 2544internal abstract bool TryGetSpeculativeSemanticModelForMethodBodyCore(SyntaxTreeSemanticModel parentModel, int position, AccessorDeclarationSyntax accessor, out PublicSemanticModel speculativeModel); 3143public abstract IMethodSymbol GetDeclaredSymbol(AccessorDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)); 5075case AccessorDeclarationSyntax accessor:
Compilation\InitializerSemanticModel.cs (1)
247internal override bool TryGetSpeculativeSemanticModelForMethodBodyCore(SyntaxTreeSemanticModel parentModel, int position, AccessorDeclarationSyntax accessor, out PublicSemanticModel speculativeModel)
Compilation\MemberSemanticModel.cs (1)
668public override IMethodSymbol GetDeclaredSymbol(AccessorDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
Compilation\MemberSemanticModel.SpeculativeMemberSemanticModel.cs (1)
95internal override bool TryGetSpeculativeSemanticModelForMethodBodyCore(SyntaxTreeSemanticModel parentModel, int position, AccessorDeclarationSyntax accessor, out PublicSemanticModel speculativeModel)
Compilation\MethodBodySemanticModel.cs (1)
196internal override bool TryGetSpeculativeSemanticModelForMethodBodyCore(SyntaxTreeSemanticModel parentModel, int position, AccessorDeclarationSyntax accessor, out PublicSemanticModel speculativeModel)
Compilation\PublicSemanticModel.cs (1)
43AccessorDeclarationSyntax or
Compilation\SpeculativeSemanticModelWithMemberModel.cs (2)
320public override IMethodSymbol GetDeclaredSymbol(AccessorDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 550internal override bool TryGetSpeculativeSemanticModelForMethodBodyCore(SyntaxTreeSemanticModel parentModel, int position, AccessorDeclarationSyntax accessor, out PublicSemanticModel? speculativeModel)
Compilation\SyntaxTreeSemanticModel.cs (9)
181case AccessorDeclarationSyntax accessor: 658internal sealed override bool TryGetSpeculativeSemanticModelForMethodBodyCore(SyntaxTreeSemanticModel parentModel, int position, AccessorDeclarationSyntax accessor, out PublicSemanticModel speculativeModel) 794outsideMemberDecl = !LookupPosition.IsInBody(position, (AccessorDeclarationSyntax)memberDecl); 896var accessorDecl = (AccessorDeclarationSyntax)memberDecl; 1109var accessorDecl = (AccessorDeclarationSyntax)node; 1291return (node is MemberDeclarationSyntax) || (node is AccessorDeclarationSyntax) || 1567public override IMethodSymbol GetDeclaredSymbol(AccessorDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
Compiler\MethodCompiler.cs (2)
1987case AccessorDeclarationSyntax: 2012case AccessorDeclarationSyntax s:
CSharpExtensions.cs (2)
1131public static bool TryGetSpeculativeSemanticModelForMethodBody([NotNullWhen(true)] this SemanticModel? semanticModel, int position, AccessorDeclarationSyntax accessor, [NotNullWhen(true)] out SemanticModel? speculativeModel) 1490public static IMethodSymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, AccessorDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (2)
608AccessorDeclarationSyntax accessorSyntax = (AccessorDeclarationSyntax)syntax;
Parser\LanguageParser.cs (8)
4098var accessors = default(SyntaxList<AccessorDeclarationSyntax>); 4103var builder = _pool.Allocate<AccessorDeclarationSyntax>(); 4113var acc = this.ParseAccessorDeclaration(declaringKind); 4150private PostSkipAction SkipBadAccessorListTokens(ref SyntaxToken openBrace, SyntaxListBuilder<AccessorDeclarationSyntax> list, ErrorCode error) 4369private AccessorDeclarationSyntax ParseAccessorDeclaration(AccessorDeclaringKind declaringKind) 4373return (AccessorDeclarationSyntax)this.EatNode(); 4823default(SyntaxList<AccessorDeclarationSyntax>), 5093return ((CSharp.Syntax.AccessorDeclarationSyntax)decl).Modifiers;
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (2)
261var t = (AccessorDeclarationSyntax)node;
Symbols\Source\ModifierUtils.cs (1)
29if (readonlyToken.Parent is MethodDeclarationSyntax or AccessorDeclarationSyntax or BasePropertyDeclarationSyntax or EventDeclarationSyntax)
Symbols\Source\SourceCustomEventAccessorSymbol.cs (3)
24AccessorDeclarationSyntax syntax, 61internal AccessorDeclarationSyntax GetSyntax() 64return (AccessorDeclarationSyntax)syntaxReferenceOpt.GetSyntax();
Symbols\Source\SourceCustomEventSymbol.cs (4)
76AccessorDeclarationSyntax? addSyntax = null; 77AccessorDeclarationSyntax? removeSyntax = null; 81foreach (AccessorDeclarationSyntax accessor in syntax.AccessorList.Accessors) 233private SourceCustomEventAccessorSymbol? CreateAccessorSymbol(CSharpCompilation compilation, AccessorDeclarationSyntax? syntaxOpt,
Symbols\Source\SourceMemberMethodSymbol.cs (1)
718case AccessorDeclarationSyntax accessor:
Symbols\Source\SourceMethodSymbolWithAttributes.cs (1)
51case AccessorDeclarationSyntax accessor:
Symbols\Source\SourcePropertyAccessorSymbol.cs (2)
32AccessorDeclarationSyntax syntax, 663return ((AccessorDeclarationSyntax)syntax).AttributeLists;
Symbols\Source\SourcePropertySymbol.cs (9)
48out var getSyntax, 49out var setSyntax); 223out AccessorDeclarationSyntax? getSyntax, 224out AccessorDeclarationSyntax? setSyntax) 289static bool hasImplementation(AccessorDeclarationSyntax accessor) 295static bool containsFieldExpressionInAccessor(AccessorDeclarationSyntax syntax) 329private static AccessorDeclarationSyntax GetGetAccessorDeclaration(BasePropertyDeclarationSyntax syntax) 343private static AccessorDeclarationSyntax GetSetAccessorDeclaration(BasePropertyDeclarationSyntax syntax) 516AccessorDeclarationSyntax syntax,
Syntax\CSharpSyntaxNode.cs (1)
525if (parent is MemberDeclarationSyntax || parent is AccessorDeclarationSyntax)
Syntax\LookupPosition.cs (2)
65internal static bool IsInBody(int position, AccessorDeclarationSyntax method) 140internal static bool IsInMethodDeclaration(int position, AccessorDeclarationSyntax accessorDecl)
Syntax\PropertyDeclarationSyntax.cs (2)
34public AccessorDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, BlockSyntax? body, SyntaxToken semicolonToken) 44public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, BlockSyntax? body)
Syntax\SyntaxExtensions.cs (1)
44arrowExpr = ((AccessorDeclarationSyntax)node).ExpressionBody;
Syntax\SyntaxFactory.cs (4)
2687public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, BlockSyntax body) 2689public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, BlockSyntax body, SyntaxToken semicolonToken) 2691public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, ArrowExpressionClauseSyntax expressionBody) 2693public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
Syntax\SyntaxNormalizer.cs (2)
433else if (currentToken.Parent is AccessorDeclarationSyntax && 1372node is AccessorDeclarationSyntax ||
Microsoft.CodeAnalysis.CSharp.CodeStyle (40)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
200AccessorDeclarationSyntax accessorDeclaration => accessorDeclaration.Keyword,
src\Analyzers\CSharp\Analyzers\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementDiagnosticAnalyzer.cs (1)
68if (arrowExpressionClause.Parent is AccessorDeclarationSyntax)
src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
115AccessorDeclarationSyntax or
src\Analyzers\CSharp\Analyzers\OrderModifiers\CSharpOrderModifiersDiagnosticAnalyzer.cs (1)
52foreach (var accessor in accessorList.Accessors)
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (5)
211AccessorDeclarationSyntax accessorDeclaration => 219private static T? GetSingleStatementFromAccessor<T>(AccessorDeclarationSyntax? accessorDeclaration) where T : StatementSyntax 231var setAccessor = setMethod.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken) as AccessorDeclarationSyntax; 244private static ExpressionSyntax? GetExpressionFromSetter(AccessorDeclarationSyntax? setAccessor)
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForAccessorsHelper.cs (11)
15UseExpressionBodyHelper<AccessorDeclarationSyntax> 38protected override BlockSyntax? GetBody(AccessorDeclarationSyntax declaration) 41protected override ArrowExpressionClauseSyntax? GetExpressionBody(AccessorDeclarationSyntax declaration) 44protected override SyntaxToken GetSemicolonToken(AccessorDeclarationSyntax declaration) 47protected override AccessorDeclarationSyntax WithSemicolonToken(AccessorDeclarationSyntax declaration, SyntaxToken token) 50protected override AccessorDeclarationSyntax WithExpressionBody(AccessorDeclarationSyntax declaration, ArrowExpressionClauseSyntax? expressionBody) 53protected override AccessorDeclarationSyntax WithBody(AccessorDeclarationSyntax declaration, BlockSyntax? body) 56protected override bool CreateReturnStatementForExpression(SemanticModel semanticModel, AccessorDeclarationSyntax declaration)
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForIndexersHelper.cs (1)
87var getAccessor = GetSingleGetAccessor(declaration.AccessorList);
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForPropertiesHelper.cs (1)
87var getAccessor = GetSingleGetAccessor(declaration.AccessorList);
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (4)
53protected static AccessorDeclarationSyntax? GetSingleGetAccessor(AccessorListSyntax? accessorList) 161var getAccessor = GetSingleGetAccessor(declaration.AccessorList); 203if (declaration is AccessorDeclarationSyntax or ConstructorDeclarationSyntax) 301var accessor = AccessorDeclaration(SyntaxKind.GetAccessorDeclaration);
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
110AccessorDeclarationSyntax(SyntaxKind.GetAccessorDeclaration) { Parent: AccessorListSyntax { Parent: BasePropertyDeclarationSyntax baseProperty } } => baseProperty.Type,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (3)
161AccessorDeclarationSyntax accessor => accessor.AttributeLists, 740AccessorDeclarationSyntax accessor => accessor.Modifiers, 753AccessorDeclarationSyntax accessor => accessor.WithModifiers(modifiers),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\AnchorIndentationFormattingRule.cs (1)
66case AccessorDeclarationSyntax accessorDeclNode:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\NewLineUserSettingFormattingRule.cs (2)
180if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 386if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
178if (node is AccessorDeclarationSyntax accessorDeclNode)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\TokenBasedFormattingRule.cs (2)
207AccessorDeclarationSyntax) 379previousToken.IsLastTokenOfNode<AccessorDeclarationSyntax>())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (1)
170if (node is AccessorDeclarationSyntax accessorDeclaration && accessorDeclaration.Body != null)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (1)
315AccessorDeclarationSyntax accessor => accessor.Modifiers,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
259AccessorDeclarationSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (1)
134if (parent is AccessorDeclarationSyntax)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (21)
src\Analyzers\CSharp\CodeFixes\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (3)
54else if (declaration is AccessorDeclarationSyntax { Parent: AccessorListSyntax { Parent: BasePropertyDeclarationSyntax property } accessorList } accessor) 76var currentAccessor = currentAccessorList.Accessors.First(a => a.Kind() == accessor.Kind()); 77var otherAccessor = currentAccessorList.Accessors.Single(a => a != currentAccessor);
src\Analyzers\CSharp\CodeFixes\MakeTypeAbstract\CSharpMakeTypeAbstractCodeFixProvider.cs (1)
35case AccessorDeclarationSyntax accessor:
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (4)
333AccessorDeclarationSyntax accessor => Cast<TDeclarationNode>(accessor.AddAttributeLists(attributeSyntaxList)), 404case AccessorDeclarationSyntax accessor: 408var newAccessor = accessor.WithAttributeLists(newAttributeLists); 498else if (destinationMember is AccessorDeclarationSyntax accessorDeclaration)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (3)
143var accessors = new List<AccessorDeclarationSyntax?> 152private static AccessorDeclarationSyntax? GenerateAccessorDeclaration( 165private static AccessorDeclarationSyntax GenerateAccessorDeclaration(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (7)
165var accessor = accessorList.Accessors[0]; 218private static AccessorDeclarationSyntax UseExpressionBodyIfDesired( 219CSharpCodeGenerationContextInfo info, AccessorDeclarationSyntax declaration, CancellationToken cancellationToken) 237SyntaxKind declarationKind, AccessorDeclarationSyntax accessor, LanguageVersion languageVersion, ExpressionBodyPreference preference, CancellationToken cancellationToken, 276private static AccessorDeclarationSyntax? GenerateAccessorDeclaration( 290private static AccessorDeclarationSyntax GenerateAccessorDeclaration( 298var declaration = AccessorDeclaration(kind)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (3)
591targetToken.Parent.Parent is AccessorDeclarationSyntax) 598targetToken.Parent is AccessorDeclarationSyntax) 606targetToken.Parent.Parent is AccessorDeclarationSyntax)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (12)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (2)
329or AccessorDeclarationSyntax 405or AccessorDeclarationSyntax)
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (10)
470AccessorDeclarationSyntax accessorDeclarationNode => ShouldAddBraceForAccessorDeclaration(accessorDeclarationNode), 549private static bool ShouldAddBraceForAccessorDeclaration(AccessorDeclarationSyntax accessorDeclarationNode) 778AccessorDeclarationSyntax accessorDeclarationNode => ShouldRemoveBraceForAccessorDeclaration(accessorDeclarationNode, caretPosition), 797private static bool ShouldRemoveBraceForAccessorDeclaration(AccessorDeclarationSyntax accessorDeclarationNode, int caretPosition) 878AccessorDeclarationSyntax accessorDeclarationNode => AddBlockToAccessorDeclaration(accessorDeclarationNode, formattingOptions), 923private static AccessorDeclarationSyntax AddBlockToAccessorDeclaration( 924AccessorDeclarationSyntax accessorDeclarationNode, 974AccessorDeclarationSyntax accessorDeclarationNode => RemoveBodyForAccessorDeclarationNode(accessorDeclarationNode), 1029private static AccessorDeclarationSyntax RemoveBodyForAccessorDeclarationNode(AccessorDeclarationSyntax accessorDeclarationNode)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (4)
Structure\AccessorDeclarationStructureTests.cs (1)
15public class AccessorDeclarationStructureTests : AbstractCSharpSyntaxNodeStructureTests<AccessorDeclarationSyntax>
Structure\MetadataAsSource\AccessorDeclarationStructureTests.cs (1)
15public class AccessorDeclarationStructureTests : AbstractCSharpSyntaxNodeStructureTests<AccessorDeclarationSyntax>
SymbolKey\SymbolKeyTestBase.cs (2)
135else if (node is AccessorDeclarationSyntax accessor) 303else if (node is AccessorDeclarationSyntax accessor)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (2)
Semantics\OutVarTests.cs (2)
36127var declarationSyntax = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Features (120)
BraceCompletion\CurlyBraceCompletionService.cs (1)
153if (currentTokenParentParent is AccessorDeclarationSyntax)
Completion\CompletionProviders\OverrideCompletionProvider.cs (1)
229var firstAccessor = propertyDeclaration.AccessorList.Accessors[0];
Completion\KeywordRecommenders\FieldKeywordRecommender.cs (1)
51if (node is AccessorDeclarationSyntax { Parent: AccessorListSyntax { Parent: PropertyDeclarationSyntax } })
Completion\KeywordRecommenders\MethodKeywordRecommender.cs (1)
28or AccessorDeclarationSyntax
Completion\KeywordRecommenders\ReturnKeywordRecommender.cs (1)
42token.Parent.Parent is AccessorDeclarationSyntax;
ConvertAutoPropertyToFullProperty\CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (7)
73private static (AccessorDeclarationSyntax getAccessor, AccessorDeclarationSyntax setAccessor) 82var accessorDeclarationSyntax = (AccessorDeclarationSyntax)newAccessor; 110.WithTrailingTrivia(((AccessorDeclarationSyntax)accessor).SemicolonToken.TrailingTrivia)); 112return ((AccessorDeclarationSyntax)accessor).WithBody(blockSyntax); 130var getAccessor = propertyDeclaration.AccessorList.Accessors[0];
Debugging\CSharpProximityExpressionsService.Worker.cs (2)
56if (_parentStatement.GetAncestorOrThis<AccessorDeclarationSyntax>() is (kind: 134block.Parent is AccessorDeclarationSyntax &&
Debugging\LocationInfoGetter.cs (1)
62var accessor = memberDeclaration.GetAncestorOrThis<AccessorDeclarationSyntax>();
EditAndContinue\BreakpointSpans.cs (5)
320var accessor = (AccessorDeclarationSyntax)node; 544internal static TextSpan CreateSpanForAutoPropertyAccessor(AccessorDeclarationSyntax accessor) 547internal static IEnumerable<SyntaxToken> GetActiveTokensForAutoPropertyAccessor(AccessorDeclarationSyntax accessor) 974private static TextSpan? CreateSpanForAccessors(SyntaxList<AccessorDeclarationSyntax> accessors, int position)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (3)
432AccessorDeclarationSyntax { Parent.Parent: IndexerDeclarationSyntax { ParameterList: var list } } => list, 1722var accessorDeclaration = (AccessorDeclarationSyntax)node;
EditAndContinue\DeclarationBody\ExplicitAutoPropertyAccessorDeclarationBody.cs (1)
17internal sealed class ExplicitAutoPropertyAccessorDeclarationBody(AccessorDeclarationSyntax accessor) : PropertyOrIndexerAccessorDeclarationBody
EditAndContinue\DeclarationBody\PropertyOrIndexerAccessorWithExplicitBodyDeclarationBody.cs (1)
24internal sealed class PropertyOrIndexerAccessorWithExplicitBodyDeclarationBody(AccessorDeclarationSyntax accessor) : PropertyOrIndexerAccessorDeclarationBody
EditAndContinue\SyntaxComparer.cs (1)
770case AccessorDeclarationSyntax accessorDeclarationSyntax: return accessorDeclarationSyntax.Body ?? (SyntaxNode?)accessorDeclarationSyntax.ExpressionBody?.Expression;
EditAndContinue\SyntaxUtilities.cs (2)
29AccessorDeclarationSyntax accessorDeclaration 161var firstGetter = accessorList?.Accessors.Where(a => a.IsKind(SyntaxKind.GetAccessorDeclaration)).FirstOrDefault();
ExtractMethod\CSharpMethodExtractor.cs (1)
92if (currentNode is AccessorDeclarationSyntax)
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (2)
319private SyntaxList<AccessorDeclarationSyntax> ReplaceAccessors(SyntaxList<AccessorDeclarationSyntax> accessors)
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (1)
177=> node is AccessorDeclarationSyntax accessor && accessor.ExpressionBody != null;
ExtractMethod\CSharpSelectionResult.StatementResult.cs (4)
34AccessorDeclarationSyntax _ => false, 52return n is AccessorDeclarationSyntax or 55AccessorDeclarationSyntax or 72case AccessorDeclarationSyntax access:
ExtractMethod\Extensions.cs (2)
46case AccessorDeclarationSyntax a: return a.Body; 68AccessorDeclarationSyntax or
GenerateConstructorFromMembers\CSharpGenerateConstructorFromMembersCodeRefactoringProvider.cs (1)
65var getAccessor = propertyDeclaration.AccessorList?.Accessors.FirstOrDefault(a => a.Kind() == SyntaxKind.GetAccessorDeclaration);
InitializeParameter\InitializeParameterHelpers.cs (4)
150if (node is AccessorDeclarationSyntax accessorDeclaration) 188private static AccessorDeclarationSyntax RemoveThrowNotImplemented(AccessorDeclarationSyntax accessorDeclaration) 190var result = accessorDeclaration
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
263case AccessorDeclarationSyntax accessor:
InvertIf\CSharpInvertIfCodeRefactoringProvider.cs (2)
72case AccessorDeclarationSyntax: 98LocalFunctionStatementSyntax or AccessorDeclarationSyntax or MemberDeclarationSyntax
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (14)
101var accessor = 122var getAccessor = CreateGetAccessor(getAndSetMethods, options, languageVersion, cancellationToken); 123var setAccessor = CreateSetAccessor(semanticModel, generator, getAndSetMethods, options, languageVersion, cancellationToken); 165private static AccessorDeclarationSyntax CreateGetAccessor( 168var accessorDeclaration = CreateGetAccessorWorker(getAndSetMethods); 174private static AccessorDeclarationSyntax UseExpressionOrBlockBodyIfDesired( 176AccessorDeclarationSyntax accessorDeclaration, CancellationToken cancellationToken) 209private static AccessorDeclarationSyntax CreateGetAccessorWorker(GetAndSetMethods getAndSetMethods) 213var accessor = AccessorDeclaration(SyntaxKind.GetAccessorDeclaration); 234private static AccessorDeclarationSyntax CreateSetAccessor( 238var accessorDeclaration = CreateSetAccessorWorker(semanticModel, generator, getAndSetMethods); 242private static AccessorDeclarationSyntax CreateSetAccessorWorker( 252var accessor = AccessorDeclaration(SyntaxKind.SetAccessorDeclaration); 256accessor = (AccessorDeclarationSyntax)generator.WithAccessibility(accessor, setMethod.DeclaredAccessibility);
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (4)
127var setAccessorDeclaration = (AccessorDeclarationSyntax)setMethod.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 200var getAccessorDeclaration = (AccessorDeclarationSyntax)getMethod.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken);
Snippets\AbstractCSharpAutoPropertySnippetProvider.cs (6)
28protected virtual AccessorDeclarationSyntax? GenerateGetAccessorDeclaration(CSharpSyntaxContext syntaxContext, SyntaxGenerator generator, CancellationToken cancellationToken) 29=> (AccessorDeclarationSyntax)generator.GetAccessorDeclaration(); 31protected virtual AccessorDeclarationSyntax? GenerateSetAccessorDeclaration(CSharpSyntaxContext syntaxContext, SyntaxGenerator generator, CancellationToken cancellationToken) 32=> (AccessorDeclarationSyntax)generator.SetAccessorDeclaration(); 50var accessors = new AccessorDeclarationSyntax?[] 72accessorList: SyntaxFactory.AccessorList([.. (IEnumerable<AccessorDeclarationSyntax>)accessors.Where(a => a is not null)]));
Snippets\CSharpPropgSnippetProvider.cs (2)
26protected override AccessorDeclarationSyntax? GenerateSetAccessorDeclaration(CSharpSyntaxContext syntaxContext, SyntaxGenerator generator, CancellationToken cancellationToken) 44return (AccessorDeclarationSyntax)generator.SetAccessorDeclaration(Accessibility.Private);
Snippets\CSharpPropiSnippetProvider.cs (1)
28protected override AccessorDeclarationSyntax? GenerateSetAccessorDeclaration(CSharpSyntaxContext syntaxContext, SyntaxGenerator generator, CancellationToken cancellationToken)
Snippets\CSharpProprSnippetProvider.cs (1)
53protected override AccessorDeclarationSyntax? GenerateSetAccessorDeclaration(CSharpSyntaxContext syntaxContext, SyntaxGenerator generator, CancellationToken cancellationToken)
Snippets\CSharpPropSnippetProvider.cs (1)
26protected override AccessorDeclarationSyntax? GenerateSetAccessorDeclaration(CSharpSyntaxContext syntaxContext, SyntaxGenerator generator, CancellationToken cancellationToken)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
200AccessorDeclarationSyntax accessorDeclaration => accessorDeclaration.Keyword,
src\Analyzers\CSharp\Analyzers\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementDiagnosticAnalyzer.cs (1)
68if (arrowExpressionClause.Parent is AccessorDeclarationSyntax)
src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
115AccessorDeclarationSyntax or
src\Analyzers\CSharp\Analyzers\OrderModifiers\CSharpOrderModifiersDiagnosticAnalyzer.cs (1)
52foreach (var accessor in accessorList.Accessors)
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (5)
211AccessorDeclarationSyntax accessorDeclaration => 219private static T? GetSingleStatementFromAccessor<T>(AccessorDeclarationSyntax? accessorDeclaration) where T : StatementSyntax 231var setAccessor = setMethod.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken) as AccessorDeclarationSyntax; 244private static ExpressionSyntax? GetExpressionFromSetter(AccessorDeclarationSyntax? setAccessor)
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForAccessorsHelper.cs (11)
15UseExpressionBodyHelper<AccessorDeclarationSyntax> 38protected override BlockSyntax? GetBody(AccessorDeclarationSyntax declaration) 41protected override ArrowExpressionClauseSyntax? GetExpressionBody(AccessorDeclarationSyntax declaration) 44protected override SyntaxToken GetSemicolonToken(AccessorDeclarationSyntax declaration) 47protected override AccessorDeclarationSyntax WithSemicolonToken(AccessorDeclarationSyntax declaration, SyntaxToken token) 50protected override AccessorDeclarationSyntax WithExpressionBody(AccessorDeclarationSyntax declaration, ArrowExpressionClauseSyntax? expressionBody) 53protected override AccessorDeclarationSyntax WithBody(AccessorDeclarationSyntax declaration, BlockSyntax? body) 56protected override bool CreateReturnStatementForExpression(SemanticModel semanticModel, AccessorDeclarationSyntax declaration)
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForIndexersHelper.cs (1)
87var getAccessor = GetSingleGetAccessor(declaration.AccessorList);
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForPropertiesHelper.cs (1)
87var getAccessor = GetSingleGetAccessor(declaration.AccessorList);
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (4)
53protected static AccessorDeclarationSyntax? GetSingleGetAccessor(AccessorListSyntax? accessorList) 161var getAccessor = GetSingleGetAccessor(declaration.AccessorList); 203if (declaration is AccessorDeclarationSyntax or ConstructorDeclarationSyntax) 301var accessor = AccessorDeclaration(SyntaxKind.GetAccessorDeclaration);
src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (1)
110AccessorDeclarationSyntax(SyntaxKind.GetAccessorDeclaration) { Parent: AccessorListSyntax { Parent: BasePropertyDeclarationSyntax baseProperty } } => baseProperty.Type,
src\Analyzers\CSharp\CodeFixes\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (3)
54else if (declaration is AccessorDeclarationSyntax { Parent: AccessorListSyntax { Parent: BasePropertyDeclarationSyntax property } accessorList } accessor) 76var currentAccessor = currentAccessorList.Accessors.First(a => a.Kind() == accessor.Kind()); 77var otherAccessor = currentAccessorList.Accessors.Single(a => a != currentAccessor);
src\Analyzers\CSharp\CodeFixes\MakeTypeAbstract\CSharpMakeTypeAbstractCodeFixProvider.cs (1)
35case AccessorDeclarationSyntax accessor:
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (5)
174foreach (var decl in t.AccessorList.Accessors) 214foreach (var decl in t.AccessorList.Accessors) 236foreach (var decl in t.AccessorList.Accessors) 261var t = (AccessorDeclarationSyntax)node;
Structure\CSharpBlockStructureProvider.cs (1)
20builder.Add<AccessorDeclarationSyntax, AccessorDeclarationStructureProvider>();
Structure\Providers\AccessorDeclarationStructureProvider.cs (3)
12internal class AccessorDeclarationStructureProvider : AbstractSyntaxNodeStructureProvider<AccessorDeclarationSyntax> 16AccessorDeclarationSyntax accessorDeclaration, 38&& (!nextSibling.IsNode || nextSibling.AsNode() is AccessorDeclarationSyntax);
UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (3)
48private static bool IsSetOrInitAccessor(AccessorDeclarationSyntax accessor) 121var accessor = AccessorDeclaration(SyntaxKind.SetAccessorDeclaration).WithSemicolonToken(SemicolonToken); 124accessor = (AccessorDeclarationSyntax)generator.WithAccessibility(accessor, fieldSymbol.DeclaredAccessibility);
UseAutoProperty\SingleLinePropertyFormattingRule.cs (1)
25if (previousToken.IsKind(SyntaxKind.SemicolonToken) && currentToken.Parent is AccessorDeclarationSyntax)
UseExpressionBody\UseExpressionBodyCodeRefactoringProvider.cs (1)
177var parent = declaration is AccessorDeclarationSyntax
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (10)
IOperation\IOperationTests_IMethodBodyOperation.cs (10)
978var node1 = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 1000var node1 = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 1035var node1 = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().First(); 1080var node1 = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().First(); 1124var node1 = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (9)
Semantics\InitOnlyMemberTests.cs (3)
3140AccessorDeclarationSyntax accessorDecl = root.DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 3142var speculatedMethod = accessorDecl.ReplaceNode(accessorDecl.Body, blockStatement);
Semantics\QueryTests.cs (1)
2357var unknownAccessorDecls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>();
Semantics\SuppressAccessibilityChecksTests.cs (3)
215AccessorDeclarationSyntax accessorDecl = root.DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 217var speculatedMethod = accessorDecl.ReplaceNode(accessorDecl.Body, blockStatement);
SourceGeneration\GeneratorDriverTests_Attributes_FullyQualifiedName.cs (2)
749var input = ctx.ForAttributeWithMetadataName<AccessorDeclarationSyntax>("System.CLSCompliantAttribute"); 758step => Assert.True(step.Outputs.Single().Value is AccessorDeclarationSyntax { RawKind: (int)SyntaxKind.GetAccessorDeclaration }));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (15)
Compilation\SemanticModelAPITests.cs (8)
2310var accessorSyntax = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 2445var methodDecl = indexerDecl.AccessorList.Accessors[0]; 2448var speculatedMethod = methodDecl.ReplaceNode(methodDecl.Body, blockStatement); 2487var methodDecl = propertyDecl.AccessorList.Accessors[0]; 2490var speculatedMethod = methodDecl.ReplaceNode(methodDecl.Body, blockStatement); 2532var methodDecl = eventDecl.AccessorList.Accessors[0]; 2535var speculatedMethod = methodDecl.ReplaceNode(methodDecl.Body, blockStatement);
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (7)
309foreach (var accessorDecl in accessorList) 336var getterDecl = indexerDecl.AccessorList.Accessors[0]; 337var setterDecl = indexerDecl.AccessorList.Accessors[1]; 2869var explicitPropertyGetterNode = explicitPropertyAccessors[0]; 2879var explicitPropertySetterNode = explicitPropertyAccessors[1]; 3177var accessorDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (13)
Generated\Syntax.Test.xml.Generated.cs (6)
10809=> SyntaxFactory.AccessorList(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), new SyntaxList<AccessorDeclarationSyntax>(), SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 10811private static AccessorDeclarationSyntax GenerateAccessorDeclaration() 13443var node = GenerateAccessorDeclaration(); 13451var newNode = node.WithAttributeLists(node.AttributeLists).WithModifiers(node.Modifiers).WithKeyword(node.Keyword).WithBody(node.Body).WithExpressionBody(node.ExpressionBody).WithSemicolonToken(node.SemicolonToken); 19143var oldNode = GenerateAccessorDeclaration(); 19159var oldNode = GenerateAccessorDeclaration();
Parsing\ParsingErrorRecoveryTests.cs (6)
6463var acc = pd.AccessorList.Accessors[0]; 6498var acc = pd.AccessorList.Accessors[0]; 6537var acc = pd.AccessorList.Accessors[0]; 6571var getDecl = accessorDecls[0]; 6603var getDecl = accessorDecls[0]; 6608var setDecl = accessorDecls[1];
Syntax\SyntaxTests.cs (1)
157var t = SyntaxFactory.AccessorDeclaration(SyntaxKind.UnknownAccessorDeclaration);
Microsoft.CodeAnalysis.CSharp.Workspaces (69)
CodeGeneration\CSharpSyntaxGenerator.cs (29)
404var accessors = new List<AccessorDeclarationSyntax>(); 406accessors.AddIfNotNull((AccessorDeclarationSyntax?)getAccessor); 407accessors.AddIfNotNull((AccessorDeclarationSyntax?)setAccessor); 431var accessor = SyntaxFactory.AccessorDeclaration(kind); 458var list = SyntaxFactory.List(accessorDeclarations.Cast<AccessorDeclarationSyntax>()); 472var accessors = new List<AccessorDeclarationSyntax>(); 518private static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, IEnumerable<SyntaxNode>? statements) 520var ad = SyntaxFactory.AccessorDeclaration( 555var accessors = new List<AccessorDeclarationSyntax>(); 674private static AccessorDeclarationSyntax WithBody(AccessorDeclarationSyntax accessor) 689private static AccessorDeclarationSyntax WithoutBody(AccessorDeclarationSyntax accessor) 1201AccessorDeclarationSyntax accessor => accessor.AttributeLists, 1212AccessorDeclarationSyntax accessor => accessor.WithAttributeLists(attributeLists), 1658AccessorDeclarationSyntax accessor => accessor.WithModifiers(modifiers), 2494SyntaxKind.RemoveAccessorDeclaration => ((AccessorDeclarationSyntax)declaration).Body?.Statements, 2530return ((AccessorDeclarationSyntax)declaration).WithBody(somebody).WithSemicolonToken(semicolon).WithExpressionBody(null); 2585private static AccessorDeclarationSyntax? AsAccessor(SyntaxNode node, SyntaxKind parentKind) 2595return (AccessorDeclarationSyntax)node; 2604return (AccessorDeclarationSyntax)node; 2613private static AccessorDeclarationSyntax? GetAccessor(SyntaxNode declaration, SyntaxKind kind) 2619private SyntaxNode WithAccessor(SyntaxNode declaration, SyntaxKind kind, AccessorDeclarationSyntax accessor) 2622private SyntaxNode WithAccessor(SyntaxNode declaration, AccessorListSyntax? accessorList, SyntaxKind kind, AccessorDeclarationSyntax? accessor) 2626var acc = accessorList.Accessors.FirstOrDefault(a => a.IsKind(kind)); 2642var accessor = GetAccessor(declaration, SyntaxKind.GetAccessorDeclaration); 2648var accessor = GetAccessor(declaration, SyntaxKind.SetAccessorDeclaration); 2660var accessor = GetAccessor(declaration, kind); 2668return this.WithAccessor(declaration, kind, (AccessorDeclarationSyntax)this.WithStatements(accessor, statements));
Rename\CSharpRenameRewriterLanguageService.cs (4)
262&& IsNameConflictWithProperty("get", token.Parent as AccessorDeclarationSyntax); 266&& IsNameConflictWithProperty("set", token.Parent as AccessorDeclarationSyntax); 271&& IsNameConflictWithProperty("set", token.Parent as AccessorDeclarationSyntax); 273private bool IsNameConflictWithProperty(string prefix, AccessorDeclarationSyntax? accessor)
SemanticModelReuse\CSharpSemanticModelReuseLanguageService.cs (6)
20AccessorDeclarationSyntax> 30protected override BasePropertyDeclarationSyntax GetBasePropertyDeclaration(AccessorDeclarationSyntax accessor) 37protected override SyntaxList<AccessorDeclarationSyntax> GetAccessors(BasePropertyDeclarationSyntax baseProperty) 48if (current is AccessorDeclarationSyntax accessor) 65if (previousBodyNode is AccessorDeclarationSyntax previousAccessorDeclaration && 66currentBodyNode is AccessorDeclarationSyntax currentAccessorDeclaration &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (3)
161AccessorDeclarationSyntax accessor => accessor.AttributeLists, 740AccessorDeclarationSyntax accessor => accessor.Modifiers, 753AccessorDeclarationSyntax accessor => accessor.WithModifiers(modifiers),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\AnchorIndentationFormattingRule.cs (1)
66case AccessorDeclarationSyntax accessorDeclNode:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\NewLineUserSettingFormattingRule.cs (2)
180if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 386if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
178if (node is AccessorDeclarationSyntax accessorDeclNode)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\TokenBasedFormattingRule.cs (2)
207AccessorDeclarationSyntax) 379previousToken.IsLastTokenOfNode<AccessorDeclarationSyntax>())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (1)
170if (node is AccessorDeclarationSyntax accessorDeclaration && accessorDeclaration.Body != null)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (1)
315AccessorDeclarationSyntax accessor => accessor.Modifiers,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
259AccessorDeclarationSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (1)
134if (parent is AccessorDeclarationSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (4)
333AccessorDeclarationSyntax accessor => Cast<TDeclarationNode>(accessor.AddAttributeLists(attributeSyntaxList)), 404case AccessorDeclarationSyntax accessor: 408var newAccessor = accessor.WithAttributeLists(newAttributeLists); 498else if (destinationMember is AccessorDeclarationSyntax accessorDeclaration)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (3)
143var accessors = new List<AccessorDeclarationSyntax?> 152private static AccessorDeclarationSyntax? GenerateAccessorDeclaration( 165private static AccessorDeclarationSyntax GenerateAccessorDeclaration(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (7)
165var accessor = accessorList.Accessors[0]; 218private static AccessorDeclarationSyntax UseExpressionBodyIfDesired( 219CSharpCodeGenerationContextInfo info, AccessorDeclarationSyntax declaration, CancellationToken cancellationToken) 237SyntaxKind declarationKind, AccessorDeclarationSyntax accessor, LanguageVersion languageVersion, ExpressionBodyPreference preference, CancellationToken cancellationToken, 276private static AccessorDeclarationSyntax? GenerateAccessorDeclaration( 290private static AccessorDeclarationSyntax GenerateAccessorDeclaration( 298var declaration = AccessorDeclaration(kind)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (3)
591targetToken.Parent.Parent is AccessorDeclarationSyntax) 598targetToken.Parent is AccessorDeclarationSyntax) 606targetToken.Parent.Parent is AccessorDeclarationSyntax)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (8)
CodeGeneration\SyntaxGeneratorTests.cs (8)
1423SingletonList<AccessorDeclarationSyntax>( 2812var getAccessor = (AccessorDeclarationSyntax)Generator.GetAccessorDeclaration(); 2816var setAccessor = (AccessorDeclarationSyntax)Generator.SetAccessorDeclaration(); 3358VerifySyntax<AccessorDeclarationSyntax>(getAccessor, 3382VerifySyntax<AccessorDeclarationSyntax>(newGetAccessor, 3386VerifySyntax<AccessorDeclarationSyntax>(newNewGetAccessor,
Microsoft.DotNet.GenFacades (1)
NotSupportedAssemblyGenerator.cs (1)
169public override SyntaxNode VisitAccessorDeclaration(AccessorDeclarationSyntax node)
Microsoft.VisualStudio.LanguageServices.CSharp (19)
CodeModel\CSharpCodeModelService.cs (12)
340else if (parent is AccessorDeclarationSyntax accessor) 1145if (node is AccessorDeclarationSyntax or 1520foreach (var accessor in basePropertyDeclaration.AccessorList.Accessors) 2316var updatedAccessors = new List<AccessorDeclarationSyntax>(); 2317foreach (var accessor in property.AccessorList.Accessors) 2328var updatedAccessor = accessor.WithBody(null).WithSemicolonToken(SyntaxFactory.Token([SyntaxFactory.ElasticMarker], SyntaxKind.SemicolonToken, accessor.Body.CloseBraceToken.TrailingTrivia)); 2356var updatedAccessors = new List<AccessorDeclarationSyntax>(); 2357foreach (var accessor in property.AccessorList.Accessors) 2368var updatedAccessor = accessor.WithSemicolonToken(default).WithBody(newBody); 3552AccessorDeclarationSyntax? getAccessor = null; 3553AccessorDeclarationSyntax? setAccessor = null; 3555foreach (var accessor in propertyDeclaration.AccessorList.Accessors)
CodeModel\CSharpCodeModelService.NodeLocator.cs (7)
64return GetStartPoint(text, options, (AccessorDeclarationSyntax)node, part); 115return GetEndPoint(text, (AccessorDeclarationSyntax)node, part); 432private static AccessorDeclarationSyntax FindFirstAccessorNode(BasePropertyDeclarationSyntax node) 469var firstAccessorNode = FindFirstAccessorNode(node); 507private static VirtualTreePoint GetStartPoint(SourceText text, LineFormattingOptions options, AccessorDeclarationSyntax node, EnvDTE.vsCMPart part) 1023var firstAccessorNode = FindFirstAccessorNode(node); 1055private static VirtualTreePoint GetEndPoint(SourceText text, AccessorDeclarationSyntax node, EnvDTE.vsCMPart part)
System.Text.RegularExpressions.Generator (2)
RegexGenerator.cs (1)
60(node, _) => node is MethodDeclarationSyntax or PropertyDeclarationSyntax or IndexerDeclarationSyntax or AccessorDeclarationSyntax,
RegexGenerator.Parser.cs (1)
29if (context.TargetNode is IndexerDeclarationSyntax or AccessorDeclarationSyntax)