8 overrides of GetSyntax
Microsoft.CodeAnalysis (1)
Syntax\TranslationSyntaxReference.cs (1)
34public sealed override SyntaxNode GetSyntax(CancellationToken cancellationToken = default(CancellationToken))
Microsoft.CodeAnalysis.CSharp (1)
Syntax\SimpleSyntaxReference.cs (1)
38public override SyntaxNode GetSyntax(CancellationToken cancellationToken)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
DeclarationTests.cs (1)
911public override SyntaxNode GetSyntax(CancellationToken cancellationToken)
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
Workspace\LanguageServices\CSharpSyntaxTreeFactoryService.NodeSyntaxReference.cs (1)
27public override SyntaxNode GetSyntax(CancellationToken cancellationToken)
Microsoft.CodeAnalysis.VisualBasic (1)
Syntax\SimpleSyntaxReference.vb (1)
35Public Overrides Function GetSyntax(Optional cancellationToken As CancellationToken = Nothing) As SyntaxNode
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSymbolDeclarationService.vb (1)
42Public Overrides Function GetSyntax(Optional cancellationToken As CancellationToken = Nothing) As SyntaxNode
Microsoft.CodeAnalysis.VisualBasic.Workspaces (2)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSymbolDeclarationService.vb (1)
42Public Overrides Function GetSyntax(Optional cancellationToken As CancellationToken = Nothing) As SyntaxNode
Workspace\LanguageServices\VisualBasicSyntaxTreeFactoryService.NodeSyntaxReference.vb (1)
30Public Overrides Function GetSyntax(Optional cancellationToken As CancellationToken = Nothing) As SyntaxNode
460 references to GetSyntax
ILLink.RoslynAnalyzer (1)
TrimAnalysis\DiagnosticContext.cs (1)
76 symbolLocation = symbol.DeclaringSyntaxReferences[0].GetSyntax ().GetLocation ();
Microsoft.AspNetCore.App.Analyzers (9)
Mvc\DetectOverriddenAuthorizeAttribute.cs (1)
218syntaxReference.GetSyntax(context.CancellationToken).GetLocation(),
Mvc\MvcAnalyzer.cs (1)
177if (attribute.ApplicationSyntaxReference.GetSyntax(cancellationToken) is AttributeSyntax attributeSyntax &&
RouteEmbeddedLanguage\RoutePatternHighlighter.cs (2)
78var syntaxNode = item.GetSyntax(cancellationToken); 89var methodSyntax = item.GetSyntax(cancellationToken);
RouteHandlers\AtMostOneFromBodyAttribute.cs (1)
52var syntax = symbol.DeclaringSyntaxReferences[0].GetSyntax(context.CancellationToken);
RouteHandlers\DetectMismatchedParameterOptionality.cs (1)
35var location = parameter.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax().GetLocation();
RouteHandlers\DisallowMvcBindArgumentsOnParameters.cs (1)
32var syntax = parameter.DeclaringSyntaxReferences[0].GetSyntax(context.CancellationToken);
RouteHandlers\DisallowNonParsableComplexTypesOnParameters.cs (1)
47var syntax = (ParameterSyntax)handlerDelegateParameter.DeclaringSyntaxReferences[0].GetSyntax(context.CancellationToken);
RouteHandlers\RouteHandlerAnalyzer.cs (1)
127var syntaxNode = syntaxReference.GetSyntax(context.CancellationToken);
Microsoft.AspNetCore.App.SourceGenerators (1)
PublicTopLevelProgramGenerator.cs (1)
34.Select(static (declaringSyntaxReference, cancellationToken) => declaringSyntaxReference?.GetSyntax(cancellationToken) is ClassDeclarationSyntax ? null : declaringSyntaxReference);
Microsoft.AspNetCore.Components.Analyzers (3)
ComponentParameterAnalyzer.cs (1)
152symbol.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken) is PropertyDeclarationSyntax syntax &&
InternalUsageAnalyzer.cs (2)
168symbolForDiagnostic.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax().GetLocation() ?? Location.None, 178symbolForDiagnostic.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax().GetLocation() ?? Location.None,
Microsoft.AspNetCore.Components.SdkAnalyzers (2)
InternalUsageAnalyzer.cs (2)
168symbolForDiagnostic.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax().GetLocation() ?? Location.None, 178symbolForDiagnostic.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax().GetLocation() ?? Location.None,
Microsoft.AspNetCore.Http.RequestDelegateGenerator (1)
StaticRouteHandlerModel\InvocationOperationExtensions.cs (1)
101var syn = syntaxReference.GetSyntax();
Microsoft.AspNetCore.Mvc.Analyzers (1)
AttributesShouldNotBeAppliedToPageModelAnalyzer.cs (1)
139var syntax = attribute.ApplicationSyntaxReference.GetSyntax(context.CancellationToken);
Microsoft.CodeAnalysis (4)
DiagnosticAnalyzer\AnalyzerDriver.cs (2)
1888return model.GetTopmostNodeForDiagnosticAnalysis(symbol, syntaxReference.GetSyntax(cancellationToken)); 2545SyntaxNode declaringReferenceSyntax = declaration.GetSyntax(cancellationToken);
Emit\Context.cs (1)
22public SyntaxNode? SyntaxNode => _syntaxNode ?? SyntaxReference?.GetSyntax();
Syntax\SyntaxReference.cs (1)
40return Task.FromResult(this.GetSyntax(cancellationToken));
Microsoft.CodeAnalysis.CodeStyle (14)
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
524var fadingNode = fadingLocation?.GetSyntax(cancellationToken) ?? diagnosticLocation.FindNode(cancellationToken);
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (2)
80var syntax = syntaxRef.GetSyntax(cancellationToken); 263var methodSyntax = method.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax(cancellationToken);
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
323variableDeclarator = fieldReference.GetSyntax(cancellationToken) as TVariableDeclarator;
src\Analyzers\Core\Analyzers\UseSystemHashCode\UseSystemHashCodeDiagnosticAnalyzer.cs (1)
78var declarationLocation = context.OwningSymbol.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken).GetLocation();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IParameterSymbolExtensions.cs (6)
37var parameterSyntax = parameter.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 38var constructorSyntax = constructor.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 39if (containingType.DeclaringSyntaxReferences.Any(static (r, arg) => r.GetSyntax(arg.cancellationToken) == arg.constructorSyntax, (constructorSyntax, cancellationToken))) 45property.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken) == parameterSyntax) 68var constructorSyntax = constructorReference.GetSyntax(cancellationToken); 69return containingType.DeclaringSyntaxReferences.Any(static (r, arg) => r.GetSyntax(arg.cancellationToken) == arg.constructorSyntax, (constructorSyntax, cancellationToken));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (1)
542var declarationSyntax = symbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (2)
34result.Add(syntaxRef.GetSyntax(cancellationToken).GetLocation()); 108return reference.GetSyntax(cancellationToken);
Microsoft.CodeAnalysis.CodeStyle.Fixes (4)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (2)
72var declarator = syntaxRef.GetSyntax(cancellationToken); 88var declarator = syntaxRef.GetSyntax(cancellationToken);
src\Analyzers\Core\CodeFixes\UseSystemHashCode\UseSystemHashCodeCodeFixProvider.cs (1)
64var methodBlock = declarationService.GetDeclarations(method)[0].GetSyntax(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
184? attribute.ApplicationSyntaxReference.GetSyntax() as T
Microsoft.CodeAnalysis.CSharp (69)
Binder\AliasAndExternAliasDirective.cs (1)
27public ExternAliasDirectiveSyntax? ExternAliasDirective => (ExternAliasDirectiveSyntax?)ExternAliasDirectiveReference?.GetSyntax();
Binder\AliasAndUsingDirective.cs (1)
21public UsingDirectiveSyntax? UsingDirective => (UsingDirectiveSyntax?)UsingDirectiveReference?.GetSyntax();
Binder\Binder_Initializers.cs (2)
99switch (syntaxRef.GetSyntax()) 197var syntax = (CSharpSyntaxNode)syntaxRef.GetSyntax();
Binder\Binder_Statements.cs (1)
3876containerNode = containingType.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).OfType<TypeDeclarationSyntax>().First();
Binder\NamespaceOrTypeAndUsingDirective.cs (1)
24public UsingDirectiveSyntax? UsingDirective => (UsingDirectiveSyntax?)UsingDirectiveReference?.GetSyntax();
Binder\WithExternAndUsingAliasesBinder.cs (1)
182result = result.AddAliasesIfAny(((CompilationUnitSyntax)declaration.SyntaxReference.GetSyntax()).Usings, onlyGlobalAliases: true);
CodeGen\EmitStatement.cs (2)
753DefineLocal(local, !declaringReferences.IsEmpty ? (CSharpSyntaxNode)declaringReferences[0].GetSyntax() : block.Syntax); 1117var localSyntax = !declaringReferences.IsEmpty ? (CSharpSyntaxNode)declaringReferences[0].GetSyntax() : catchBlock.Syntax;
Compiler\DocumentationCommentCompiler.cs (1)
700ImmutableArray<DocumentationCommentTriviaSyntax> triviaList = SourceDocumentationCommentUtils.GetDocumentationCommentTriviaFromSyntaxNode((CSharpSyntaxNode)reference.GetSyntax(), diagnosticBag);
Declarations\MergedTypeDeclaration.cs (1)
72var typeDecl = syntaxRef.GetSyntax();
Lowering\ClosureConversion\ClosureConversion.cs (1)
410var syntax = originalMethod.DeclaringSyntaxReferences[0].GetSyntax();
Symbols\AliasSymbol.cs (1)
322: ResolveAliasTarget((UsingDirectiveSyntax)_directive.GetSyntax(), newDiagnostics, basesBeingResolved);
Symbols\Attributes\SourceAttributeData.cs (1)
134var attributeSyntax = (AttributeSyntax)_applicationNode.GetSyntax();
Symbols\MethodSymbolExtensions.cs (1)
202SyntaxNode node = reference.GetSyntax();
Symbols\Source\CrefTypeParameterSymbol.cs (2)
112other._declaringSyntax.GetSyntax() == _declaringSyntax.GetSyntax();
Symbols\Source\GlobalExpressionVariable.cs (2)
60protected override TypeSyntax TypeSyntax => (TypeSyntax)_typeSyntaxOpt?.GetSyntax(); 186var nodeToBind = _nodeToBind.GetSyntax();
Symbols\Source\LocalFunctionSymbol.cs (1)
102internal LocalFunctionStatementSyntax Syntax => (LocalFunctionStatementSyntax)syntaxReferenceOpt.GetSyntax();
Symbols\Source\SourceComplexParameterSymbol.cs (2)
53Debug.Assert((syntaxRef == null) || (syntaxRef.GetSyntax().IsKind(SyntaxKind.Parameter))); 86private ParameterSyntax ParameterSyntax => (ParameterSyntax)_syntaxRef?.GetSyntax();
Symbols\Source\SourceConstructorSymbol.cs (1)
104return (ConstructorDeclarationSyntax)syntaxReferenceOpt.GetSyntax();
Symbols\Source\SourceConstructorSymbolBase.cs (2)
35var syntax = (CSharpSyntaxNode)syntaxReferenceOpt.GetSyntax(); 175var ctorSyntax = (CSharpSyntaxNode)syntaxReferenceOpt.GetSyntax();
Symbols\Source\SourceCustomEventAccessorSymbol.cs (1)
64return (AccessorDeclarationSyntax)syntaxReferenceOpt.GetSyntax();
Symbols\Source\SourceDelegateMethodSymbol.cs (1)
311var syntax = (DelegateDeclarationSyntax)SyntaxRef.GetSyntax();
Symbols\Source\SourceDestructorSymbol.cs (1)
91return (DestructorDeclarationSyntax)syntaxReferenceOpt.GetSyntax();
Symbols\Source\SourceEventSymbol.cs (1)
420get { return (CSharpSyntaxNode)_syntaxRef.GetSyntax(); }
Symbols\Source\SourceFieldSymbol.cs (1)
201return (CSharpSyntaxNode)_syntaxReference.GetSyntax();
Symbols\Source\SourceMemberContainerSymbol.cs (4)
1861SyntaxToken? identifier = syntaxRef.GetSyntax() switch 2145((ConstructorDeclarationSyntax)method1.SyntaxRef.GetSyntax()).Identifier.ValueText != this.Name) 2756var syntax = syntaxRef.GetSyntax() as TypeDeclarationSyntax; 3517var syntax = decl.SyntaxReference.GetSyntax();
Symbols\Source\SourceMethodSymbolWithAttributes.cs (1)
89return (this.syntaxReferenceOpt == null) ? null : (CSharpSyntaxNode)this.syntaxReferenceOpt.GetSyntax();
Symbols\Source\SourceNamedTypeSymbol.cs (5)
42TypeDeclarationSyntax typeBlock = (TypeDeclarationSyntax)part.GetSyntax(); 152var typeDecl = (CSharpSyntaxNode)syntaxRef.GetSyntax(); 327var constraintClauses = GetConstraintClauses((CSharpSyntaxNode)syntaxRef.GetSyntax(), out TypeParameterListSyntax typeParameterList); 385if (GetConstraintClauses((CSharpSyntaxNode)decl.SyntaxReference.GetSyntax(), out _).Count != 0) 408var constraintClauses = GetConstraintClauses((CSharpSyntaxNode)syntaxRef.GetSyntax(), out TypeParameterListSyntax typeParameterList);
Symbols\Source\SourceNamedTypeSymbol_Bases.cs (2)
430var typeDeclaration = (BaseTypeDeclarationSyntax)decl.SyntaxReference.GetSyntax(); 633(TypeKind != TypeKind.Class || baseType.TypeKind == TypeKind.Interface || ((TypeDeclarationSyntax)decl.SyntaxReference.GetSyntax()).ParameterList is null))
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (7)
79if (declarationSyntaxRef.GetSyntax() == declarationSyntax) 420return (_lazyExternAliases ?? GetExternAliasesAndDiagnostics(declaringSymbol, (CSharpSyntaxNode)declarationSyntax.GetSyntax())).ExternAliases; 527return (_lazyGlobalUsings ?? GetGlobalUsingsAndDiagnostics(declaringSymbol, (CSharpSyntaxNode)declarationSyntax.GetSyntax(), basesBeingResolved)).UsingAliasesMap ?? ImmutableDictionary<string, AliasAndUsingDirective>.Empty; 542return (_lazyGlobalUsings ?? GetGlobalUsingsAndDiagnostics(declaringSymbol, (CSharpSyntaxNode)declarationSyntax.GetSyntax(), basesBeingResolved)).UsingNamespacesOrTypes; 914var externAliasesAndDiagnostics = _lazyExternAliases ?? GetExternAliasesAndDiagnostics(declaringSymbol, (CSharpSyntaxNode)declarationSyntax.GetSyntax(cancellationToken)); 919GetGlobalUsingsAndDiagnostics(declaringSymbol, (CSharpSyntaxNode)declarationSyntax.GetSyntax(cancellationToken), basesBeingResolved: null) : 923var usingsAndDiagnostics = _lazyUsings ?? GetUsingsAndDiagnostics(declaringSymbol, (CSharpSyntaxNode)declarationSyntax.GetSyntax(cancellationToken), basesBeingResolved: null);
Symbols\Source\SourceOrdinaryMethodSymbol.cs (1)
271return (MethodDeclarationSyntax)syntaxReferenceOpt.GetSyntax();
Symbols\Source\SourcePropertyAccessorSymbol.cs (1)
590return (CSharpSyntaxNode)syntaxReferenceOpt.GetSyntax();
Symbols\Source\SourcePropertySymbolBase.cs (1)
843return (CSharpSyntaxNode)_syntaxRef.GetSyntax();
Symbols\Source\SourceTypeParameterSymbol.cs (1)
124var syntax = (TypeParameterSyntax)syntaxRef.GetSyntax();
Symbols\Source\SourceUserDefinedConversionSymbol.cs (1)
96return (ConversionOperatorDeclarationSyntax)syntaxReferenceOpt.GetSyntax();
Symbols\Source\SourceUserDefinedOperatorSymbol.cs (1)
96return (OperatorDeclarationSyntax)syntaxReferenceOpt.GetSyntax();
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (2)
303switch (syntaxReferenceOpt.GetSyntax()) 794switch (syntaxReferenceOpt.GetSyntax())
Symbols\Source\TypeParameterBuilder.cs (2)
29Debug.Assert(syntaxRef.GetSyntax().IsKind(SyntaxKind.TypeParameter)); 36var syntaxNode = (TypeParameterSyntax)_syntaxRef.GetSyntax();
Symbols\SymbolExtensions.cs (1)
376return (CSharpSyntaxNode)reference.GetSyntax();
Symbols\Synthesized\Records\SynthesizedPrimaryConstructor.cs (1)
60return (TypeDeclarationSyntax)syntaxReferenceOpt.GetSyntax();
Symbols\Synthesized\Records\SynthesizedRecordEqualityContractProperty.cs (2)
21syntax: (CSharpSyntaxNode)containingType.SyntaxReferences[0].GetSyntax(), 71(CSharpSyntaxNode)((SourceMemberContainerTypeSymbol)ContainingType).SyntaxReferences[0].GetSyntax(),
Symbols\Synthesized\Records\SynthesizedRecordEqualityOperatorBase.cs (1)
39: base(MethodKind.UserDefinedOperator, explicitInterfaceType: null, name, containingType, containingType.GetFirstLocation(), (CSharpSyntaxNode)containingType.SyntaxReferences[0].GetSyntax(),
Symbols\Synthesized\Records\SynthesizedRecordOrdinaryMethod.cs (1)
24: base(containingType, name, containingType.GetFirstLocation(), (CSharpSyntaxNode)containingType.SyntaxReferences[0].GetSyntax(),
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (2)
32Debug.Assert(declaration.SyntaxReference.GetSyntax() is CompilationUnitSyntax); 69var compilationUnit = (CompilationUnitSyntax)declaration.SyntaxReference.GetSyntax();
Symbols\VarianceSafety.cs (1)
490return syntaxRefs[0].GetSyntax() as T;
Syntax\NamespaceDeclarationSyntaxReference.cs (1)
30var node = (CSharpSyntaxNode)reference.GetSyntax(cancellationToken);
Microsoft.CodeAnalysis.CSharp.CodeStyle (22)
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (1)
96if (syntaxRefs[0].GetSyntax() is not VariableDeclaratorSyntax declarator)
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
144if (localReference?.GetSyntax(cancellationToken) is not VariableDeclaratorSyntax localDeclarator)
src\Analyzers\CSharp\Analyzers\MakeLocalFunctionStatic\MakeLocalFunctionStaticHelper.cs (1)
32var node = calledLocationFunction.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax();
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (3)
70var declaration = reference.GetSyntax(cancellationToken); 188reference.GetSyntax(cancellationToken) is PropertyDeclarationSyntax property && 195var declaration = methodReference.GetSyntax(cancellationToken);
src\Analyzers\CSharp\Analyzers\MakeStructReadOnly\CSharpMakeStructReadOnlyDiagnosticAnalyzer.cs (1)
92if (typeReference.GetSyntax(cancellationToken) is not TypeDeclarationSyntax typeDeclaration)
src\Analyzers\CSharp\Analyzers\NamingStyle\CSharpNamingStyleDiagnosticAnalyzer.cs (1)
31&& symbol.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() is ParameterSyntax
src\Analyzers\CSharp\Analyzers\QualifyMemberAccess\CSharpQualifyMemberAccessDiagnosticAnalyzer.cs (1)
57.Select(declaringSyntaxReferences => declaringSyntaxReferences.GetSyntax())
src\Analyzers\CSharp\Analyzers\RemoveUnusedMembers\CSharpRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
26.Select(r => r.GetSyntax(cancellationToken))
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (3)
208var declaration = getMethod.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 231var setAccessor = setMethod.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken) as AccessorDeclarationSyntax; 263var syntax = accessor.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken);
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
332declarator = localSymbol?.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() as VariableDeclaratorSyntax;
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (3)
108nodeToRemove = memberReference.GetSyntax(cancellationToken); 360if (constructorReference.GetSyntax(cancellationToken) is not ConstructorDeclarationSyntax constructorDeclaration) 522!syntaxRef.GetSyntax(cancellationToken).AncestorsAndSelf().Any(a => a == assignmentExpression))
src\Analyzers\CSharp\Analyzers\UseSystemThreadingLock\CSharpUseSystemThreadingLockDiagnosticAnalyzer.cs (1)
114if (fieldSyntaxReference.GetSyntax(cancellationToken) is not VariableDeclaratorSyntax variableDeclarator)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
53c => c.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() is RecordDeclarationSyntax or ClassDeclarationSyntax or StructDeclarationSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (3)
95var enumDecl = namedTypeSymbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).OfType<EnumDeclarationSyntax>().FirstOrDefault(); 239var node = syntaxRef.GetSyntax(cancellationToken); 387var node = syntaxReference.GetSyntax(cancellationToken);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (10)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (2)
315=> member.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() == 316param.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax());
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (1)
190if (constructor.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken) is ConstructorDeclarationSyntax constructorDeclarationSyntax &&
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (4)
176var syntax = local.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 187var syntax = field.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 204var syntax = property.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 304if (parameterSymbol?.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax(cancellationToken) is ParameterSyntax parameterSyntax &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
275var reusableSyntaxNode = symbol.DeclaringSyntaxReferences[0].GetSyntax();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
375var attributeSyntaxToRemove = attributeToRemove.ApplicationSyntaxReference.GetSyntax(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
101if (reference.GetSyntax().ChildTokens().Any(t => t.IsKind(SyntaxKind.UnsafeKeyword)))
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
GoToBase\CSharpGoToBaseService.cs (1)
29if (constructor.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax(cancellationToken) is not ConstructorDeclarationSyntax constructorDeclaration)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
SymbolKey\SymbolKeyTestBase.cs (1)
128foreach (var node in symbol.DeclaringSyntaxReferences.Select(d => d.GetSyntax()))
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
CodeGen\CodeGenTupleTest.cs (2)
15879return x.GetSyntax().Equals(y.GetSyntax());
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (8)
Semantics\OutVarTests.cs (3)
968Assert.Equal(variableDeclaratorSyntax, symbol.DeclaringSyntaxReferences.Single().GetSyntax()); 1142Assert.Equal(variableDesignationSyntax, symbol.DeclaringSyntaxReferences.Single().GetSyntax()); 32687Assert.Equal(variableDesignationSyntax, symbol.DeclaringSyntaxReferences.Single().GetSyntax());
Semantics\PatternMatchingTestBase.cs (5)
83Assert.Equal(designation, symbol.DeclaringSyntaxReferences.Single().GetSyntax()); 144Assert.Equal(designation, symbol.DeclaringSyntaxReferences.Single().GetSyntax()); 170Assert.Equal(declarator, symbol.DeclaringSyntaxReferences.Single().GetSyntax()); 184Assert.Equal(designation, symbol.DeclaringSyntaxReferences.Single().GetSyntax()); 247Assert.Equal(designation, symbol.DeclaringSyntaxReferences.Single().GetSyntax());
Microsoft.CodeAnalysis.CSharp.Features (48)
Completion\CompletionProviders\CompletionUtilities.cs (1)
167symbol.DeclaringSyntaxReferences[0].GetSyntax().Kind() == SyntaxKind.DefaultSwitchLabel)
Completion\CompletionProviders\PartialMethodCompletionProvider.cs (2)
38var declaration = (MethodDeclarationSyntax)method.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 84var declarations = method.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).OfType<MethodDeclarationSyntax>();
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (1)
285var memberDeclarationSyntax = memberDeclarationSymbol.DeclaringSyntaxReferences.Single().GetSyntax();
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (1)
781return declaredSymbol.DeclaringSyntaxReferences.Single().GetSyntax();
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (4)
977var ctorInitializer = ((ConstructorDeclarationSyntax)symbol.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken)).Initializer; 994|| ((BaseTypeDeclarationSyntax)syntaxRefs.Single().GetSyntax()).Modifiers.Any(SyntaxKind.PartialKeyword); 1015_ => selector(symbol.DeclaringSyntaxReferences)?.GetSyntax(cancellationToken) 1029return recordType.InstanceConstructors.Single(ctor => ctor.DeclaringSyntaxReferences is [var syntaxRef] && syntaxRef.GetSyntax(cancellationToken) == declaration.Parent);
EncapsulateField\CSharpEncapsulateFieldService.cs (2)
191=> field.DeclaringSyntaxReferences.Any(static d => d.GetSyntax().GetAncestor<FieldDeclarationSyntax>().Modifiers.Any(SyntaxKind.NewKeyword)); 204c => c.DeclaringSyntaxReferences.Select(d => d.GetSyntax()).OfType<ConstructorDeclarationSyntax>());
GenerateConstructorFromMembers\CSharpGenerateConstructorFromMembersCodeRefactoringProvider.cs (1)
62if (property.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken) is not PropertyDeclarationSyntax propertyDeclaration)
GoToDefinition\CSharpGoToDefinitionSymbolService.cs (1)
84return target.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax()?.SpanStart;
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider.cs (1)
283if (syntaxReference.GetSyntax(cancellationToken) is TypeDeclarationSyntax typeDeclaration)
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider_Update.cs (3)
151var syntax = syntaxReference.GetSyntax(cancellationToken); 225if (syntaxRef.GetSyntax(cancellationToken) is PropertyDeclarationSyntax propertyDeclaration) 245if (syntaxRef.GetSyntax(cancellationToken) is VariableDeclaratorSyntax variableDeclarator)
InitializeParameter\InitializeParameterHelpers.cs (1)
149var node = accessor.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken);
LanguageServices\CSharpSymbolDisplayService.SymbolDescriptionBuilder.cs (1)
198var syntax = method.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax();
NavigationBar\CSharpNavigationBarItemService.cs (2)
225var declaringNode = reference.GetSyntax(); 247var declaringNode = reference.GetSyntax();
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (2)
127var setAccessorDeclaration = (AccessorDeclarationSyntax)setMethod.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 200var getAccessorDeclaration = (AccessorDeclarationSyntax)getMethod.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken);
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (1)
96if (syntaxRefs[0].GetSyntax() is not VariableDeclaratorSyntax declarator)
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
144if (localReference?.GetSyntax(cancellationToken) is not VariableDeclaratorSyntax localDeclarator)
src\Analyzers\CSharp\Analyzers\MakeLocalFunctionStatic\MakeLocalFunctionStaticHelper.cs (1)
32var node = calledLocationFunction.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax();
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (3)
70var declaration = reference.GetSyntax(cancellationToken); 188reference.GetSyntax(cancellationToken) is PropertyDeclarationSyntax property && 195var declaration = methodReference.GetSyntax(cancellationToken);
src\Analyzers\CSharp\Analyzers\MakeStructReadOnly\CSharpMakeStructReadOnlyDiagnosticAnalyzer.cs (1)
92if (typeReference.GetSyntax(cancellationToken) is not TypeDeclarationSyntax typeDeclaration)
src\Analyzers\CSharp\Analyzers\NamingStyle\CSharpNamingStyleDiagnosticAnalyzer.cs (1)
31&& symbol.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() is ParameterSyntax
src\Analyzers\CSharp\Analyzers\QualifyMemberAccess\CSharpQualifyMemberAccessDiagnosticAnalyzer.cs (1)
57.Select(declaringSyntaxReferences => declaringSyntaxReferences.GetSyntax())
src\Analyzers\CSharp\Analyzers\RemoveUnusedMembers\CSharpRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
26.Select(r => r.GetSyntax(cancellationToken))
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (3)
208var declaration = getMethod.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 231var setAccessor = setMethod.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken) as AccessorDeclarationSyntax; 263var syntax = accessor.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken);
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
332declarator = localSymbol?.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() as VariableDeclaratorSyntax;
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (3)
108nodeToRemove = memberReference.GetSyntax(cancellationToken); 360if (constructorReference.GetSyntax(cancellationToken) is not ConstructorDeclarationSyntax constructorDeclaration) 522!syntaxRef.GetSyntax(cancellationToken).AncestorsAndSelf().Any(a => a == assignmentExpression))
src\Analyzers\CSharp\Analyzers\UseSystemThreadingLock\CSharpUseSystemThreadingLockDiagnosticAnalyzer.cs (1)
114if (fieldSyntaxReference.GetSyntax(cancellationToken) is not VariableDeclaratorSyntax variableDeclarator)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (2)
315=> member.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() == 316param.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax());
src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (1)
190if (constructor.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken) is ConstructorDeclarationSyntax constructorDeclarationSyntax &&
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (4)
176var syntax = local.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 187var syntax = field.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 204var syntax = property.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 304if (parameterSymbol?.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax(cancellationToken) is ParameterSyntax parameterSyntax &&
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (8)
Semantics\TopLevelStatementsTests.cs (8)
6537switch (context.Symbol.DeclaringSyntaxReferences.Single().GetSyntax().ToString()) 6613switch (context.Symbol.DeclaringSyntaxReferences.Single().GetSyntax().ToString()) 6637switch (syntaxReference.GetSyntax().ToString()) 6656Assert.Equal("System.Console.WriteLine(1);", context.Symbol.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 6663Assert.Equal("System.Console.WriteLine(2);", context.Symbol.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 6742Assert.Same(context.ContainingSymbol.DeclaringSyntaxReferences.Single().GetSyntax(), context.Operation.Syntax); 7086var decl = (CSharpSyntaxNode)context.ContainingSymbol.DeclaringSyntaxReferences.Single().GetSyntax(); 7420Assert.Same(context.ContainingSymbol.DeclaringSyntaxReferences.Single().GetSyntax(), context.Operation.Syntax);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (61)
Compilation\GetImportScopesTests.cs (39)
56Assert.True(scopes.Single().Imports.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax); 72Assert.True(scopes.Single().Imports.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax); 103Assert.True(scopes.Single().Imports.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax); 131Assert.True(scopes.Single().Imports.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax); 149Assert.True(scopes.Single().Imports.Any(i => i.DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } })); 150Assert.True(scopes.Single().Imports.Any(i => i.DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(Microsoft) } })); 176Assert.True(scopes.Single().Imports.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } }); 199Assert.True(scopes[0].Imports.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(Microsoft) } }); 201Assert.True(scopes[1].Imports.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } }); 227Assert.True(scopes[0].Imports.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(Microsoft) } }); 229Assert.True(scopes[1].Imports.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } }); 245Assert.True(scopes.Single().Aliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax); 261Assert.True(scopes.Single().Aliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax); 292Assert.True(scopes.Single().Aliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax); 320Assert.True(scopes.Single().Aliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax); 338Assert.True(scopes.Single().Aliases.Any(a => a.DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } })); 339Assert.True(scopes.Single().Aliases.Any(a => a.DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(Microsoft) } })); 365Assert.True(scopes.Single().Aliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } }); 388Assert.True(scopes[0].Aliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(Microsoft) } }); 390Assert.True(scopes[1].Aliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } }); 419Assert.True(scopes.Single().ExternAliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is ExternAliasDirectiveSyntax); 438Assert.True(scopes.Single().ExternAliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is ExternAliasDirectiveSyntax); 460Assert.True(scopes.Single().ExternAliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is ExternAliasDirectiveSyntax); 481Assert.True(scopes.Single().ExternAliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is ExternAliasDirectiveSyntax); 500Assert.True(scopes.Single().ExternAliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is ExternAliasDirectiveSyntax); 517Assert.True(scopes.Single().ExternAliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is ExternAliasDirectiveSyntax); 538Assert.True(scopes.Single().ExternAliases.Any(a => a.DeclaringSyntaxReferences.Single().GetSyntax() is ExternAliasDirectiveSyntax { Identifier.Text: "CORE1" })); 539Assert.True(scopes.Single().ExternAliases.Any(a => a.DeclaringSyntaxReferences.Single().GetSyntax() is ExternAliasDirectiveSyntax { Identifier.Text: "CORE2" })); 568Assert.True(scopes.Single().ExternAliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is ExternAliasDirectiveSyntax { Identifier.Text: "CORE1" }); 594Assert.True(scopes[0].ExternAliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is ExternAliasDirectiveSyntax { Identifier.Text: "CORE2" }); 596Assert.True(scopes[1].ExternAliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is ExternAliasDirectiveSyntax { Identifier.Text: "CORE1" }); 623Assert.True(scopes.Single().Aliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Alias.Name.Identifier.Text: "M" }); 626Assert.True(scopes.Single().Imports.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } }); 649Assert.True(scopes.Single().Imports.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax); 653Assert.True(scopes.Single().Aliases.Single().DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Alias.Name.Identifier.Text: "M" }); 683Assert.True(scopes.Single().Imports.Any(i => i.DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } })); 685Assert.True(scopes.Single().Imports.Any(i => i.DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: QualifiedNameSyntax { Right: IdentifierNameSyntax { Identifier.Text: nameof(System.IO) } } })); 689Assert.True(scopes.Single().Aliases.Any(i => i.DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(Microsoft) } })); 691Assert.True(scopes.Single().Aliases.Any(i => i.DeclaringSyntaxReferences.Single().GetSyntax() is UsingDirectiveSyntax { Name: QualifiedNameSyntax { Right: IdentifierNameSyntax { Identifier.Text: nameof(System.Threading) } } }));
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (12)
4801Assert.Equal("(1, 2)", type.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 4824Assert.Equal("(Alice: 1, Bob: 2)", type.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 4847Assert.Equal("(1, 1)", type.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 4870Assert.Equal("(1, null)", type.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 4893Assert.Equal("(Alice:1, Bob:null)", type.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 4916Assert.Equal("Bob", element.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 4939Assert.Equal("Bob", element.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 4962Assert.Equal("Bob", element.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 4997Assert.Equal("Bob", element.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 5043Assert.Equal("Bob", element.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 5092Assert.Equal("Bob", element.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 5115Assert.Equal("Bob", element.DeclaringSyntaxReferences.Single().GetSyntax().ToString());
DeclarationTests.cs (1)
915var nodeInUnderlying = _underlyingSyntaxReference.GetSyntax(cancellationToken);
Symbols\Source\DeclaringSyntaxNodeTests.cs (8)
39foreach (var node in declaringReferences.Select(d => d.GetSyntax())) 102foreach (var node in declaringReferences.Select(d => d.GetSyntax())) 129Assert.Same(expectedSyntaxNodes[i], declaringReferences[i].GetSyntax()); 162Assert.Equal(nodes[0].GetSyntax(), node); 345Assert.Same(localType.DeclaringSyntaxReferences[0].GetSyntax(), symbol.DeclaringSyntaxReferences[0].GetSyntax()); 372Assert.Same(propertyInitializer, member.DeclaringSyntaxReferences[0].GetSyntax()); 378Assert.Same(propertyInitializer, propSymbol.DeclaringSyntaxReferences[0].GetSyntax());
Symbols\Source\ExternAliasTests.cs (1)
492Assert.Same(externAliasSyntax, externAliasSymbol.DeclaringSyntaxReferences.Single().GetSyntax());
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (1)
Syntax\LambdaUtilitiesTests.cs (1)
48var enclosingSyntax = enclosingMethod.DeclaringSyntaxReferences.Single().GetSyntax();
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
Extensions.cs (1)
191return type.InstanceConstructors.Single(c => c.DeclaringSyntaxReferences.Any(r => r.GetSyntax() is TypeDeclarationSyntax));
Microsoft.CodeAnalysis.CSharp.Workspaces (11)
Recommendations\CSharpRecommendationServiceRunner.cs (1)
431if (reference.GetSyntax(cancellationToken) is not TypeDeclarationSyntax typeDeclaration)
Simplification\Simplifiers\ExpressionSimplifier.cs (1)
148var declIdentifier = ((UsingDirectiveSyntax)syntaxRef.GetSyntax(cancellationToken)).Alias!.Name.Identifier;
Simplification\Simplifiers\NameSimplifier.cs (1)
124var declIdentifier = ((UsingDirectiveSyntax)syntaxRef.GetSyntax(cancellationToken)).Alias.Name.Identifier;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
53c => c.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() is RecordDeclarationSyntax or ClassDeclarationSyntax or StructDeclarationSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (3)
95var enumDecl = namedTypeSymbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).OfType<EnumDeclarationSyntax>().FirstOrDefault(); 239var node = syntaxRef.GetSyntax(cancellationToken); 387var node = syntaxReference.GetSyntax(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
275var reusableSyntaxNode = symbol.DeclaringSyntaxReferences[0].GetSyntax();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
375var attributeSyntaxToRemove = attributeToRemove.ApplicationSyntaxReference.GetSyntax(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
101if (reference.GetSyntax().ChildTokens().Any(t => t.IsKind(SyntaxKind.UnsafeKeyword)))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (1)
84if (syntaxRef.GetSyntax(cancellationToken) is TypeDeclarationSyntax { BaseList.Types: var baseTypes })
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (16)
CodeGeneration\SyntaxGeneratorTests.cs (16)
3787var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3788var declX = Generator.GetDeclaration(symbolX.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3789var declY = Generator.GetDeclaration(symbolY.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3790var declZ = Generator.GetDeclaration(symbolZ.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3964var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3982var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4003var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4021var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4039var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4057var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4075var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4093var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4111var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4130var declC = symbolC.DeclaringSyntaxReferences.First().GetSyntax(); 4307var declC = symbolC.DeclaringSyntaxReferences.First().GetSyntax(); 4399var declC = symbolC.DeclaringSyntaxReferences.First().GetSyntax();
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
Utilities\SymbolEquivalenceComparerTests.cs (1)
1889var method_root = method.DeclaringSyntaxReferences[0].GetSyntax();
Microsoft.CodeAnalysis.Features (20)
CodeLens\CodeLensFindReferenceProgress.cs (1)
80let candidateSyntaxNode = syntaxReference.GetSyntax(cancellationToken)
Completion\Providers\AbstractPartialTypeCompletionProvider.cs (1)
106.Select(reference => reference.GetSyntax())
Completion\Providers\AbstractSymbolCompletionProvider.cs (1)
75var declarationSyntax = symbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).SingleOrDefault();
EncapsulateField\AbstractEncapsulateFieldService.cs (2)
178document = document.WithSyntaxRoot(fieldDeclaration.SyntaxTree.GetRoot(cancellationToken).ReplaceNode(fieldDeclaration.GetSyntax(cancellationToken), 179fieldDeclaration.GetSyntax(cancellationToken).WithAdditionalAnnotations(declarationAnnotation)));
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (1)
555var symbolSyntax = symbol.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken);
NavigationBar\AbstractNavigationBarItemService.cs (1)
93return GetSymbolLocation(solution, symbol, tree, r => r.GetSyntax().FullSpan, symbolDeclarationService.GetDeclarations(symbol));
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
524var fadingNode = fadingLocation?.GetSyntax(cancellationToken) ?? diagnosticLocation.FindNode(cancellationToken);
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (2)
80var syntax = syntaxRef.GetSyntax(cancellationToken); 263var methodSyntax = method.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax(cancellationToken);
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
323variableDeclarator = fieldReference.GetSyntax(cancellationToken) as TVariableDeclarator;
src\Analyzers\Core\Analyzers\UseSystemHashCode\UseSystemHashCodeDiagnosticAnalyzer.cs (1)
78var declarationLocation = context.OwningSymbol.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken).GetLocation();
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (2)
72var declarator = syntaxRef.GetSyntax(cancellationToken); 88var declarator = syntaxRef.GetSyntax(cancellationToken);
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (6)
96var fieldDocument = currentSolution.GetRequiredDocument(field.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken).SyntaxTree); 97var propertyDocument = currentSolution.GetRequiredDocument(property.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken).SyntaxTree); 111var declarator = (TVariableDeclarator)field.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 112var propertyDeclaration = GetPropertyDeclaration(property.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken)); 191declarator = (TVariableDeclarator)field.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 192propertyDeclaration = GetPropertyDeclaration(property.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken));
Microsoft.CodeAnalysis.Test.Utilities (1)
Diagnostics\OperationTestAnalyzer.cs (1)
853Report(operationContext, decl.Symbol.DeclaringSyntaxReferences.Single().GetSyntax(), LocalVarInitializedDeclarationDescriptor);
Microsoft.CodeAnalysis.VisualBasic (46)
Declarations\MergedTypeDeclaration.vb (1)
83Dim node = syntaxRef.GetSyntax()
Declarations\SingleNamespaceDeclaration.vb (1)
55Return SyntaxReference.GetSyntax().AncestorsAndSelf().OfType(Of NamespaceBlockSyntax)().FirstOrDefault()
GlobalImport.vb (1)
34Return CType(_clause.GetSyntax(), ImportsClauseSyntax)
Symbols\FieldOrPropertyInitializer.vb (8)
42Debug.Assert(TypeOf syntax.GetSyntax() Is StatementSyntax) 55Debug.Assert(syntax.GetSyntax().IsKind(SyntaxKind.AsNewClause) OrElse 56syntax.GetSyntax().IsKind(SyntaxKind.EqualsValue) OrElse 57syntax.GetSyntax().IsKind(SyntaxKind.ModifiedIdentifier)) 70Debug.Assert(syntax.GetSyntax().IsKind(SyntaxKind.AsNewClause) OrElse syntax.GetSyntax().IsKind(SyntaxKind.EqualsValue)) 85Debug.Assert(syntax.GetSyntax().IsKind(SyntaxKind.AsNewClause) OrElse syntax.GetSyntax().IsKind(SyntaxKind.EqualsValue))
Symbols\Source\CrefTypeParameterSymbol.vb (2)
143Me._syntaxReference.GetSyntax().Equals(other._syntaxReference.GetSyntax())
Symbols\Source\SourceComplexParameterSymbol.vb (2)
57DirectCast(Me._syntaxRef.GetSyntax, ParameterSyntax).AttributeLists()) 184Return If(_syntaxRef Is Nothing, Nothing, DirectCast(_syntaxRef.GetSyntax(), ParameterSyntax))
Symbols\Source\SourceEventSymbol.vb (6)
156Dim syntax = DirectCast(_syntaxRef.GetSyntax(), EventStatementSyntax) 252Dim syntax = DirectCast(_syntaxRef.GetSyntax(), EventStatementSyntax) 312Dim syntax = DirectCast(_syntaxRef.GetSyntax(), EventStatementSyntax) 457Dim eventBlock = Me._syntaxRef.GetSyntax(cancellationToken).Parent 580Return DirectCast(_syntaxRef.GetSyntax, EventStatementSyntax).AttributeLists 725Dim eventSyntax = DirectCast(_syntaxRef.GetSyntax(), EventStatementSyntax)
Symbols\Source\SourceFieldSymbol.vb (1)
865Dim syntaxNode = syntaxRef.GetSyntax()
Symbols\Source\SourceMethodSymbol.vb (3)
751Dim decl = m_syntaxReferenceOpt.GetSyntax() 786Return If(m_syntaxReferenceOpt IsNot Nothing, DirectCast(m_syntaxReferenceOpt.GetSyntax(), MethodBaseSyntax), Nothing) 1159methodSyntax = TryCast(m_syntaxReferenceOpt.GetSyntax(), MethodStatementSyntax)
Symbols\Source\SourceNamedTypeSymbol.vb (2)
1314Dim typeBlock = DirectCast(part.GetSyntax(), TypeBlockSyntax) 1763Dim syntax = DirectCast(blockRef.GetSyntax, EnumBlockSyntax)
Symbols\Source\SourceNamedTypeSymbol_GroupClass.vb (1)
320Dim node = syntaxRef.GetSyntax()
Symbols\Source\SourcePropertySymbol.vb (6)
344Dim syntax = DirectCast(_syntaxRef.GetSyntax(), ModifiedIdentifierSyntax) 353Dim syntax = DirectCast(_syntaxRef.GetSyntax(), PropertyStatementSyntax) 479Return OneOrMany.Create(DirectCast(_syntaxRef.GetSyntax, PropertyStatementSyntax).AttributeLists) 834Dim syntax = DirectCast(_syntaxRef.GetSyntax(), PropertyStatementSyntax) 883Dim syntax = DirectCast(_syntaxRef.GetSyntax(), PropertyStatementSyntax) 1006Dim propertySyntax = TryCast(_syntaxRef.GetSyntax(), PropertyStatementSyntax)
Symbols\Source\SourceTypeParameterSymbol.vb (2)
167Dim syntaxNode = syntaxRef.GetSyntax() 357Dim syntax = DirectCast(_syntaxRef.GetSyntax(), TypeParameterSyntax)
Symbols\Source\SynthesizedEventAccessorSymbol.vb (1)
125DirectCast(eventSymbol.SyntaxReference.GetSyntax(), VisualBasicSyntaxNode),
Symbols\Source\SynthesizedInteractiveInitializerMethod.vb (1)
131Return DirectCast(_syntaxReference.GetSyntax(), VisualBasicSyntaxNode)
Symbols\SynthesizedSymbols\SynthesizedConstructorBase.vb (2)
47m_voidType = binder.GetSpecialType(SpecialType.System_Void, syntaxReference.GetSyntax(), diagnostics) 207Return If(m_syntaxReference Is Nothing, Nothing, DirectCast(m_syntaxReference.GetSyntax(), VisualBasicSyntaxNode))
Symbols\SynthesizedSymbols\SynthesizedEventDelegateSymbol.vb (3)
98Return DirectCast(Me._syntaxRef.GetSyntax, EventStatementSyntax) 109Dim evSyntax = asEvent.SyntaxReference.GetSyntax 142Dim evSyntax = asEvent.SyntaxReference.GetSyntax
Syntax\BeginOfBlockSyntaxReference.vb (1)
20Return SyntaxFacts.BeginOfBlockStatementIfAny(reference.GetSyntax(cancellationToken))
Syntax\NamespaceDeclarationSyntaxReference.vb (1)
22Dim node = reference.GetSyntax(cancellationToken)
VisualBasicExtensions.vb (1)
255Return DirectCast(syntaxReference.GetSyntax(cancellationToken), VisualBasicSyntaxNode)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (3)
src\Analyzers\VisualBasic\Analyzers\UseAutoProperty\VisualBasicUseAutoPropertyAnalyzer.vb (2)
105Dim accessor = TryCast(TryCast(getMethod.DeclaringSyntaxReferences(0).GetSyntax(cancellationToken), AccessorStatementSyntax)?.Parent, AccessorBlockSyntax) 128Dim setAccessor = TryCast(TryCast(setMethod.DeclaringSyntaxReferences(0).GetSyntax(cancellationToken), AccessorStatementSyntax)?.Parent, AccessorBlockSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SemanticFacts\VisualBasicSemanticFacts.vb (1)
219Return DirectCast(n.GetSyntax(cancellationToken), TypeStatementSyntax).Modifiers.Any(SyntaxKind.PartialKeyword)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (4)
src\Analyzers\VisualBasic\CodeFixes\GenerateConstructor\VisualBasicGenerateConstructorService.vb (1)
175Dim constructorStatements = constructor.DeclaringSyntaxReferences(0).GetSyntax(cancellationToken).Parent.GetStatements()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationHelpers.vb (1)
202Dim reusableNode = symbol.DeclaringSyntaxReferences(0).GetSyntax()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (1)
364Dim attributeSyntaxToRemove = attributeToRemove.ApplicationSyntaxReference.GetSyntax(cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSymbolDeclarationService.vb (1)
43Return DirectCast(GetBlockFromBegin(_reference.GetSyntax(cancellationToken)), VisualBasicSyntaxNode)
Microsoft.CodeAnalysis.VisualBasic.Features (7)
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (1)
658Dim ctor = TryCast(symbol.DeclaringSyntaxReferences(0).GetSyntax(cancellationToken).Parent, ConstructorBlockSyntax)
InitializeParameter\VisualBasicInitializeMemberFromParameterCodeRefactoringProvider.vb (1)
67Dim reference = accessor.DeclaringSyntaxReferences(0).GetSyntax(cancellationToken)
ReplacePropertyWithMethods\VisualBasicReplacePropertyWithMethods.vb (2)
91TryCast(getMethod.DeclaringSyntaxReferences(0).GetSyntax(cancellationToken), AccessorStatementSyntax)) 124TryCast(setMethod.DeclaringSyntaxReferences(0).GetSyntax(cancellationToken), AccessorStatementSyntax))
src\Analyzers\VisualBasic\Analyzers\UseAutoProperty\VisualBasicUseAutoPropertyAnalyzer.vb (2)
105Dim accessor = TryCast(TryCast(getMethod.DeclaringSyntaxReferences(0).GetSyntax(cancellationToken), AccessorStatementSyntax)?.Parent, AccessorBlockSyntax) 128Dim setAccessor = TryCast(TryCast(setMethod.DeclaringSyntaxReferences(0).GetSyntax(cancellationToken), AccessorStatementSyntax)?.Parent, AccessorBlockSyntax)
src\Analyzers\VisualBasic\CodeFixes\GenerateConstructor\VisualBasicGenerateConstructorService.vb (1)
175Dim constructorStatements = constructor.DeclaringSyntaxReferences(0).GetSyntax(cancellationToken).Parent.GetStatements()
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (19)
Compilation\GetImportScopesTests.vb (18)
52Dim syntax = declaringSyntaxReference.GetSyntax() 59Dim syntax = aliasSymbol.DeclaringSyntaxReferences.Single().GetSyntax() 350Assert.True(TypeOf scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax() Is XmlNamespaceImportsClauseSyntax) 351Assert.Equal("<xmlns:r1=""http://roslyn"">", scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax().ToString()) 368Assert.True(TypeOf scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax() Is XmlNamespaceImportsClauseSyntax) 369Assert.Equal("<xmlns:r1=""http://roslyn"">", scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax().ToString()) 390Assert.True(TypeOf scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax() Is XmlNamespaceImportsClauseSyntax) 391Assert.Equal("<xmlns:r1=""http://roslyn"">", scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax().ToString()) 410Assert.True(TypeOf scopes.Single().XmlNamespaces.First().DeclaringSyntaxReference.GetSyntax() Is XmlNamespaceImportsClauseSyntax) 411Assert.True(scopes.Single().XmlNamespaces.Any(Function(x) x.DeclaringSyntaxReference.GetSyntax().ToString() = "<xmlns:r1=""http://roslyn"">")) 414Assert.True(TypeOf scopes.Single().XmlNamespaces.Last().DeclaringSyntaxReference.GetSyntax() Is XmlNamespaceImportsClauseSyntax) 415Assert.True(scopes.Single().XmlNamespaces.Any(Function(x) x.DeclaringSyntaxReference.GetSyntax().ToString() = "<xmlns:r2=""http://roslyn2"">")) 441Assert.True(TypeOf scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax() Is XmlNamespaceImportsClauseSyntax) 442Assert.Equal("<xmlns:r1=""http://roslyn"">", scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax().ToString()) 465Assert.True(TypeOf scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax() Is XmlNamespaceImportsClauseSyntax) 466Assert.Equal("<xmlns:r1=""http://roslyn"">", scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax().ToString()) 491Assert.True(TypeOf scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax() Is XmlNamespaceImportsClauseSyntax) 492Assert.Equal("<xmlns:r1=""http://roslyn"">", scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax().ToString())
DeclaringSyntaxNodeTests.vb (1)
136Assert.Equal(nodes(0).GetSyntax(), node)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (2)
SymbolsTests\AnonymousTypes\AnonymousTypesSemanticsTests.vb (2)
148Assert.Same(anonObjectCreation, symbol.DeclaringSyntaxReferences(0).GetSyntax()) 180Assert.Same(propertyInitializer, propSymbol.DeclaringSyntaxReferences(0).GetSyntax())
Microsoft.CodeAnalysis.VisualBasic.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SemanticFacts\VisualBasicSemanticFacts.vb (1)
219Return DirectCast(n.GetSyntax(cancellationToken), TypeStatementSyntax).Modifiers.Any(SyntaxKind.PartialKeyword)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationHelpers.vb (1)
202Dim reusableNode = symbol.DeclaringSyntaxReferences(0).GetSyntax()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (1)
364Dim attributeSyntaxToRemove = attributeToRemove.ApplicationSyntaxReference.GetSyntax(cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSymbolDeclarationService.vb (1)
43Return DirectCast(GetBlockFromBegin(_reference.GetSyntax(cancellationToken)), VisualBasicSyntaxNode)
Microsoft.CodeAnalysis.Workspaces (23)
Editing\SymbolEditor.cs (1)
195.Select(sr => sr.GetSyntax())
FindSymbols\FindReferences\Finders\AbstractMemberScopedReferenceFinder.cs (1)
113var syntax = declaration.GetSyntax(cancellationToken);
FindSymbols\FindReferences\Finders\ParameterSymbolReferenceFinder.cs (3)
97var parameterNode = parameter.DeclaringSyntaxReferences.Select(r => r.GetSyntax(cancellationToken)).FirstOrDefault(); 108var lambdaNode = parameter.ContainingSymbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax(cancellationToken)).First(); 148var lambdaNode = symbol.ContainingSymbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax(cancellationToken)).First();
FindSymbols\FindReferences\Finders\PropertySymbolReferenceFinder.cs (2)
84var containingTypeSyntaxes = containingType.DeclaringSyntaxReferences.SelectAsArray(r => r.GetSyntax(cancellationToken)); 89var constructorSyntax = constructor.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken);
FindSymbols\SymbolFinder.cs (1)
295c => c.DeclaringSyntaxReferences.Any(r => linkedNode.Equals(r.GetSyntax(cancellationToken))));
ReassignedVariable\AbstractReassignedVariableService.cs (3)
204var declaration = syntaxReference.GetSyntax(cancellationToken); 226var methodOrPropertyDeclaration = methodOrProperty.DeclaringSyntaxReferences.First().GetSyntax(cancellationToken); 272.Select(r => r.GetSyntax(cancellationToken))
Recommendations\AbstractRecommendationServiceRunner.cs (1)
81if (owningMethod.DeclaringSyntaxReferences.Single().GetSyntax(_cancellationToken) is not TAnonymousFunctionSyntax lambdaSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IParameterSymbolExtensions.cs (6)
37var parameterSyntax = parameter.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 38var constructorSyntax = constructor.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken); 39if (containingType.DeclaringSyntaxReferences.Any(static (r, arg) => r.GetSyntax(arg.cancellationToken) == arg.constructorSyntax, (constructorSyntax, cancellationToken))) 45property.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken) == parameterSyntax) 68var constructorSyntax = constructorReference.GetSyntax(cancellationToken); 69return containingType.DeclaringSyntaxReferences.Any(static (r, arg) => r.GetSyntax(arg.cancellationToken) == arg.constructorSyntax, (constructorSyntax, cancellationToken));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (1)
542var declarationSyntax = symbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (2)
34result.Add(syntaxRef.GetSyntax(cancellationToken).GetLocation()); 108return reference.GetSyntax(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (1)
27return declarations.Any(static (r, arg) => arg.self.CanAddTo(r.GetSyntax(arg.cancellationToken), arg.solution, arg.cancellationToken), (self: this, solution, cancellationToken));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
184? attribute.ApplicationSyntaxReference.GetSyntax() as T
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
SymbolKeyTests.cs (1)
1555var node = declaringLocation.GetSyntax();
Microsoft.DotNet.CodeAnalysis (1)
Analyzers\PinvokeAnalyzer.cs (1)
163context.ReportDiagnostic(Diagnostic.Create(InvalidPinvokeCall, synref.GetSyntax().GetLocation(), data.ModuleName + "!" + (data.EntryPointName ?? methodSymbol.Name), altMsg));
Microsoft.Extensions.Logging.Generators (2)
LoggerMessageGenerator.Parser.cs (2)
342ParameterSyntax paramSyntax = paramSymbol.DeclaringSyntaxReferences[0].GetSyntax(_cancellationToken) as ParameterSyntax; 688.Any(ds => ds.GetSyntax() is ClassDeclarationSyntax));
Microsoft.Extensions.Options.SourceGeneration (2)
Parser.cs (1)
353var attrLoc = attribute.ApplicationSyntaxReference?.GetSyntax().GetLocation();
ParserUtilities.cs (1)
37x.GetSyntax(token) is PropertyDeclarationSyntax syntax &&
Microsoft.Gen.Logging (8)
Parsing\Parser.cs (2)
523var paramSyntax = paramSymbol.DeclaringSyntaxReferences[0].GetSyntax(_cancellationToken) as ParameterSyntax; 710.Any(ds => ds.GetSyntax() is ClassDeclarationSyntax));
Parsing\Parser.LogProperties.cs (3)
75var syntax = property.DeclaringSyntaxReferences[0].GetSyntax(token); 255Diag(DiagDescriptors.InvalidAttributeUsage, logPropertiesAttribute.ApplicationSyntaxReference?.GetSyntax(_cancellationToken).GetLocation(), "LogProperties"); 295Diag(DiagDescriptors.InvalidAttributeUsage, tagProviderAttribute.ApplicationSyntaxReference?.GetSyntax(_cancellationToken).GetLocation(), "TagProvider");
Parsing\Parser.TagProvider.cs (2)
35tagProviderAttribute.ApplicationSyntaxReference!.GetSyntax(_cancellationToken).GetLocation()); 63tagProviderAttribute.ApplicationSyntaxReference!.GetSyntax(_cancellationToken).GetLocation());
src\Generators\Shared\ParserUtilities.cs (1)
42x.GetSyntax(token) is PropertyDeclarationSyntax syntax &&
Microsoft.Gen.Logging.Unit.Tests (3)
ParserUtilitiesTests.cs (3)
41syntaxReferenceMock.Setup(x => x.GetSyntax(It.IsAny<CancellationToken>())) 45anotherSyntaxReferenceMock.Setup(x => x.GetSyntax(It.IsAny<CancellationToken>())) 66syntaxReferenceMock.Setup(x => x.GetSyntax(It.IsAny<CancellationToken>()))
Microsoft.Gen.Metrics (2)
Parser.cs (1)
324attribute.ApplicationSyntaxReference.GetSyntax(_cancellationToken) is AttributeSyntax syntax &&
src\Generators\Shared\ParserUtilities.cs (1)
42x.GetSyntax(token) is PropertyDeclarationSyntax syntax &&
Microsoft.Gen.MetricsReports (2)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (1)
324attribute.ApplicationSyntaxReference.GetSyntax(_cancellationToken) is AttributeSyntax syntax &&
src\Generators\Shared\ParserUtilities.cs (1)
42x.GetSyntax(token) is PropertyDeclarationSyntax syntax &&
Microsoft.Interop.ComInterfaceGenerator (2)
Analyzers\ConvertComImportToGeneratedComInterfaceAnalyzer.cs (1)
75GeneratorDiagnosticsBag diagnostics = new(new DiagnosticDescriptorProvider(), new MethodSignatureDiagnosticLocations((MethodDeclarationSyntax)method.DeclaringSyntaxReferences[0].GetSyntax()), SR.ResourceManager, typeof(FxResources.Microsoft.Interop.ComInterfaceGenerator.SR));
ComMethodInfo.cs (1)
126var declaringSyntax = declaringSyntaxReference.GetSyntax(ct);
Microsoft.Interop.LibraryImportGenerator (1)
Analyzers\ConvertToLibraryImportAnalyzer.cs (1)
141GeneratorDiagnosticsBag diagnostics = new(new DiagnosticDescriptorProvider(), new MethodSignatureDiagnosticLocations((MethodDeclarationSyntax)method.DeclaringSyntaxReferences[0].GetSyntax()), SR.ResourceManager, typeof(FxResources.Microsoft.Interop.LibraryImportGenerator.SR));
Microsoft.Interop.SourceGeneration (1)
TypePositionInfo.cs (1)
99IsExplicitThis = ((ParameterSyntax)paramSymbol.DeclaringSyntaxReferences[0].GetSyntax()).Modifiers.Any(SyntaxKind.ThisKeyword)
Microsoft.ML.InternalCodeAnalyzer (2)
BestFriendOnPublicDeclarationsAnalyzer.cs (1)
66var diagnostic = Diagnostic.Create(Rule, attribute.ApplicationSyntaxReference.GetSyntax().GetLocation(), context.Symbol.Name);
InstanceInitializerAnalyzer.cs (1)
71var syntax = syntaxRefs[0].GetSyntax();
Microsoft.VisualStudio.LanguageServices (2)
Venus\ContainedLanguageCodeSupport.cs (2)
66var typeNode = type.DeclaringSyntaxReferences.Where(r => r.SyntaxTree == tree).Select(r => r.GetSyntax(cancellationToken)).First(); 270var memberNode = member.DeclaringSyntaxReferences.Select(r => r.GetSyntax(cancellationToken)).FirstOrDefault();
Microsoft.VisualStudio.LanguageServices.VisualBasic (1)
CodeModel\VisualBasicCodeModelService_Prototype.vb (1)
194Dim parameterNode = TryCast(parameter.DeclaringSyntaxReferences(0).GetSyntax(), ParameterSyntax)
System.Private.CoreLib.Generators (1)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (1)
290var propertyDefiningSyntax = symbolInfo.Symbol.DeclaringSyntaxReferences[0].GetSyntax();