439 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)
3550AccessorDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedAccessor, 3634case 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)); 5082case 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)
4117var accessors = default(SyntaxList<AccessorDeclarationSyntax>); 4122var builder = _pool.Allocate<AccessorDeclarationSyntax>(); 4132var acc = this.ParseAccessorDeclaration(declaringKind); 4169private PostSkipAction SkipBadAccessorListTokens(ref SyntaxToken openBrace, SyntaxListBuilder<AccessorDeclarationSyntax> list, ErrorCode error) 4388private AccessorDeclarationSyntax ParseAccessorDeclaration(AccessorDeclaringKind declaringKind) 4392return (AccessorDeclarationSyntax)this.EatNode(); 4842default(SyntaxList<AccessorDeclarationSyntax>), 5136return ((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 (41)
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)
111if (blockParent is MemberDeclarationSyntax or AccessorDeclarationSyntax or AnonymousFunctionExpressionSyntax)
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 (12)
19UseExpressionBodyHelper<AccessorDeclarationSyntax> 42protected override BlockSyntax? GetBody(AccessorDeclarationSyntax declaration) 45protected override ArrowExpressionClauseSyntax? GetExpressionBody(AccessorDeclarationSyntax declaration) 48protected override SyntaxToken GetSemicolonToken(AccessorDeclarationSyntax declaration) 51protected override AccessorDeclarationSyntax WithSemicolonToken(AccessorDeclarationSyntax declaration, SyntaxToken token) 54protected override AccessorDeclarationSyntax WithExpressionBody(AccessorDeclarationSyntax declaration, ArrowExpressionClauseSyntax? expressionBody) 57protected override AccessorDeclarationSyntax WithBody(AccessorDeclarationSyntax declaration, BlockSyntax? body) 62var result = declaration.WithBody(body); 68protected 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)
215AccessorDeclarationSyntax) 383previousToken.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)
247AccessorDeclarationSyntax;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (1)
134if (parent is AccessorDeclarationSyntax)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (25)
src\Analyzers\CSharp\CodeFixes\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (3)
53else if (declaration is AccessorDeclarationSyntax { Parent: AccessorListSyntax { Parent: BasePropertyDeclarationSyntax property } accessorList } accessor) 75var currentAccessor = currentAccessorList.Accessors.First(a => a.Kind() == accessor.Kind()); 76var 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)), 406case AccessorDeclarationSyntax accessor: 410var newAccessor = accessor.WithAttributeLists(newAttributeLists); 500else if (destinationMember is AccessorDeclarationSyntax accessorDeclaration)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (3)
162var accessors = new List<AccessorDeclarationSyntax?> 171private static AccessorDeclarationSyntax? GenerateAccessorDeclaration( 184private static AccessorDeclarationSyntax GenerateAccessorDeclaration(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (7)
184var accessor = accessorList.Accessors[0]; 233private static AccessorDeclarationSyntax UseExpressionBodyIfDesired( 234CSharpCodeGenerationContextInfo info, AccessorDeclarationSyntax declaration, CancellationToken cancellationToken) 252SyntaxKind declarationKind, AccessorDeclarationSyntax accessor, LanguageVersion languageVersion, ExpressionBodyPreference preference, CancellationToken cancellationToken, 291private static AccessorDeclarationSyntax? GenerateAccessorDeclaration( 305private static AccessorDeclarationSyntax GenerateAccessorDeclaration( 313var 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)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (4)
256if (node is AccessorDeclarationSyntax accessorDeclaration) 294private static AccessorDeclarationSyntax RemoveThrowNotImplemented(AccessorDeclarationSyntax accessorDeclaration) 296var result = accessorDeclaration
Microsoft.CodeAnalysis.CSharp.EditorFeatures (12)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (2)
326or AccessorDeclarationSyntax 402or 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 (10)
FieldKeywordTests.cs (8)
10490var previousAccessor = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 10493var modifiedAccessor = modifiedTree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 10524var previousAccessor = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().First(); 10527var modifiedAccessor = modifiedTree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().First();
Semantics\OutVarTests.cs (2)
36175var declarationSyntax = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Features (116)
BraceCompletion\CurlyBraceCompletionService.cs (1)
153if (currentTokenParentParent is AccessorDeclarationSyntax)
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 (9)
70private static (AccessorDeclarationSyntax getAccessor, AccessorDeclarationSyntax setAccessor) 75private static AccessorDeclarationSyntax GetUpdatedAccessor(CSharpCodeGenerationContextInfo info, 76AccessorDeclarationSyntax accessor, SyntaxNode statement, CancellationToken cancellationToken) 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)
96if (currentNode is AccessorDeclarationSyntax)
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (2)
318private SyntaxList<AccessorDeclarationSyntax> ReplaceAccessors(SyntaxList<AccessorDeclarationSyntax> accessors)
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (1)
162=> node is AccessorDeclarationSyntax { ExpressionBody: not null };
ExtractMethod\CSharpSelectionResult.StatementResult.cs (2)
47n is AccessorDeclarationSyntax or 61case AccessorDeclarationSyntax access:
ExtractMethod\Extensions.cs (2)
46case AccessorDeclarationSyntax a: return a.Body; 68AccessorDeclarationSyntax or
GenerateConstructors\CSharpGenerateConstructorsCodeRefactoringProvider.cs (1)
65var getAccessor = propertyDeclaration.AccessorList?.Accessors.FirstOrDefault(a => a.Kind() == SyntaxKind.GetAccessorDeclaration);
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
268AccessorDeclarationSyntax accessor => 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)
125var setAccessorDeclaration = (AccessorDeclarationSyntax)setMethod.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 198var 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)
111if (blockParent is MemberDeclarationSyntax or AccessorDeclarationSyntax or AnonymousFunctionExpressionSyntax)
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 (12)
19UseExpressionBodyHelper<AccessorDeclarationSyntax> 42protected override BlockSyntax? GetBody(AccessorDeclarationSyntax declaration) 45protected override ArrowExpressionClauseSyntax? GetExpressionBody(AccessorDeclarationSyntax declaration) 48protected override SyntaxToken GetSemicolonToken(AccessorDeclarationSyntax declaration) 51protected override AccessorDeclarationSyntax WithSemicolonToken(AccessorDeclarationSyntax declaration, SyntaxToken token) 54protected override AccessorDeclarationSyntax WithExpressionBody(AccessorDeclarationSyntax declaration, ArrowExpressionClauseSyntax? expressionBody) 57protected override AccessorDeclarationSyntax WithBody(AccessorDeclarationSyntax declaration, BlockSyntax? body) 62var result = declaration.WithBody(body); 68protected 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)
53else if (declaration is AccessorDeclarationSyntax { Parent: AccessorListSyntax { Parent: BasePropertyDeclarationSyntax property } accessorList } accessor) 75var currentAccessor = currentAccessorList.Accessors.First(a => a.Kind() == accessor.Kind()); 76var 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 (74)
CodeGeneration\CSharpSyntaxGenerator.cs (30)
402var accessors = new List<AccessorDeclarationSyntax>(); 404accessors.AddIfNotNull((AccessorDeclarationSyntax?)getAccessor); 405accessors.AddIfNotNull((AccessorDeclarationSyntax?)setAccessor); 429var accessor = SyntaxFactory.AccessorDeclaration(kind); 456var list = SyntaxFactory.List(accessorDeclarations.Cast<AccessorDeclarationSyntax>()); 470var accessors = new List<AccessorDeclarationSyntax>(); 516private static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, IEnumerable<SyntaxNode>? statements) 518var ad = SyntaxFactory.AccessorDeclaration( 553var accessors = new List<AccessorDeclarationSyntax>(); 672private static AccessorDeclarationSyntax WithBody(AccessorDeclarationSyntax accessor) 687private static AccessorDeclarationSyntax WithoutBody(AccessorDeclarationSyntax accessor) 1199AccessorDeclarationSyntax accessor => accessor.AttributeLists, 1210AccessorDeclarationSyntax accessor => accessor.WithAttributeLists(attributeLists), 1656AccessorDeclarationSyntax accessor => accessor.WithModifiers(modifiers), 2471SyntaxKind.RemoveAccessorDeclaration => ((AccessorDeclarationSyntax)declaration).Body?.Statements, 2482AccessorDeclarationSyntax accessor => accessor.Body, 2495AccessorDeclarationSyntax accessor => accessor.WithBody(somebody).WithSemicolonToken(semicolon).WithExpressionBody(null), 2551private static AccessorDeclarationSyntax? AsAccessor(SyntaxNode node, SyntaxKind parentKind) 2561return (AccessorDeclarationSyntax)node; 2570return (AccessorDeclarationSyntax)node; 2579private static AccessorDeclarationSyntax? GetAccessor(SyntaxNode declaration, SyntaxKind kind) 2585private SyntaxNode WithAccessor(SyntaxNode declaration, SyntaxKind kind, AccessorDeclarationSyntax accessor) 2588private SyntaxNode WithAccessor(SyntaxNode declaration, AccessorListSyntax? accessorList, SyntaxKind kind, AccessorDeclarationSyntax? accessor) 2592var acc = accessorList.Accessors.FirstOrDefault(a => a.IsKind(kind)); 2608var accessor = GetAccessor(declaration, SyntaxKind.GetAccessorDeclaration); 2614var accessor = GetAccessor(declaration, SyntaxKind.SetAccessorDeclaration); 2626var accessor = GetAccessor(declaration, kind); 2634return this.WithAccessor(declaration, kind, (AccessorDeclarationSyntax)this.WithStatements(accessor, statements));
Rename\CSharpRenameRewriterLanguageService.cs (4)
261&& IsNameConflictWithProperty("get", token.Parent as AccessorDeclarationSyntax); 265&& IsNameConflictWithProperty("set", token.Parent as AccessorDeclarationSyntax); 270&& IsNameConflictWithProperty("set", token.Parent as AccessorDeclarationSyntax); 272private 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)
215AccessorDeclarationSyntax) 383previousToken.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)
247AccessorDeclarationSyntax;
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)), 406case AccessorDeclarationSyntax accessor: 410var newAccessor = accessor.WithAttributeLists(newAttributeLists); 500else if (destinationMember is AccessorDeclarationSyntax accessorDeclaration)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (3)
162var accessors = new List<AccessorDeclarationSyntax?> 171private static AccessorDeclarationSyntax? GenerateAccessorDeclaration( 184private static AccessorDeclarationSyntax GenerateAccessorDeclaration(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (7)
184var accessor = accessorList.Accessors[0]; 233private static AccessorDeclarationSyntax UseExpressionBodyIfDesired( 234CSharpCodeGenerationContextInfo info, AccessorDeclarationSyntax declaration, CancellationToken cancellationToken) 252SyntaxKind declarationKind, AccessorDeclarationSyntax accessor, LanguageVersion languageVersion, ExpressionBodyPreference preference, CancellationToken cancellationToken, 291private static AccessorDeclarationSyntax? GenerateAccessorDeclaration( 305private static AccessorDeclarationSyntax GenerateAccessorDeclaration( 313var 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)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (4)
256if (node is AccessorDeclarationSyntax accessorDeclaration) 294private static AccessorDeclarationSyntax RemoveThrowNotImplemented(AccessorDeclarationSyntax accessorDeclaration) 296var result = accessorDeclaration
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)