3093 references to GetRoot
IdeCoreBenchmarks (4)
SyntacticChangeRangeBenchmark.cs (4)
56var newRoot = newTree.GetRoot(); 65var newRoot = newTree.GetRoot(); 74var newRoot = newTree.GetRoot(); 83var newRoot = newTree.GetRoot();
Microsoft.Analyzers.Extra (1)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (1)
269var allNodes = comp.SyntaxTrees.SelectMany(s => s.GetRoot().DescendantNodes());
Microsoft.Analyzers.Extra.Tests (4)
SyntaxNodeExtensionsTests.cs (4)
54var methodInvocSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().FirstOrDefault(); 86var methodInvocSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().FirstOrDefault(); 149var methodInvocSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().FirstOrDefault(); 179var methodInvocSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().FirstOrDefault();
Microsoft.AspNetCore.App.Analyzers (1)
RouteEmbeddedLanguage\RoutePatternAnalyzer.cs (1)
33var root = syntaxTree.GetRoot(cancellationToken);
Microsoft.AspNetCore.Http.Extensions.Tests (1)
RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
141var syntaxRootNode = (CSharpSyntaxNode)syntaxTree.GetRoot();
Microsoft.AspNetCore.Http.Microbenchmarks (1)
src\Http\Http.Extensions\test\RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
141var syntaxRootNode = (CSharpSyntaxNode)syntaxTree.GetRoot();
Microsoft.AspNetCore.Http.RequestDelegateGenerator (1)
RequestDelegateGeneratorSuppressor.cs (1)
50|| sourceTree.GetRoot().FindNode(location.SourceSpan) is not InvocationExpressionSyntax node
Microsoft.CodeAnalysis (18)
Compilation\Compilation.cs (1)
2491diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_EncodinglessSyntaxTree, tree.GetRoot().GetLocation()));
DiagnosticAnalyzer\AnalyzerDriver.cs (2)
1267for (var node = location.SourceTree.GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: true); 1320var root = tree.GetRoot(cancellationToken);
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (1)
166for (var node = location.SourceTree.GetRoot().FindNode(location.SourceSpan, getInnermostNodeForTie: true);
SourceGeneration\GeneratedCodeUtilities.cs (1)
120var root = tree.GetRoot(cancellationToken);
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithSimpleName.cs (2)
72.Select((info, cancellationToken) => getGlobalAliasesInCompilationUnit(syntaxHelper, info.Tree.GetRoot(cancellationToken))) 159var compilationUnit = syntaxTree.GetRoot(cancellationToken);
SourceGeneration\SyntaxStore.cs (1)
89var root = new Lazy<SyntaxNode>(() => tree.GetRoot(_cancellationToken));
Syntax\ICompilationUnitSyntax.cs (1)
11/// any node returned by <see cref="SyntaxTree.GetRoot"/> where <see cref="SyntaxTree.HasCompilationUnitRoot"/>
Syntax\LineDirectiveMap.cs (1)
39var syntaxRoot = (SyntaxNodeOrToken)syntaxTree.GetRoot();
Syntax\SyntaxDiffer.cs (4)
53return GetTextChanges(before.GetRoot(), after.GetRoot()); 89return GetPossiblyDifferentTextSpans(before.GetRoot(), after.GetRoot());
Syntax\SyntaxNode.cs (1)
974SyntaxNode? cuRoot = node.SyntaxTree?.GetRoot();
Syntax\SyntaxNodeExtensions.cs (1)
436return node != null ? oldTree.WithRootAndOptions(node, oldTree.Options).GetRoot() : null;
Syntax\SyntaxTree.cs (1)
429var root = this.GetRoot(cancellationToken);
Syntax\SyntaxTreeExtensions.cs (1)
22var root = tree.GetRoot();
Microsoft.CodeAnalysis.CodeStyle (24)
src\Analyzers\Core\Analyzers\AddAccessibilityModifiers\AbstractAddAccessibilityModifiersDiagnosticAnalyzer.cs (1)
43ProcessCompilationUnit(context, option, (TCompilationUnitSyntax)context.Tree.GetRoot(context.CancellationToken));
src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderDiagnosticAnalyzer.cs (1)
48var root = tree.GetRoot(context.CancellationToken);
src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (1)
50var root = tree.GetRoot(cancellationToken);
src\Analyzers\Core\Analyzers\MatchFolderAndNamespace\AbstractMatchFolderAndNamespaceDiagnosticAnalyzer.cs (1)
95var root = namespaceDeclaration.SyntaxTree.GetRoot(cancellationToken);
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
127var root = tree.GetRoot(cancellationToken);
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (1)
126var root = firstBlock.Syntax.SyntaxTree.GetRoot(context.CancellationToken);
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
120var root = tree.GetRoot(cancellationToken);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
22var root = tree.GetRoot();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (4)
20=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 23=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 26=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 29=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
95? ((ICompilationUnitSyntax)token.Parent!.SyntaxTree!.GetRoot(CancellationToken.None)).EndOfFileToken
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (6)
122var root = syntaxTree.GetRoot(cancellationToken); 133var root = syntaxTree.GetRoot(cancellationToken); 170var root = syntaxTree.GetRoot(cancellationToken); 208return syntaxTree.GetRoot(cancellationToken).FindTokenOnRightOfPosition( 223return syntaxTree.GetRoot(cancellationToken).FindTokenOnLeftOfPosition( 251var root = syntaxTree.GetRoot(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (3)
51var operation = GetIndentationDataFor(tree.GetRoot(cancellationToken), token, position); 102tree.GetRoot(cancellationToken), 167baseToken = baseToken.SyntaxTree.GetRoot(cancellationToken).FindToken(textLine.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
55Root = (TSyntaxRoot)tree.GetRoot(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SyntaxPath.cs (1)
139return TryResolve(syntaxTree.GetRoot(cancellationToken), out node);
Microsoft.CodeAnalysis.CodeStyle.Fixes (2)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (1)
527var root = attributeToRemove.SyntaxTree.GetRoot();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
53var root = SyntaxTree.WithChangedText(text).GetRoot(cancellationToken);
Microsoft.CodeAnalysis.CSharp (42)
Binder\BinderFactory.BinderFactoryVisitor.cs (3)
109if (compilationUnit != syntaxTree.GetRoot()) 941if (compilationUnit != syntaxTree.GetRoot()) 1073Debug.Assert(token == this.syntaxTree.GetRoot().GetLastToken());
Binder\InMethodBinder.cs (1)
248Debug.Assert(oldLocation != newLocation || oldLocation == Location.None || newLocation.SourceTree?.GetRoot().ContainsDiagnostics == true,
Binder\Semantics\OverloadResolution\OverloadResolution.cs (3)
1333SyntaxNode syntax = CSharpSyntaxTree.Dummy.GetRoot(); 3172_binder.TryGetCollectionIterationType(CSharpSyntaxTree.Dummy.GetRoot(), t1, out elementType1); 3177_binder.TryGetCollectionIterationType(CSharpSyntaxTree.Dummy.GetRoot(), t2, out elementType2);
CommandLine\CSharpCompiler.cs (1)
350foreach (LineDirectiveTriviaSyntax directive in tree.GetRoot().GetDirectives(
Compilation\CSharpCompilation.cs (5)
2658var node = info.Tree.GetRoot(cancellationToken).FindToken(info.Span.Start, findInsideTrivia: false). 3069bool reportUnusedUsings = (!span.HasValue || span.Value == tree.GetRoot(cancellationToken).FullSpan) && ReportUnusedImportsInTree(tree); 3201var root = syntaxTree.GetRoot(cancellationToken); 3646CSharpSyntaxTree.Dummy.GetRoot(), 3783var checksumDirectives = tree.GetRoot().GetDirectives(d => d.Kind() == SyntaxKind.PragmaChecksumDirectiveTrivia &&
Compilation\CSharpSemanticModel.cs (2)
1276bool atEOF = position == fullEnd && position == this.SyntaxTree.GetRoot().FullSpan.End; 1280token = (atEOF ? (CSharpSyntaxNode)this.SyntaxTree.GetRoot() : Root).FindTokenIncludingCrefAndNameAttributes(position);
Compilation\SpeculativeSemanticModelWithMemberModel.cs (1)
59var attributedNode = model.SyntaxTree.GetRoot().FindToken(position).Parent;
Compilation\SyntaxTreeSemanticModel.cs (1)
79return (CSharpSyntaxNode)_syntaxTree.GetRoot();
Compiler\UnprocessedDocumentationCommentFinder.cs (1)
34finder.Visit(tree.GetRoot(cancellationToken));
CSharpExtensions.cs (1)
397return (CompilationUnitSyntax)tree.GetRoot(cancellationToken);
Declarations\DeclarationTreeBuilder.cs (1)
96return (RootSingleNamespaceDeclaration)builder.Visit(syntaxTree.GetRoot());
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
29ComputeDeclarations(model, associatedSymbol: null, model.SyntaxTree.GetRoot(cancellationToken),
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (2)
193var token = semanticModel.SyntaxTree.GetRoot().FindToken(position); 247var token = location.SourceTree.GetRoot().FindToken(PositionOpt);
Symbols\MethodSymbolExtensions.cs (1)
213return (CSharpSyntaxNode)CSharpSyntaxTree.Dummy.GetRoot();
Symbols\RangeVariableSymbol.cs (1)
62SyntaxToken token = _location.SourceTree.GetRoot().FindToken(_location.SourceSpan.Start);
Symbols\ReducedExtensionMethodSymbol.cs (1)
140var syntax = (CSharpSyntaxNode)syntaxTree.GetRoot();
Symbols\Source\SourceAssemblySymbol.cs (1)
1559var root = (CompilationUnitSyntax)tree.GetRoot();
Symbols\Source\SourceMethodSymbolWithAttributes.cs (3)
1070var root = matchingTree.GetRoot(); 1291var root = matchingTree.GetRoot(); 1384if (ReferenceEquals(returnTypeSyntax, CSharpSyntaxTree.Dummy.GetRoot()))
Symbols\Symbol.cs (2)
513SyntaxToken token = location.SourceTree.GetRoot().FindToken(location.SourceSpan.Start); 529SyntaxNode parent = location.SourceTree.GetRoot();
Symbols\SymbolExtensions.cs (1)
380return (CSharpSyntaxNode)CSharpSyntaxTree.Dummy.GetRoot();
Symbols\Synthesized\SynthesizedEntryPointSymbol.cs (1)
288return (CSharpSyntaxNode)syntaxTree.GetRoot();
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (1)
266foreach (var global in ((CompilationUnitSyntax)tree.GetRoot(cancellationToken)).Members.OfType<GlobalStatementSyntax>())
Syntax\CSharpPragmaWarningStateMap.cs (1)
60foreach (var d in syntaxTree.GetRoot().GetDirectives())
Syntax\CSharpSyntaxTree.LazySyntaxTree.cs (1)
71var root = CloneNodeAsRoot((CSharpSyntaxNode)tree.GetRoot(cancellationToken));
Syntax\NullableContextStateMap.cs (1)
141foreach (var d in tree.GetRoot().GetDirectives())
Syntax\SyntaxEquivalence.cs (2)
31return AreEquivalent(before.GetRoot(), after.GetRoot(), ignoreChildNode, topLevel);
Syntax\SyntaxFactory.cs (1)
2331var compilation = (CompilationUnitSyntax)tree.GetRoot();
Syntax\SyntaxTreeDiagnosticEnumerator.cs (1)
62var length = _syntaxTree.GetRoot().FullSpan.Length;
Microsoft.CodeAnalysis.CSharp.CodeStyle (16)
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
38var root = (CompilationUnitSyntax)syntaxTree.GetRoot(cancellationToken);
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
189outermostBody = syntaxTree.GetRoot(cancellationToken);
src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
59var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (1)
165? location.SyntaxTree.GetRoot(cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
37directive.FullSpan.End == syntaxTree.GetRoot(cancellationToken).FullSpan.End;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (5)
178var root = (CompilationUnitSyntax)syntaxTree.GetRoot(cancellationToken); 222var trivia = syntaxTree.GetRoot(cancellationToken).FindTrivia(position); 391var token = syntaxTree.GetRoot(cancellationToken).FindToken(position, findInsideTrivia: true); 440var root = (CompilationUnitSyntax)syntaxTree.GetRoot(cancellationToken); 492var trivia = syntaxTree.GetRoot(cancellationToken).FindTrivia(position, findInsideTrivia: false);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (1)
162return syntaxTree.GetRoot(cancellationToken).FindTrivia(span.Start - 1, findInsideTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
331? ((CompilationUnitSyntax)structure.SyntaxTree.GetRoot(CancellationToken.None)).EndOfFileToken
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Helpers\RemoveUnnecessaryImports\CSharpUnnecessaryImportsProvider.cs (1)
28var root = model.SyntaxTree.GetRoot(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
1108var trivia = syntaxTree.GetRoot(cancellationToken).FindTrivia(position, findInsideTrivia: false);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (2)
191var root = tree.GetRoot(cancellationToken); 204var newDeclarationTypeNode = newTree.GetRoot(cancellationToken).GetAnnotatedNodes(annotation).Single();
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (6)
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
47var root = diagnostic.Location.SourceTree.GetRoot(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (2)
85return (TypeDeclarationSyntax)tree.GetRoot(cancellationToken); 206return contextTree?.GetRoot(cancellationToken).FindToken(contextLocation!.SourceSpan.Start).Parent;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (1)
33var root = (CompilationUnitSyntax)contextNode.SyntaxTree.GetRoot(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (2)
430if (syntaxTree.GetRoot(cancellationToken) is CompilationUnitSyntax compilationUnit && 1987if (syntaxTree.GetRoot(cancellationToken) is CompilationUnitSyntax compilationUnit &&
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
EventHookup\EventHookupSessionManager_EventHookupSession.cs (1)
271semanticModel.SyntaxTree.GetRoot(),
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (9)
CodeActions\PreviewTests.cs (1)
84solution = solution.WithDocumentSyntaxRoot(_oldDocument.Id, CSharpSyntaxTree.ParseText(ChangedDocumentText, cancellationToken: cancellationToken).GetRoot(cancellationToken));
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (1)
236=> context.ReportDiagnostic(Diagnostic.Create(s_syntaxDiagnosticDescriptor, context.Tree.GetRoot().GetFirstToken().GetLocation()));
Formatting\FormattingEngineTests.cs (2)
2221var root = tree.GetRoot(); 2539var root = syntaxTree.GetRoot();
SymbolKey\SymbolKeyTestBase.cs (1)
252var usingNodes = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>();
Utilities\CSharpServiceTestExtensions.cs (2)
46return syntaxTree.GetRoot().DigToFirstNodeOfType<T>(); 50=> (syntaxTree.GetRoot() as CompilationUnitSyntax).Members.OfType<TypeDeclarationSyntax>().First();
Workspaces\WorkspaceTests_EditorFeatures.cs (2)
251var root = (CompilationUnitSyntax)tree.GetRoot(); 708Assert.True(syntaxTree.GetRoot().Width() > 0, "syntaxTree.GetRoot().Width should be > 0");
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (182)
CodeGen\CodeGenAsyncMethodBuilderOverrideTests.cs (2)
895var lambdas = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToArray(); 947var lambdas = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToArray();
CodeGen\CodeGenAwaitForeachTests.cs (31)
936var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1661var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1721var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1865var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1902var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1942var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1979var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 2013var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 2969var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3034var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3119var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3237var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3292var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3350var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3546var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3594var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3715var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 4239var loop = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 4462var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 4536var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 4646var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single(); 4745var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single(); 5049var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 5130var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 5356var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 6439var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9107var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9183var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9261var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9322var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9393var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single();
CodeGen\CodeGenCheckedTests.cs (3)
2915var xNode = tree.GetRoot().DescendantNodes().OfType<CheckedExpressionSyntax>().Single().Expression; 2922var checkedNode = tree.GetRoot().DescendantNodes().OfType<CheckedExpressionSyntax>().Single(); 2947var xNode = tree.GetRoot().DescendantNodes().OfType<CheckedExpressionSyntax>().Single().Expression;
CodeGen\CodeGenDeconstructTests.cs (40)
96var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 101var right = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 1111var deconstruction = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 1128var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 2688var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3130var lhs = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().First(); 3135var lhsNested = tree.GetRoot().DescendantNodes().OfType<ParenthesizedVariableDesignationSyntax>().ElementAt(1); 3178var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3184var x234 = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(1); 3189var x34 = tree.GetRoot().DescendantNodes().OfType<ParenthesizedVariableDesignationSyntax>().ElementAt(1); 3242var x123 = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3248var x23 = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 3280var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3286var lhsNested = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(1); 3330var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3336var lhsNested = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(2); 3443var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3447var literal = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 3479var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3483var literal = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 3635return tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == name).Single(); 3640return tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>(); 3645return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ContextualKind() == SyntaxKind.UnderscoreToken); 3662return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == name); 4042var deconstructionForeach = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single(); 4405var collection = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single().Expression; 5472var firstX1 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "x1").Single(); 5504var firstY = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == "y").First(); 5509var secondY = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == "y").ElementAt(1); 5535var firstX = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == "x").First(); 5540var secondX = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == "x").ElementAt(1); 6408var yz = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(2); 6413var y = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(1); 7067var discard = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(); 7238var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 7520var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(2); 8358var node = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single(); 8585var node = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single(); 8629var node = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ElementAt(1); 9010var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First();
CodeGen\CodeGenForEachTests.cs (1)
1758var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
CodeGen\CodeGenFunctionPointersTests.cs (20)
3062var addressOfs = syntaxTree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().ToArray(); 3114var addressOf = syntaxTree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 3339var declarators = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Initializer!.Value.IsKind(SyntaxKind.AddressOfExpression)).ToArray(); 3410var declarator = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 3457var declarator = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 3568var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 3620var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 3671var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 3710var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 4115var variableDeclaratorSyntax = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 4918syntaxTree.GetRoot() 7415var lambda = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 7517var functionPointerSyntaxes = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().ToArray(); 7573var functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 7593functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 7642var functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 7662functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 7729var functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 7747functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 10804var lambdas = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToArray();
CodeGen\CodeGenInterpolatedString.cs (2)
37var interpolatedStrings = tree.GetRoot().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray(); 46foreach (var token in tree.GetRoot().DescendantTokens().Where(t => t.Kind() != SyntaxKind.EndOfFileToken))
CodeGen\CodeGenLocalFunctionTests.cs (5)
146var localFunction = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 5749.GetDeclaredSymbol(syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single()) 5824.GetDeclaredSymbol(syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single()) 5897var localFunctions = syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToList(); 6162var localFunctionSyntax = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
CodeGen\CodeGenOperators.cs (3)
5409ControlFlowGraph.Create((IMethodBodyOperation)model.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Calculate").Single())); 5699ControlFlowGraph.Create((IMethodBodyOperation)model.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Calculate").Single())); 5735ControlFlowGraph.Create((IMethodBodyOperation)model.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Calculate").Single()));
CodeGen\CodeGenRefLocalTests.cs (6)
4033var xDecl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 4036var refVar = tree.GetRoot().DescendantNodes().OfType<RefTypeSyntax>().Single(); 4070var xDecl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 4073var refVar = tree.GetRoot().DescendantNodes().OfType<RefTypeSyntax>().Single(); 4104var xDecl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 4107var refInt = tree.GetRoot().DescendantNodes().OfType<RefTypeSyntax>().Single();
CodeGen\CodeGenTupleEqualityTests.cs (1)
4276var comparison = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Last();
CodeGen\CodeGenTupleTest.cs (60)
4024var result = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "result").Single(); 4839var invocation1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(0); 4844var invocation2 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(2); 5075var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(0); 5119var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(0); 5160var memberAccess = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ElementAt(0); 5164var memberAccess2 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ElementAt(1); 5168var memberAccess3 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ElementAt(2); 5204var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(0); 7497var declaration = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 7530var declaration = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 7568var tuples = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>(); 7631var tuples = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>(); 9854var names = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 9905var names = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 9947var names = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 9993var names = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 10059var t1 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 10098var t1 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(2); 10101var t2 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 10132var names = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 12693var node = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 13974var nameofNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "nameof").Single(); 13981var typeofNodes = tree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().ToArray(); 14245var m1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M1").Single(); 14261var m2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M2").Single(); 14275var f1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "F1").First(); 14289var p1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "P1").First(); 14306var m3 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M3").Single(); 14324var m4 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M4").Single(); 14331var m5 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M5").Single(); 14338var m6 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M6").Single(); 14433var e1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "E1").Single(); 14447var m5 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M5").Single(); 14454var v1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "v1").Single(); 14464var v2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "v2").Single(); 24180var nodes = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "elem2").ToArray(); 24196var type = tree.GetRoot().DescendantNodes().OfType<TupleTypeSyntax>().Single(); 24259var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24269var xSymbol = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single()); 24322var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24332var xSymbol = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single()); 24386var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24396var collection = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 24459var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24469var collection = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 24532var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24542var collection = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 24606var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24616var collection = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 25024var x = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 25053var y = tree.GetRoot().DescendantNodes().OfType<TupleTypeSyntax>().ElementAt(0); 25058var z = tree.GetRoot().DescendantNodes().OfType<TupleTypeSyntax>().ElementAt(1); 25084var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 25703var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 25774var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 25839var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 25881var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 25911var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 27567var literal = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single();
CodeGen\ForeachTest.cs (1)
1687var decl = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
CodeGen\IndexAndRangeTests.cs (2)
31var root = syntaxTree.GetRoot(); 3857var receivers = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Select(e => e.Expression).ToArray();
CodeGen\ObjectAndCollectionInitializerTests.cs (2)
1107var node = tree.GetRoot().DescendantNodes().OfType<Syntax.ObjectCreationExpressionSyntax>().Last(); 3589var node = tree.GetRoot().DescendantNodes().OfType<Syntax.ObjectCreationExpressionSyntax>().Single();
CodeGen\PatternTests.cs (3)
5004var switchExpressions = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().ToArray(); 5130var attributeArguments = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().ToArray(); 5279var attributeArguments = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().ToArray();
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (28)
CodeGen\IndexAndRangeTests.cs (18)
91var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Skip(2).First(); 332var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 419var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 506var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 624var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 1573var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 1808var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 2263var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 2678var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 2841var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3019var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3133var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3304var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3455var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3641var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3731var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3817var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3890var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last();
Emit\NumericIntPtrTests.cs (10)
699var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString()); 1917var nodes = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>(); 1969var nodes = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>(); 6009var expr = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 6245var expr = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 6621var expr = tree.GetRoot().DescendantNodes().Single(n => n.Kind() == kind); 6853var expr = tree.GetRoot().DescendantNodes().Single(n => n.Kind() == kind); 8126var expr = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 10547var returnStatements = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().ToArray(); 10686var methods = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray();
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (614)
Attributes\AttributeTests.cs (10)
87var nodes = Parse(aliases).GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>(); 706var root = tree.GetRoot(); 747var root = tree.GetRoot(); 811var root = tree.GetRoot(); 853var root = tree.GetRoot(); 894var root = tree.GetRoot(); 933var root = tree.GetRoot(); 11637var firstArgument = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().First(); 11641var secondArgument = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Skip(1).First(); 11645var thirdArgument = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Skip(2).Single();
Attributes\AttributeTests_RefReadOnly.cs (4)
1379var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User"); 1421var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User"); 1450var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User"); 1477var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User");
Attributes\AttributeTests_WellKnownAttributes.cs (7)
5768var localFunctionSyntax = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 9550var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 9599var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 9655var syntax = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Last(n => n.Identifier.ValueText == "OnBehaviorAttached"); 11398var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 11423var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 11454var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
Diagnostics\DiagnosticAnalyzerTests.cs (4)
3682var field1 = tree1.GetRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Single().Declaration.Variables.Single().Identifier; 3749var localDecl1 = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 4151var root = tree.GetRoot(); 4310var localDeclaration = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First();
Diagnostics\GetDiagnosticsTests.cs (7)
173model.GetDiagnostics(tree1.GetRoot().FullSpan); 222model.GetDiagnostics(tree1.GetRoot().FullSpan); 274model.GetDiagnostics(tree1.GetRoot().FullSpan); 324model.GetDiagnostics(tree.GetRoot().FullSpan); 782var localDecl = syntaxTree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 1061var localDecl = syntaxTree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 1549var localDecl = tree1.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First();
FieldKeywordTests.cs (3)
1275var attributeArguments = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Select(arg => arg.Expression).ToArray(); 1333var attributeArguments = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Select(arg => arg.Expression).ToArray(); 9474return tree.GetRoot().DescendantNodes().OfType<PropertyDeclarationSyntax>().
FirstClassSpanTests.cs (4)
2731var arg = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 2764var casts = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToImmutableArray(); 4908var aVariable = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 4911var d1Access = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>()
FlowAnalysis\FlowTests.cs (1)
5841var declarations = tree.GetRoot().DescendantNodes().OfType<PropertyDeclarationSyntax>().ToImmutableArray();
FlowAnalysis\RegionAnalysisTests.cs (8)
5535var root = tree.GetRoot(); 5579var root = tree.GetRoot(); 5622var root = tree.GetRoot(); 6481var root = tree.GetRoot(); 8099var expr = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 8127var expr = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 14121var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 14144var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
OverloadResolutionPriorityTests.cs (8)
443var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 699var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 759var accesses = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToArray(); 807var creation = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 978var secondCtor = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Skip(ctorToForce).First(); 2220var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 2318var invocation = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 2490var symbols = tree.GetRoot().DescendantNodes()
RefReadonlyParameterTests.cs (1)
1525var local = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
RefStructInterfacesTests.cs (114)
6628var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 6765var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 6881var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 7013var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 7142var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 7472var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 7575var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 7662var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 7765var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 7881var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 7984var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().First(); 8075var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 8175var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 8268var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 8368var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 8441var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 8443var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 8547var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 8647var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 8931var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 9018var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9135var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 9222var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9331var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 9386var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9499var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 9586var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9714var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 9810var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9935var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 10019var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10150var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 10246var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10347var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 10349var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10442var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 10444var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10542var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 10629var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10739var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 10826var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10979var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 11066var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().First(); 11198var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 11294var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 11422var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 11506var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 11606var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 11701var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 12148var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 12416var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 12661var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 12924var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 13191var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 13453var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 14151var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 14258var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 14492var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 14599var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 14854var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 14965var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().First(); 15205var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 15309var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 15553var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 15657var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 15732var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 15734var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 15987var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 16095var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 16758var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 16760var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 16823var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 16825var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 16888var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 16890var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 16972var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 16974var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17060var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17062var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17153var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17155var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17250var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17252var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17334var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17336var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17655var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17762var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17852var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17959var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 18075var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 18182var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().First(); 18275var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 18379var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 18476var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 18580var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 18652var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 18654var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 18760var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 18864var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19128var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 19199var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19299var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 19370var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19472var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 19527var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19624var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 19695var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19863var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19966var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 19968var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 21238var lambda = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 21244var localFunctions = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray(); 21305var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 21707var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().ToArray();
Semantics\CollectionExpressionTests.cs (51)
201var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 236var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 4809var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 7573var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8296var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8367var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8451var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8536var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 14300var returnValue = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Last().Expression; 14376var returnValue = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Last().Expression; 14449var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 14512var cast = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Last().Expression; 14517var value = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Last().Expression; 14636var cast = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Last().Expression; 14641var value = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Last().Expression; 14719var nestedCollection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Last(); 14808var nestedCollection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Last(); 15146var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 26086var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26212var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26326var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26384var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26455var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26537var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26603var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26664var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26734var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26909var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26974var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "CreateCollection"); 27030var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 28693var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 28737var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 28783var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 28827var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 28870var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 28913var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 28952var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Last(); 28985var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 29019var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 29072var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 29138var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 29199var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 29275var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 29318var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 29365var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Last(); 32387var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 32482var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 32524var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 32569var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 33548var collectionExpression = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().First(); 33589var collectionExpression = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().First();
Semantics\InlineArrayTests.cs (16)
2359var c = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "c").Single(); 2394var c = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "c").Single(); 2428var c = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "c").Single(); 2508var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").First(); 6033var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").First(); 6199var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").Last(); 8118var f = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Last().Left; 8835var m3 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "M3").Single().Parent; 9203var m3 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "M3").Single(); 10547var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").Last(); 11291var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").Last(); 15208var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").ToArray(); 16495var m3 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "M3").First().Parent; 18583var f = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single().Expression; 18909var f = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single().Expression; 19246var collection = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single().Expression;
Semantics\OutVarTests.cs (75)
178Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 386Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 423Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 461Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 499Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 537Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 575Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 622Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 659Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 697Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 737Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 776Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 816Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 833return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == name); 838return tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>() 854return tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>() 860return tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>(); 865return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ContextualKind() == SyntaxKind.UnderscoreToken); 870return tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>() 5313var node = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First(); 5583var node = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 9702var d = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(id => id.Identifier.ValueText == "d").Single(); 10269var d = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(id => id.Identifier.ValueText == "d").Single(); 11077var node = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First(); 11335var node = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 17749var x2Decl = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 18444var initializer = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 20658Assert.Equal(1, compilation.SyntaxTrees[0].GetRoot().DescendantNodesAndSelf().OfType<DeclarationExpressionSyntax>().Count()); 21367var e = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(id => id.Identifier.ValueText == "e").Single(); 32184var b = (IFieldSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "b").Single()); 32224var b = (IFieldSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "b").Single()); 32264var a = (IFieldSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "a").Single()); 32337var bDecl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "b").Single(); 32435var x1Decl = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>() 32473var x1Decl = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>() 33458var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "x").Single(); 33646var z1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "z1").First(); 35131var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35170var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35214var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35245var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35284var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35316var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35352var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35391var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35421var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35458var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35649var foreachStatement = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 35804var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 35850var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 35934var initializerSyntax = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 35953var blockBodySyntax = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().First(); 35978var expressionBodySyntax = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().First(); 36001var declarationSyntax = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 36074var expressionBodySyntax = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().First(); 36098var blockBodySyntax = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().First(); 36122var propertyExpressionBodySyntax = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().ElementAt(1); 36127var declarationSyntax = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 36182var node3 = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().First(); 36275var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test3").Last(); 36315var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36318var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 36361var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36364var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Skip(1).First(); 36368Assert.Same(symbolInfo.Symbol, speculativeModel.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Where(l => l.Identifier.ValueText == "M2").Single())); 36401var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36404var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 36443var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36446var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 36450Assert.Same(symbolInfo.Symbol, speculativeModel.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Where(l => l.Identifier.ValueText == "M2").Single())); 36478var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36481var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 36516var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36519var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 36523Assert.Same(symbolInfo.Symbol, speculativeModel.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Where(l => l.Identifier.ValueText == "M2").Single()));
Semantics\ParamsCollectionTests.cs (22)
119var nodes = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Take(3).ToArray(); 218var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 334var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 517var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 662var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 1406var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 2530var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 2666var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 2757var parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single()); 2791parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single()); 2955var parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single()); 2986parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single()); 3596var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 3886var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 4340var parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().First()); 4346parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Skip(1).First()); 5893var f1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "F1").Single(); 5895var f2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "F2").Single(); 5975var f1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "F1").Single(); 5977var f2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "F2").Single(); 9072var parameterDecl = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.Identifier.ValueText == "paramsParameter").Single(); 12533var node = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
Semantics\PatternMatchingTestBase.cs (6)
37return tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Parent.Kind() == SyntaxKind.DeclarationPattern || p.Parent.Kind() == SyntaxKind.VarPattern); 47return tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 52return tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>(); 62return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == name); 419Assert.Empty(tree.GetRoot().DescendantNodes().OfType<GlobalStatementSyntax>()); 450var node = tree.GetRoot().DescendantNodes().OfType<T>().ElementAt(index);
Semantics\PatternMatchingTests.cs (37)
849var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).Single(); 1432var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 1433var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 1482var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 1483var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 1591var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 1592var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 1656var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 1657var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 1662var x2Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x2").ToArray(); 1663var x2Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x2").ToArray(); 1668var x3Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x3").ToArray(); 1669var x3Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x3").ToArray(); 1739var x2Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x2").ToArray(); 1740var x2Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x2").ToArray(); 1745var x3Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x3").ToArray(); 1746var x3Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x3").ToArray(); 2702var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 2703var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 2747var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 2748var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 2791var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 2792var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 2843var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 2844var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 3040var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 3041var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 3087var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 3088var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 3265foreach (var isExpression in tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>()) 3445var declaration = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 3577var node = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().First(); 6573var caseDefault = tree.GetRoot().DescendantNodes().OfType<CasePatternSwitchLabelSyntax>().First(); 11365var exprs = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 11389var locals = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 11410var syntax = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().Single(); 11467var syntax = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().Single();
Semantics\PatternMatchingTests_ListPatterns.cs (11)
3319var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray(); 3324var localDeclarations = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 3618var nodes = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>(); 3675var nodes = tree.GetRoot().DescendantNodes() 3720var designations = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 4085var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray(); 4172var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray(); 4249var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray(); 4363var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray(); 4405var nodes = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>(); 4556var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray();
Semantics\PatternMatchingTests_Scope.cs (73)
678var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 679var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single(); 713tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "SpeculateHere").Single().SpanStart, 719var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 720var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 947var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 948var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single(); 982tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "SpeculateHere").Single().SpanStart, 988var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 989var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 2222var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).ToArray(); 2358var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).ToArray(); 2421var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).ToArray(); 2486var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).Single(); 2556var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).Single(); 2712var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).ToArray(); 6525var d = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(id => id.Identifier.ValueText == "d").Single(); 6590var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 6591var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single(); 6594var x4Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x4").Single(); 6595var x4Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x4").ToArray(); 6601var x6Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x6").Single(); 6602var x6Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x6").Single(); 6605var x8Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x8").Single(); 6606var x8Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x8").ToArray(); 6610var x14Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x14").ToArray(); 6611var x14Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x14").Single(); 6679var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 6680var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single(); 6683var x4Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x4").Single(); 6684var x4Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x4").ToArray(); 6690var x6Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x6").Single(); 6691var x6Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x6").Single(); 6694var x8Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x8").Single(); 6695var x8Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x8").ToArray(); 6699var x14Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x14").ToArray(); 6700var x14Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x14").Single(); 6838var x2Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x2").ToArray(); 6839var x2Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x2").ToArray(); 6845var x3Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x3").Single(); 6846var x3Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x3").ToArray(); 6850var x4Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x4").Single(); 6851var x4Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x4").ToArray(); 6884bool success = model.TryGetSpeculativeSemanticModel(tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "SpeculateHere").Single().SpanStart, statement, out model); 6930var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 6931var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 6936var d = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(id => id.Identifier.ValueText == "d").Single(); 10589var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 10590var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 10597var x2Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x2").Single(); 10598var x2Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x2").Single(); 10601var x3Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x3").Single(); 10602var x3Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x3").Single(); 10605var x4Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x4").Single(); 10606var x4Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x4").ToArray(); 10612var x5Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x5").Single(); 10613var x5Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x5").ToArray(); 10617var x8Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x8").ToArray(); 10618var x8Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x8").ToArray(); 10627var x9Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x9").Single(); 10628var x9Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x9").Single(); 10631var x10Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x10").Single(); 10632var x10Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x10").Single(); 10635var x11Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x11").Single(); 10636var x11Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x11").ToArray(); 10640var x12Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x12").Single(); 10641var x12Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x12").ToArray(); 10685var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 10686var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single(); 10720tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "SpeculateHere").Single().SpanStart, 10726var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 10727var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 12211var e = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(id => id.Identifier.ValueText == "e").Single();
Semantics\PatternMatchingTests2.cs (9)
720foreach (var designation in tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>()) 727foreach (var ident in tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>()) 2020var returnStatement = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single(); 2061var returnStatement = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single(); 2160foreach (var pat in tree.GetRoot().DescendantNodesAndSelf().OfType<PatternSyntax>()) 2251var patterns = tree.GetRoot().DescendantNodesAndSelf().OfType<PatternSyntax>().ToArray(); 2295var patterns = tree.GetRoot().DescendantNodesAndSelf().OfType<PatternSyntax>().ToArray(); 2341var patterns = tree.GetRoot().DescendantNodesAndSelf().OfType<PatternSyntax>().ToArray(); 2881var switches = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().ToArray();
Semantics\PatternMatchingTests3.cs (12)
49var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 109var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 160var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 205var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 256var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 299var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 346var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 1611var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 1889var strDecl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(s => s.Identifier.ValueText == "str").ToArray(); 1893var arrDecl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(s => s.Identifier.ValueText == "arr").ToArray(); 4107var patterns = tree.GetRoot().DescendantNodes().OfType<PatternSyntax>().ToArray(); 4334var patterns = tree.GetRoot().DescendantNodes().OfType<PatternSyntax>().ToArray();
Semantics\PatternMatchingTests4.cs (13)
1010var dpcss = tree.GetRoot().DescendantNodes().OfType<PositionalPatternClauseSyntax>().ToArray(); 4017var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchStatementSyntax>().Single(); 4086var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchStatementSyntax>().Single(); 4159var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchStatementSyntax>().Single(); 4231var @is = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 4275var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4322var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4404var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4486var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4568var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4650var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4734var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4828var x = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().First();
Semantics\PatternMatchingTests5.cs (9)
427var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 564var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 795var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 841var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 895var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 1106var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 1186var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 1237var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 1289var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray();
Semantics\PatternSwitchTests.cs (2)
3252var node = tree.GetRoot().DescendantNodes() 3283var node = tree.GetRoot().DescendantNodes()
Semantics\PrimaryConstructorTests.cs (55)
420var parameters = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().ToArray(); 961var outVarSyntax = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Single(); 1003var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 1072var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 1085var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 1184var equalsValue = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First(); 1194var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 1220var equalsValue = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Last(); 1300var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 1311var y = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").First(); 1324var test = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").First(); 1365var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 1411var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 1422var classDeclarations = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray(); 1467var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 1483var classDeclarations = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray(); 1526var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 1551var classDeclarations = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray(); 1615var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 1640var classDeclarations = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray(); 1814var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 1854var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 1897var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 1967var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 2118var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 2173Assert.False(model.TryGetSpeculativeSemanticModel(tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, 2217Assert.Equal(TypeInfo.None, model.GetSpeculativeTypeInfo(tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single().ArgumentList.OpenParenToken.SpanStart, 2221var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 2300var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 2325Assert.False(model.TryGetSpeculativeSemanticModel(tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, 2356Assert.Equal(TypeInfo.None, model.GetSpeculativeTypeInfo(tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single().ArgumentList.OpenParenToken.SpanStart, 2360var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 2425var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2474tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().First(); 2484tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Skip(1).First(); 2489var baseWithoutParens = tree.GetRoot().DescendantNodes().OfType<SimpleBaseTypeSyntax>().Single(); 2641var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2652var typeDeclaration = tree.GetRoot().DescendantNodes().OfType<TypeDeclarationSyntax>().Single(); 2679var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2716var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2752var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 6090var doc = tree.GetRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>().Single(); 6832var xReference = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].Expression; 6858var mCall = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].Expression; 6859var attrApplication = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single(); 6860var mDefinition = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 7794var p1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "p1").Single(); 8756var p1s = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "p1").ToArray(); 9162var p1s = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "p1").ToArray(); 19772var indexer = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 20598var typeDeclaration = tree.GetRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Single(); 20631var root = tree.GetRoot(); 20675var root = tree.GetRoot(); 20722var root = tree.GetRoot(); 20772var root = tree.GetRoot();
Semantics\RecordTests.cs (52)
282var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 448var parameterSyntax = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 454var initializerSyntax = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 480var outVarSyntax = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Single(); 1815var root = comp.SyntaxTrees[0].GetRoot(); 2489var x = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Last().Left; 8088var root = tree.GetRoot(); 8601var root = tree.GetRoot(); 8716var root = tree.GetRoot(); 8861var root = tree.GetRoot(); 21144var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 21157var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 21257var equalsValue = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First(); 21268var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 21294var equalsValue = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Last(); 21374var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 21385var y = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").First(); 21398var test = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").First(); 21439var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 21485var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 21496var recordDeclarations = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Skip(1).ToArray(); 21541var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 21557var recordDeclarations = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Skip(1).ToArray(); 21600var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 21625var recordDeclarations = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Skip(1).ToArray(); 21689var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 21714var recordDeclarations = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Skip(1).ToArray(); 21888var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 21925var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 21965var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 22000var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 22079var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 22230var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 22285Assert.False(model.TryGetSpeculativeSemanticModel(tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, 22329Assert.Equal(TypeInfo.None, model.GetSpeculativeTypeInfo(tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single().ArgumentList.OpenParenToken.SpanStart, 22333var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 22412var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 22437Assert.False(model.TryGetSpeculativeSemanticModel(tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, 22468Assert.Equal(TypeInfo.None, model.GetSpeculativeTypeInfo(tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single().ArgumentList.OpenParenToken.SpanStart, 22472var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 22917var recordDeclaration = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().First(); 23371var recordDeclaration = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().ElementAt(1); 24643var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 24654var recordDeclaration = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Single(); 24678var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 24712var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 24747var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 28186var doc = tree.GetRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>().First(); 30371var xReference = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].Expression; 30395var mCall = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].Expression; 30396var attrApplication = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single(); 30397var mDefinition = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests (3)
EndToEndTests.cs (3)
491var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 612var literals = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 865var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Features (22)
AddImport\CSharpAddImportFeatureService.cs (1)
598return (CompilationUnitSyntax)contextNode.SyntaxTree.GetRoot(cancellationToken);
Completion\CompletionProviders\Scripting\DirectiveCompletionProviderUtilities.cs (1)
16var token = tree.GetRoot(cancellationToken).FindToken(position, findInsideTrivia: true);
Completion\KeywordRecommenders\NamespaceKeywordRecommender.cs (1)
94var root = (CompilationUnitSyntax)syntaxTree.GetRoot(cancellationToken);
ConvertToRawString\ConvertStringToRawStringCodeRefactoringProvider.cs (1)
182currentExpression.SyntaxTree.GetRoot(cancellationToken), cancellationToken);
Debugging\BreakpointResolver.cs (1)
37var token = tree.GetRoot(cancellationToken).FindToken(location.SourceSpan.Start);
Debugging\CSharpProximityExpressionsService.Worker.cs (1)
32_token = _syntaxTree.GetRoot(cancellationToken).FindToken(_position);
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.cs (1)
83var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (3)
46return syntaxTree.GetRoot(cancellationToken).FindToken(position).GetAncestor<MemberDeclarationSyntax>(); 236return syntaxTree.GetRoot(cancellationToken).FindTokenOnRightOfPosition( 248return syntaxTree.GetRoot(cancellationToken).FindTokenOnLeftOfPosition(
EditAndContinue\BreakpointSpans.cs (1)
38var root = tree.GetRoot(cancellationToken);
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (1)
147identifierName.SyntaxTree.GetRoot(cancellationToken);
NavigationBar\CSharpNavigationBarItemService.cs (1)
137nodesToVisit.Push(semanticModel.SyntaxTree.GetRoot(cancellationToken));
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
38var root = (CompilationUnitSyntax)syntaxTree.GetRoot(cancellationToken);
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
189outermostBody = syntaxTree.GetRoot(cancellationToken);
src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
59var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (1)
165? location.SyntaxTree.GetRoot(cancellationToken)
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
47var root = diagnostic.Location.SourceTree.GetRoot(cancellationToken);
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
29ComputeDeclarations(model, associatedSymbol: null, model.SyntaxTree.GetRoot(cancellationToken),
UsePatternMatching\CSharpIsAndCastCheckWithoutNameCodeFixProvider.cs (1)
65var updatedRoot = updatedSemanticModel.SyntaxTree.GetRoot(cancellationToken);
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (2)
177var root = updatedSemanticModel.SyntaxTree.GetRoot(cancellationToken); 190var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (22)
EditAndContinue\BreakpointSpansTests.cs (1)
76var root = tree.GetRoot();
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (1)
55var token = tree.GetRoot().FindToken(expected.Start);
EditAndContinue\Helpers\EditingTestBase.cs (5)
146var match = SyntaxComparer.TopLevel.ComputeMatch(tree1.GetRoot(), tree2.GetRoot()); 203var root = tree.GetRoot(); 219? ((BaseMethodDeclarationSyntax)SyntaxFactory.SyntaxTree(declaration).GetRoot()).Body 220: (BlockSyntax)SyntaxFactory.SyntaxTree(declaration.Body!).GetRoot();
EditAndContinue\SyntaxUtilitiesTests.cs (15)
21var oldRoot = SyntaxFactory.ParseSyntaxTree(oldSource).GetRoot(); 22var newRoot = SyntaxFactory.ParseSyntaxTree(newSource).GetRoot(); 86").GetRoot(); 104").GetRoot(); 132").GetRoot(); 154").GetRoot(); 184var m0 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M0"); 185var m1 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M1"); 186var m2 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M2"); 187var m3 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M3"); 189var f1 = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(m => m.Identifier.ValueText == "f1"); 190var f2 = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(m => m.Identifier.ValueText == "f2"); 252var x = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(m => m.Identifier.ValueText == "X"); 253var m1 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M1"); 254var m2 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M2");
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (85)
IOperation\IOperationTests.cs (10)
181var m = comp.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<BlockSyntax>().Single(); 260var m = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().First(); 311var op = (IForLoopOperation)comp.GetSemanticModel(tree).GetOperation(tree.GetRoot().DescendantNodes().OfType<ForStatementSyntax>().Single()); 352var m = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().First(); 379var op = (IForEachLoopOperation)comp.GetSemanticModel(tree).GetOperation(tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single()); 413var nodes = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 463var assignments = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().ToArray(); 509var statement = tree.GetRoot().DescendantNodes().OfType<StatementSyntax>().Single(); 667var catchBlock = syntaxTree.GetRoot().DescendantNodes().OfType<CatchClauseSyntax>().Single(); 711var fieldInitializer = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Last().Value;
IOperation\IOperationTests_IAnonymousFunctionExpression.cs (4)
409var variableDeclaration = syntaxTree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 489var variableDeclaration = syntaxTree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 847var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single())); 902var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single()));
IOperation\IOperationTests_ICoalesceAssignmentOperation.cs (1)
253var m = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
IOperation\IOperationTests_ICoalesceOperation.cs (11)
36var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 147var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 262var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 377var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 493var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 606var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 721var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 837var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 951var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 1053var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 1168var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
IOperation\IOperationTests_IConstructorBodyOperation.cs (19)
40var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 67var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 123var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 189var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 257var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 323var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 398var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 487var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 514var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 589var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 651var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 721var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 796var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 865var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 955var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 1072var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 1092var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 1125var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 1163var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Skip(1).Single();
IOperation\IOperationTests_IConversionExpression.cs (1)
5292var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First();
IOperation\IOperationTests_IFieldReferenceExpression.cs (1)
706var root = syntaxTree.GetRoot();
IOperation\IOperationTests_IFixedStatement.cs (1)
693var expr = tree.GetRoot().DescendantNodes().OfType<ConditionalExpressionSyntax>().Single();
IOperation\IOperationTests_ILocalFunctionStatement.cs (2)
1793var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First())); 1848var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First()));
IOperation\IOperationTests_IMethodBodyOperation.cs (27)
35var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 56var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 109var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 171var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 243var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 285var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 333var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 400var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 444var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().First(); 506var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().First(); 562var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 581var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 613var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 657var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 704var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 723var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 755var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 799var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 846var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 865var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 897var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 938var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 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();
IOperation\IOperationTests_IObjectCreationExpression.cs (7)
782var m1 = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 1069var main = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 1295var m1 = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 1574var main = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 2276var m = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 2400var m = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M"); 15543VerifyFlowGraph(comp, comp.SyntaxTrees[0].GetRoot(), expectedFlowGraph);
IOperation\IOperationTests_ISymbolInitializer.cs (1)
33var nodes = tree.GetRoot().DescendantNodes().Where(n => n is VariableDeclarationSyntax || n is PropertyDeclarationSyntax).ToArray();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1024)
Semantics\AccessCheckTests.cs (4)
743IAliasSymbol aliasA = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Where(u => u.Alias != null).Single()) as IAliasSymbol; 761var discards = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ContextualKind() == SyntaxKind.UnderscoreToken).ToArray(); 897IAliasSymbol SomeAlias = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Where(u => u.Alias != null).Single()); 911IMethodSymbol IntegerPlus = model.GetSymbolInfo(tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single()).Symbol as IMethodSymbol;
Semantics\AnonymousFunctionTests.cs (2)
981var root = syntaxTree.GetRoot(); 1015var root = syntaxTree.GetRoot();
Semantics\AwaitExpressionTests.cs (2)
84var awaitExpression = tree.GetRoot().DescendantNodes().OfType<AwaitExpressionSyntax>().First(); 273var decl = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().AsSingleton();
Semantics\BetterCandidates.cs (4)
1087var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1164var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1212var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1265var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
Semantics\BindingTests.cs (25)
2365var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.ThisExpression)).Cast<ThisExpressionSyntax>().Single(); 2384var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.ThisExpression)).Cast<ThisExpressionSyntax>().Single(); 2723.GetRoot() 2735.GetRoot() 2779.GetRoot() 2834.GetRoot() 2846.GetRoot() 2888var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SimpleLambdaExpression)).Single(); 2925var lambda = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SimpleLambdaExpression)).Single(); 2967var lambda = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SimpleLambdaExpression)).Single(); 3037var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Use").Single().Parent; 3051var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "AuthenticateAsync").Single().Parent; 3117var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Use").Single().Parent; 3131var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "AuthenticateAsync").Single().Parent; 3190var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Use").Single().Parent; 3205var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "AuthenticateAsync").Single().Parent; 3275var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Use").Single().Parent; 3290var node = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "AuthenticateAsync").Single().Parent; 3380var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "MathMin").Single().Parent; 3732var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "E").Single().Parent; 3912var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "G").First(); 3939var lambda = tree.GetRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(s => s.Parameter.Identifier.Text == "x"); 3985var ids = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().ToArray(); 4026var ids = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().ToArray(); 4038var ifStmt = tree.GetRoot().DescendantNodes().OfType<IfStatementSyntax>().First();
Semantics\ColorColorTests.cs (9)
1813var syntaxRoot = syntaxTree.GetRoot(); 1882var node1 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 1892var node2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single(); 1939var node1 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 1949var node2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single(); 1996var node1 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 2006var node2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single(); 2046var node1 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 2055var node2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single();
Semantics\ConditionalOperatorTests.cs (3)
1346var memberBinding = tree.GetRoot().DescendantNodes().OfType<MemberBindingExpressionSyntax>().Single(); 1400var memberBinding = tree.GetRoot().DescendantNodes().OfType<MemberBindingExpressionSyntax>().Single(); 1447var memberBinding = tree.GetRoot().DescendantNodes().OfType<MemberBindingExpressionSyntax>().Single();
Semantics\ConstantTests.cs (1)
3521var initializer = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer.Value;
Semantics\DeconstructionTests.cs (6)
5986var mainCall = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single(); 6029var mainCall = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single(); 6069var mainCall = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single(); 6111var two = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "2").Single(); 6151var mainCall = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single(); 6554var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
Semantics\DelegateTypeTests.cs (33)
749var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 795var expr = ((CastExpressionSyntax)tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value).Expression; 895var expr = tree.GetRoot().DescendantNodes().OfType<AnonymousFunctionExpressionSyntax>().Single(); 938var expr = ((CastExpressionSyntax)tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value).Expression; 996var expr = tree.GetRoot().DescendantNodes().OfType<AnonymousFunctionExpressionSyntax>().Single(); 1036var expr = ((CastExpressionSyntax)tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value).Expression; 1211var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1247var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1332var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1372var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1415var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1459var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1554var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1634var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1684var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1734var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1784var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1834var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1884var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1934var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1980var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 2028var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 3603var exprs = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => d.Initializer!.Value).ToArray(); 8028var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 8051var expr = tree.GetRoot().DescendantNodes().OfType<AnonymousFunctionExpressionSyntax>().Single(); 10386var variables = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Initializer != null); 11084var nodes = tree.GetRoot().DescendantNodes(); 11170var variables = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text == "d").ToArray(); 12110var syntax = syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 14700var syntax = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 14745var expr = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 19760var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 19802var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
Semantics\DynamicTests.cs (186)
3860var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single(); 3893var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single(); 3921var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single(); 3949var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single(); 4000var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single(); 4976var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 4985var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5059node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5100var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5109var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5182node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5223var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5232var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5306node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5341var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5346var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5382var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5387var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5426var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5431var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5470var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5475var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5514var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5519var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5578var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 5616var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 5655var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "e").Single(); 5691var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5696var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5732var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5737var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5777var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5782var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5822var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5827var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5867var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5872var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5935var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 5974var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6022var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6031var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6104node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6145var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6154var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6227node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6265var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6274var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6347node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6377var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6382var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6419var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6424var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6466var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6471var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6510var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6515var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6552var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6559foreach (var elementAccess in tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>()) 6571var increment = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 6606var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6613foreach (var elementAccess in tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>()) 6671var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6680var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6736node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6780var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6789var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6845node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6890var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6899var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6956node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6991var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6996var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7059var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7068var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7118node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7162var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7171var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7230node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7275var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7284var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7346node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7391var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7400var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7463node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7504var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7513var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7581var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7590var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7642node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7686var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7695var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7748node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7792var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7801var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7854node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7895var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7905var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7967var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7976var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8029node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8073var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8082var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8135node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8178var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8187var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8239node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8283var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8292var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8348node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8392var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8401var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8457node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8501var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8510var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8566node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8611var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8620var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8677node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8724var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8729var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8793var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8798var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8861var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8870var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8926var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9016var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9107var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9197var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9253var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9314var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9435var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9555var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9669var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9780var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9891var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 10009var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10014node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10022var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10092node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10137var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10142node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10150var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10220node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10265var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10270node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10278var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10348node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10419var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10424node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10432var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10500node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10553var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10558node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10566var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10647node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10701var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10706node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10714var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10797node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10971var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10976node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10984var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11063node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 11100var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 11105var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11184var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 11189var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11262var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 11267var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11317var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11326var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11370var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11379var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11419var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11450var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11455var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11494var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11499var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11535var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11540var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11584var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11593var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11636var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11645var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11680var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11685var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single();
Semantics\ExpressionBodiedMemberTests.cs (21)
41var node = tree.GetRoot() 426var node = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 475var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 506var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 535var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 540Assert.Contains("P1", model.LookupNames(tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single().Body.Position)); 542var node2 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single() 575var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 580Assert.Contains("P1", model.LookupNames(tree.GetRoot().DescendantNodes().OfType<DestructorDeclarationSyntax>().Single().Body.Position)); 582var node2 = tree.GetRoot().DescendantNodes().OfType<DestructorDeclarationSyntax>().Single() 616Assert.Equal(1, tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Count()); 649var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 680var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 711var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 742var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 777var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 808var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 839var nodes = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>(); 874var nodes = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>(); 913var nodes = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>(); 1021var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray();
Semantics\ForEachTests.cs (6)
2129var loopSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 2181var loopSyntaxes = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 2885var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3326var loop = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3360var loop = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3421var node = tree.GetRoot().DescendantNodes().Where(n => n.Kind() == SyntaxKind.ForEachStatement).OfType<ForEachStatementSyntax>().Single();
Semantics\FunctionPointerTests.cs (48)
201var initializer1 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First().Initializer!.Value; 203var parameter = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First().ArgumentList.Arguments.Single(); 205var initializer2 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Last().Initializer!.Value; 293foreach (var literal in tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(v => v.Initializer!.Value)) 351var conversions = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToList(); 402var conversions = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToList(); 454var conversions = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToList(); 502var conversions = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToList(); 600var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => d.Initializer!.Value).ToList(); 839var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => d.Initializer!.Value).ToList(); 882var variableDeclaratorSyntax = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 942var variableDeclaratorSyntax = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 978var variableDeclaratorSyntaxes = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1046var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1126var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1271var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1366var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1507var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1564var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1615var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1662var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1695var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1728var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1775var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1822var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1855var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1888var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1936var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 2054var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 2088var localSyntax = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 2225var invocationTypes = tree.GetRoot() 2282var invocationTypes = tree.GetRoot() 2355var invocationTypes = tree.GetRoot() 2429var invocationTypes = tree.GetRoot() 2497var invocationTypes = tree.GetRoot() 2594var invocationTypes = tree.GetRoot() 2667var invocationTypes = tree.GetRoot() 3178var invocations = tree.GetRoot().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().ToList(); 3297var invocations = tree.GetRoot().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().ToList(); 3376var isPatterns = syntaxTree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().ToArray(); 3433var isPattern = syntaxTree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 3475var isPattern = syntaxTree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 3528var binaryExpressions = syntaxTree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().ToArray(); 3582var isPattern = syntaxTree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 3677var paramTypes = syntaxTree.GetRoot().DescendantNodes() 3805VariableDeclarationSyntax fieldDeclaration = syntaxTree.GetRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Single().Declaration; 3814var localDeclaration = syntaxTree.GetRoot() 3949var parameterDecls = syntaxTree.GetRoot().DescendantNodes()
Semantics\FuzzTests.cs (1)
53foreach (var node in tree.GetRoot().DescendantNodes())
Semantics\GenericConstraintsTests.cs (4)
3140var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 3170var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 3196var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 3225var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
Semantics\GlobalUsingDirectiveTests.cs (46)
3842var ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3844var aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3868ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3870aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3890aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3899ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3901aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3918aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3932ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3934aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3952ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3954aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3968aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3977ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3979aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3990aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4004ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4006aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4024ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4026aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4040aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4049ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4051aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4062aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4076ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4078aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4090ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4092aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4100aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4111ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4113aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4133ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4135aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4149ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4151aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4243var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4251node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4279node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4287node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4295node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4303node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4315node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4979Assert.Equal("alias1=C1", model.GetSpeculativeAliasInfo(tree.GetRoot().Span.End, alias1, SpeculativeBindingOption.BindAsExpression).ToTestDisplayString()); 4980Assert.Equal("alias1=C1", model.GetSpeculativeAliasInfo(tree.GetRoot().Span.End, alias1, SpeculativeBindingOption.BindAsTypeOrNamespace).ToTestDisplayString()); 4984Assert.Equal("alias1=C1", model.GetSpeculativeAliasInfo(tree.GetRoot().Span.End, alias1, SpeculativeBindingOption.BindAsExpression).ToTestDisplayString()); 4985Assert.Equal("alias1=C1", model.GetSpeculativeAliasInfo(tree.GetRoot().Span.End, alias1, SpeculativeBindingOption.BindAsTypeOrNamespace).ToTestDisplayString());
Semantics\ImplicitObjectCreationTests.cs (2)
4531var nodes = (from node in tree.GetRoot().DescendantNodes() 4574var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "aParameter").Single();
Semantics\ImportsTests.cs (2)
113var binder = comp.GetBinderFactory(tree).GetInNamespaceBinder((CSharpSyntaxNode)tree.GetRoot()); 143var compilationUnits = trees.Select(tree => (CompilationUnitSyntax)tree.GetRoot());
Semantics\IndexAndRangeTests.cs (9)
898var expression = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 918var expression = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 939var expression = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 1122var expressions = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ToArray(); 1251var expression = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ElementAt(1); 1284var expression = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ElementAt(2); 1317var expression = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ElementAt(3); 1341var expressions = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ToArray(); 1384var expressions = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ToArray();
Semantics\InitOnlyMemberTests.cs (4)
3153speculativeModel.SyntaxTree.GetRoot() 3192var nodes = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>(); 4143var localFunctionSyntax = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4148var delegateSyntax = tree.GetRoot().DescendantNodes().OfType<DelegateDeclarationSyntax>().Single();
Semantics\InteractiveUsingTests.cs (2)
87var syntax = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single(); 117var syntax = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single();
Semantics\InterceptorsTests.cs (28)
164var invocation = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1874var invocation = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1974var root = source.GetRoot(); 2152var invocation = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 3277var interceptableName = sourceTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last().GetInterceptableNameSyntax()!; 5674var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 6811var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 6861if (tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToList() is not [var node, var otherNode]) 7013var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7054var node = sourceTree1.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7100var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7146var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7197var node = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7222var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7268var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 7309var node = source.GetRoot().DescendantNodes().OfType<MemberBindingExpressionSyntax>().Single(); 7350var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 7394var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 7437var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7490var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7536var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 7595var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 7655var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 7710var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 7765var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 7815var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 7873var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(i => i.ToString() == "RS().M()"); 7937var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(i => i.ToString() == "new S().M()");
Semantics\InterpolationTests.cs (2)
4599var descendentNodes = tree.GetRoot().DescendantNodes(); 4825SyntaxNode syntax = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single();
Semantics\IteratorTests.cs (5)
458var yieldNode = (YieldStatementSyntax)tree.GetRoot().DescendantNodes().Where(n => n is YieldStatementSyntax).SingleOrDefault(); 481var yieldNode = (YieldStatementSyntax)tree.GetRoot().DescendantNodes().Where(n => n is YieldStatementSyntax).SingleOrDefault(); 578var node = tree.GetRoot().DescendantNodes().OfType<YieldStatementSyntax>().First(); 609var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 647var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
Semantics\LambdaDiscardParametersTests.cs (8)
68var underscores = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.Identifier.ToString() == "_").ToArray(); 386var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>(); 417var underscoreParameters = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.ToString() == "_").ToArray(); 422var underscore = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").Single(); 448var underscores = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").ToArray(); 482var underscore = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").Single(); 513var underscores = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").ToArray(); 566var underscoreParameters = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.ToString() == "_").ToArray();
Semantics\LambdaTests.cs (42)
1513var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 1548var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 1582var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 1614var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 1979var node1 = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.AnonymousMethodExpression)).Single(); 2415foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2461foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2507foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2540foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2573foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2610foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2662var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().ToArray(); 3612var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>(); 3893var lambda = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 3937var attributeSyntaxes = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().ToImmutableArray(); 3977var a = (IdentifierNameSyntax)tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single().Name; 3986var m = newTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 3990a = (IdentifierNameSyntax)newTree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single().Name; 4093var expr = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 4122var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4157var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4185var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4212var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4787var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4872var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4927var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4954var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4982var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 5028var expr = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().First(); 5636var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 6509var parameterUsages = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 6819var discard = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 6848var underscore = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 6897var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray(); 7011var action = syntaxTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.ValueText == "Action"); 7105var root = syntaxTree.GetRoot(); 8010var lambdas = tree.GetRoot().DescendantNodes() 8058var lambda = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 8118var decls = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().ToImmutableArray(); 8157var defaultValue = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single() 8360var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 8393var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
Semantics\LocalFunctionTests.cs (35)
348var m = newTree.GetRoot() 353var x = newTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 394var a = tree.GetRoot().DescendantNodes() 404var m = newTree.GetRoot() 409a = newTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().ElementAt(2); 451var attributeSyntax = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single(); 493var localFunction = tree.GetRoot().DescendantNodes() 541var localFunction = tree.GetRoot().DescendantNodes() 805var localFunction = tree.GetRoot().DescendantNodes() 852var localFunction = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 968var localFunction = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 1022var attributeSyntaxes = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().ToList(); 1060var attrSyntax = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single(); 1720var x = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.ValueText == "x").Single(); 1763var root = tree.GetRoot(); 1838var root = tree.GetRoot(); 2373LocalFunctionStatementSyntax declaration = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First(); 2587var exprs = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToImmutableArray(); 4686var descendents = tree.GetRoot().DescendantNodes(); 4724var descendents = tree.GetRoot().DescendantNodes(); 4962var b2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b2").Single(); 4965var b1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b1").Single(); 6489var exprs = tree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Select(n => n.Type).ToImmutableArray(); 6536var exprs = tree.GetRoot().DescendantNodes().OfType<SizeOfExpressionSyntax>().Select(n => n.Type).ToImmutableArray(); 6550return tree.GetRoot().DescendantNodes(). 7038var nodes = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>(); 7098var nodes = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 7451return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == identifier).Single().SpanStart; 7639var tParameterUsages = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 8684var parameterUsages = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 8739var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 8742var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 8779var nameofExpression = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 9552var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 10172var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>()
Semantics\LookupTests.cs (10)
1501var node = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "m.M").Single(); 1505var node2 = (ExpressionSyntax)SyntaxFactory.SyntaxTree(node).GetRoot(); 1643var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "returne<double>").First(); 1670var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "System.Object").First(); 1725var syntaxes = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToArray(); 2014var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 2044var node = tree.GetRoot().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().Single().Expression; 2074var node = tree.GetRoot().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().Single().Expression; 2100var node = tree.GetRoot().DescendantNodes().OfType<GenericNameSyntax>().Single(); 2122var node = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single();
Semantics\MethodTypeInferenceTests.cs (8)
859return tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>(); 864return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ContextualKind() == SyntaxKind.UnderscoreToken); 1047var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1077var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1119var book = (IdentifierNameSyntax)tree.GetRoot().DescendantTokens().Last(t => t.Text == "b").Parent; 1160var author = (IdentifierNameSyntax)tree.GetRoot().DescendantTokens().Last(t => t.Text == "a").Parent; 1201var bookResult = (IdentifierNameSyntax)tree.GetRoot().DescendantTokens().Last(t => t.Text == "bookResult").Parent; 1205var authorResult = (IdentifierNameSyntax)tree.GetRoot().DescendantTokens().Last(t => t.Text == "authorResult").Parent;
Semantics\NameOfTests.cs (17)
692var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "SomeClass.Goo").OfType<ExpressionSyntax>().First(); 718var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "SomeClass.Goo").OfType<ExpressionSyntax>().First(); 753var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First(); 800var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First(); 837var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First(); 873var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Nested").OfType<ExpressionSyntax>().First(); 919var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "A.Extension").OfType<ExpressionSyntax>().First(); 952var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First(); 984var initializer = tree2.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 1024return tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>() 1056var initializer = tree2.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 1098return tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>() 1138var initializer = tree2.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 1181return tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>() 1219var initializer = tree2.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 1262return tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>() 1429var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "X1.Extension").OfType<ExpressionSyntax>().First();
Semantics\NativeIntegerTests.cs (12)
1789var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString()); 2346var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString()); 2466var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString()); 3634var nodes = tree.GetRoot().DescendantNodes().ToArray(); 4118var nodes = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().ToArray(); 6061var nodes = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>(); 6109var nodes = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>(); 9495var expr = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 9730var expr = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 10107var expr = tree.GetRoot().DescendantNodes().Single(n => n.Kind() == kind); 10332var expr = tree.GetRoot().DescendantNodes().Single(n => n.Kind() == kind); 12381var expr = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
Semantics\NullableContextTests.cs (15)
67var classDeclPosition = syntaxTree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SpanStart; 68var methodDeclPosition = syntaxTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single().SpanStart; 102var classDecl1 = syntaxTree1.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SpanStart; 103var classDecl2 = syntaxTree2.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SpanStart; 350var syntax = syntaxTree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Skip(1).Single(); 389var syntax = syntaxTree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Single(); 424var syntax = syntaxTree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First().Value; 1771var returnStatements = syntaxTree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().ToArray(); 1841var syntax = syntaxTree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single().Right; 1878var attributeArguments = syntaxTree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().ToArray(); 1927var attributeArguments = syntaxTree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().ToArray(); 1969var equalsValueClauses = syntaxTree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().ToArray(); 2009var declarations = syntaxTree.GetRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Select(f => f.Declaration.Variables[0]).ToArray(); 2048var declarations = syntaxTree.GetRoot().DescendantNodes().OfType<PropertyDeclarationSyntax>().ToArray(); 2228var typeOf = syntaxTree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single();
Semantics\NullableConversionTests.cs (1)
804var target = syntaxTree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToList()[2];
Semantics\NullableReferenceTypesTests.cs (138)
1754var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First(); 1788var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First(); 1841var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 1867var suppressions = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().ToArray(); 1892var suppressions = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().ToArray(); 1963var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First(); 2276var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 2315var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 2347var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 2381var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 2479var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First(); 3334foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 3693var lambda = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SimpleLambdaExpression)).Single(); 4526var firstCref = tree.GetRoot().DescendantNodes(descendIntoTrivia: true).OfType<NameMemberCrefSyntax>().First(); 4530var lastCref = tree.GetRoot().DescendantNodes(descendIntoTrivia: true).OfType<NameMemberCrefSyntax>().Last(); 4562var lastCref = tree.GetRoot().DescendantNodes(descendIntoTrivia: true).OfType<NameMemberCrefSyntax>().Last(); 4594var lastCref = tree.GetRoot().DescendantNodes(descendIntoTrivia: true).OfType<NameMemberCrefSyntax>().Last(); 5169var declaration = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 7769var specifier = tree.GetRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().Single(); 10534var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 13511var returnStatement = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Skip(1).Single(); 34983var outVar = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 35000var varDecl = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Where(d => d.Declaration.Type.IsVar).Single(); 56076var nullNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56082var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56106var nullNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56112var invocationNode = tree.GetRoot().DescendantNodes().OfType<ImplicitArrayCreationExpressionSyntax>().Single(); 56139var defaultNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56145var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56176var defaultNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56182var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56212var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56246var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56277var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56304var nullNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56310var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56344var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56378var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56409var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56437var newNode = tree.GetRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().First(); 56442var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56472var newNode = tree.GetRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().First(); 56477var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56508var nullNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56513var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56588var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 56591var invocationNode2 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 56619var lambdaNode = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Last(); 56624var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 59017var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59022var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclarationSyntax>().First(); 59051var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59079var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59111var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59140var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59173var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59205var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59238var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Skip(1).First(); 59272var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Skip(1).First(); 59298var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59327var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59356var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 62841var declarators = syntaxTree.GetRoot().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>().ToImmutableArray(); 65890var function1 = tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Last(); 65894var function2 = tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 65899var object2 = tree2.GetRoot().DescendantNodes().OfType<PredefinedTypeSyntax>() 71252var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71288var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71329var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71366var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71403var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71438var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71471var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71508var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71780var discards = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Select(a => a.Left).ToArray(); 71874var arguments = tree.GetRoot().DescendantNodes().OfType<ArgumentSyntax>(); 71921var arguments = tree.GetRoot().DescendantNodes().OfType<ArgumentSyntax>(); 71960var discardPatterns = tree.GetRoot().DescendantNodes().OfType<DiscardPatternSyntax>().ToArray(); 73763var node = tree.GetRoot().DescendantNodes().OfType<EnumMemberDeclarationSyntax>().ElementAt(1); 81259var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 94281var localDeclaration = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 97757var localSyntaxes = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray(); 99086var localSyntaxes = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray(); 111770var localSyntaxes = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>(); 111824var localSyntaxes = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>(); 113192var arrays = tree.GetRoot().DescendantNodes().OfType<ArrayTypeSyntax>().ToArray(); 113594var decl = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 113625var decl = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 113803var decl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 114028var decl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145375var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145382var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145416var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145423var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145456var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145463var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145494var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145501var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145532var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145539var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145572var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145605var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145636var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145643var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145675var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145682var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145952var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145983var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 146016var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 146298var @foreach = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 146337var @foreach = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 146377var @foreach = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 146416var @foreach = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 146453var root = tree.GetRoot(); 154801var locals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 154869var locals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 155997var identifiers = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "global::Program").ToArray(); 156747var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 156750var invocationNode2 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 157581var declarators = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().ToArray(); 157629var method1 = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single()); 157631var invocations = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 158061var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158097var item = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().First(); 158192var item = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 158230var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158271var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158311var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158345var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158382var item = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().First(); 158477var item = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 158525var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158567var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158604var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158815var declarations = tree.GetRoot().DescendantNodes().OfType<VariableDeclarationSyntax>(); 160690var stackallocNode = tree.GetRoot().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().Single(); 161241var arms = syntaxTree.GetRoot().DescendantNodes().OfType<SwitchExpressionArmSyntax>().ToImmutableArray(); 161287var sections = syntaxTree.GetRoot().DescendantNodes().OfType<SwitchSectionSyntax>().ToImmutableArray();
Semantics\NullCoalesceAssignmentTests.cs (5)
36var syntaxRoot = syntaxTree.GetRoot(); 74var syntaxRoot = syntaxTree.GetRoot(); 117var syntaxRoot = syntaxTree.GetRoot(); 156var syntaxRoot = syntaxTree.GetRoot(); 182var syntaxRoot = syntaxTree.GetRoot();
Semantics\ObjectAndCollectionInitializerTests.cs (19)
3471var nodes = (from node in tree.GetRoot().DescendantNodes() 3519var nodes = (from node in tree.GetRoot().DescendantNodes() 3576var nodes = (from node in tree.GetRoot().DescendantNodes() 3612var nodes = (from node in tree.GetRoot().DescendantNodes() 3649var nodes = (from node in tree.GetRoot().DescendantNodes() 3690var root = tree.GetRoot(); 3740var root = tree.GetRoot(); 3784var root = tree.GetRoot(); 3814var literals = syntax.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 3837var literals = syntax.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 3861var literals = syntax.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 3935var nodes = tree.GetRoot().DescendantNodes().OfType<InitializerExpressionSyntax>().Skip(1).Single().Expressions; 4017var nodes = tree.GetRoot().DescendantNodes().OfType<GenericNameSyntax>().ToArray(); 4058var node1 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 4096var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(n => n.ToString() == "2"); 4136var node1 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 4168var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(n => n.ToString() == "2"); 4227var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 4281var propertyAccess = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Left;
Semantics\OperatorTests.cs (20)
47var orNodes = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().ToArray(); 2985var negOne = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 2991var boolPlusPlus = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().ElementAt(0); 2997var errorPlusPlus = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().ElementAt(1); 6939var syntax = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 7056var syntax = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Last(); 7211var syntax = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Last(); 7329var syntax = tree.GetRoot(); 7330var methodBody = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body; 7488var nodes = (from node in tree.GetRoot().DescendantNodes() 7704var nodes = (from node in tree.GetRoot().DescendantNodes() 7873var nodes = (from node in tree.GetRoot().DescendantNodes() 8033var nodes = (from node in tree.GetRoot().DescendantNodes() 8554var nodes = (from node in tree.GetRoot().DescendantNodes() 8589var nodes = tree.GetRoot().DescendantNodes().Where(node => node is BinaryExpressionSyntax || node is AssignmentExpressionSyntax).ToArray(); 8633var nodes = (from node in tree.GetRoot().DescendantNodes() 8683var nodes = (from node in tree.GetRoot().DescendantNodes() 8757var nodes = (from node in tree.GetRoot().DescendantNodes() 11337var negNode = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 11418var fieldInitializerOperations = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>()
Semantics\OverloadResolutionPerfTests.cs (1)
1060var exprs = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToImmutableArray();
Semantics\OverloadResolutionTests.cs (9)
7149var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7259var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7433var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7474var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 9071var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 9419var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 11763var expr = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 11812var expr = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11862var expr = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
Semantics\QueryTests.cs (2)
2272var queryContinuation = tree.GetRoot().FindToken(sourceCode.IndexOf("into w", StringComparison.Ordinal)).Parent; 2325var joinInto = tree.GetRoot().FindToken(sourceCode.IndexOf("into x8", StringComparison.Ordinal)).Parent;
Semantics\RawInterpolationTests_Handler.cs (2)
2900var descendentNodes = tree.GetRoot().DescendantNodes(); 3126SyntaxNode syntax = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single();
Semantics\RecordStructTests.cs (21)
534var creation = tree.GetRoot().DescendantNodes().OfType<AnonymousObjectCreationExpressionSyntax>().Single(); 554var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 574var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 596var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 2307var x = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 2331var x = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 2594var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2605var recordDeclaration = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Single(); 2629var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2663var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2698var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 3242var doc = tree.GetRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>().Single(); 5849var parameterSyntax = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 5855var initializerSyntax = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 5891var outVarSyntax = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Single(); 6925var with = tree.GetRoot().DescendantNodes().OfType<WithExpressionSyntax>().Single(); 7606var with = tree.GetRoot().DescendantNodes().OfType<WithExpressionSyntax>().Single(); 8811var withExpr = tree.GetRoot().DescendantNodes().OfType<WithExpressionSyntax>().Single(); 10772tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().First(); 10782tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Skip(1).First(); 10787var baseWithoutParens = tree.GetRoot().DescendantNodes().OfType<SimpleBaseTypeSyntax>().Single();
Semantics\RefEscapingTests.cs (1)
50var root = tree.GetRoot();
Semantics\RefFieldTests.cs (63)
11025var decls = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray(); 11099var delegateTypesAndLambdas = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => getDelegateTypeAndLambda(model, d)).ToArray(); 11221var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 11389var lambdas = tree.GetRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray(); 11981var expr = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 12061var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 12130var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 12198var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 12380var decls = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>(). 12419var discard = tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray(); 12567var decls = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>(). 12599var discard = tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray(); 12793var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 12830var discard = tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray(); 12976var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13006var discard = tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray(); 13151var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13206var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13265var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13308var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13337var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13362var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13382var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13404var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13439var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13503var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13579var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13650var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13714var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 14355var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 14397var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 14522var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 14598var decls = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 14843var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 14874var discard = tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray(); 15051var decls = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 15077var decls = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 15132var decls = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 16550var invocations = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 16591var anonymousMethod = tree.GetRoot().DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single(); 16630var anonymousMethod = tree.GetRoot().DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single(); 16726var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().ToArray(); 16772var root = syntaxTree.GetRoot(); 17946var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text == "f").ToArray(); 22831var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text is "r1" or "r2").ToArray(); 22899var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text is "r1" or "r2").ToArray(); 23901var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray(); 23937var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray(); 23974var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray(); 24741var delegateTypesAndLambdas = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => getDelegateTypeAndLambda(model, d)).ToArray(); 26788foreach (var node in tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText is "a" or "b" or "c")) 26840foreach (var node in tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText is "a" or "b" or "c")) 26892foreach (var node in tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText is "a" or "b" or "c")) 27047var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 27137var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 27257var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 27358var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 27403var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 27463var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 27693var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 27741var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 28831var fieldInitializerSyntax = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First(); 28874var constructorSyntax = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
Semantics\RefLocalsAndReturnsTests.cs (10)
4750var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4778var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4806var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4834var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4862var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4890var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4924var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 5210var decls = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5254var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 5293var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
Semantics\ScriptSemanticsTests.cs (4)
1313var x = syntaxTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 1342x = syntaxTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 1357x = syntaxTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 1389var node1 = (CompilationUnitSyntax)syntaxTree.GetRoot();
Semantics\SemanticErrorTests.cs (3)
7488var node = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().First(); 13327var node = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().First(); 24224var node = tree.GetRoot().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().First();
Semantics\StackAllocInitializerTests.cs (1)
2718var operation = model.GetOperation(tree.GetRoot());
Semantics\StructConstructorTests.cs (3)
1050var syntax = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 1145var syntax = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 1242var syntax = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First();
Semantics\SuppressAccessibilityChecksTests.cs (5)
54var invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 72var invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 87var invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 169var invocation = syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 228speculativeModel.SyntaxTree.GetRoot()
Semantics\SwitchTests.cs (1)
1154var node = syntaxTree.GetRoot().DescendantNodes().First(x => x.IsKind(SyntaxKind.SimpleMemberAccessExpression));
Semantics\SyntaxTreeRootTests.cs (2)
44Assert.Equal(typeof(CompilationUnitSyntax), tree.GetRoot().GetType()); 108Assert.Equal(tree, tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SyntaxTree);
Semantics\TargetTypedConditionalOperatorTests.cs (2)
668var expr = tree.GetRoot().DescendantNodes().OfType<ConditionalExpressionSyntax>().Single(); 689var expr = tree.GetRoot().DescendantNodes().OfType<ConditionalExpressionSyntax>().Single();
Semantics\TopLevelStatementsTests.cs (99)
193var unit1 = (CompilationUnitSyntax)tree1.GetRoot(); 249var symbolInfo = model1.GetSymbolInfo(tree1.GetRoot()); 253var typeInfo = model1.GetTypeInfo(tree1.GetRoot()); 257foreach (var globalStatement in tree1.GetRoot().DescendantNodes().OfType<GlobalStatementSyntax>()) 318var unit1 = (CompilationUnitSyntax)tree1.GetRoot(); 356var unit2 = (CompilationUnitSyntax)tree2.GetRoot(); 400var symbolInfo = model1.GetSymbolInfo(tree1.GetRoot()); 404var typeInfo = model1.GetTypeInfo(tree1.GetRoot()); 408foreach (var globalStatement in tree1.GetRoot().DescendantNodes().OfType<GlobalStatementSyntax>()) 481var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 487Assert.NotNull(model1.GetOperation(tree1.GetRoot())); 492var localFuncRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local").Single(); 500var localRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").Single(); 507Assert.NotNull(model2.GetOperation(tree2.GetRoot())); 533var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 540var localRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").ToArray(); 573var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 579Assert.NotNull(model1.GetOperation(tree1.GetRoot())); 584var localFuncRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local").Single(); 591var localRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").Single(); 698var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 699var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "s").Single(); 871var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single()); 873Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single()).Symbol); 877var symbol2 = model2.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single()); 879Assert.Same(symbol2, model2.GetSymbolInfo(tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single()).Symbol); 985var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First()); 987Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").First()).Symbol); 989var symbol2 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Skip(1).Single()); 991Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Skip(1).Single()).Symbol); 1040var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First()); 1042Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").Single()).Symbol); 1407var nameRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 1411Assert.Null(model2.GetOperation(tree2.GetRoot())); 1425nameRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 1429Assert.Null(model2.GetOperation(tree2.GetRoot())); 1520var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "c").Single(); 1592foreach (var id in tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>()) 1598foreach (var id in tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>()) 1685var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 1706var nameRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray(); 1858var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 1881Assert.Null(model2.GetDeclaredSymbol((CompilationUnitSyntax)tree2.GetRoot())); 1882var nameRefs = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray(); 2084var localDecl = tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 2100var nameRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray(); 2248var localDecl = tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 2266var nameRefs = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray(); 2426var labelDecl = tree1.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single(); 2446var nameRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray(); 2919var nameRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias1" && !id.Parent.IsKind(SyntaxKind.NameEquals)).Single(); 2924nameRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias2").Single(); 2941nameRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias2" && !id.Parent.IsKind(SyntaxKind.NameEquals)).Single(); 2946nameRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias1").Single(); 3941var nameRefs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").ToArray(); 4090var nameRefs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").ToArray(); 4215var declarator = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4216var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local").Single(); 4229VerifyFlowGraph(comp, tree.GetRoot(), 4510var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single()); 4512Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").Single()).Symbol); 4516var symbol2 = model2.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First()); 4518Assert.Same(symbol2, model2.GetSymbolInfo(tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").Single()).Symbol); 4574var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First()); 4576Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").First()).Symbol); 4578var symbol2 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Skip(1).First()); 4580Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").Skip(1).Single()).Symbol); 4623var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First()); 4625Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").Single()).Symbol); 4893var declarator = tree.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single(); 4894var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "label1").Single(); 4950var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single()); 4952Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "label1").Single()).Symbol); 4956var symbol2 = model2.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single()); 4959Assert.Same(symbol2, model2.GetSymbolInfo(tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "label1").Single()).Symbol); 4978var declarator = tree.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single(); 4979var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").Single(); 6030var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 6034var localRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").ToArray(); 6046localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 6086var localFunctions = syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToList(); 6160.GetDeclaredSymbol(syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single()) 6232var invocation = syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 6276var localDecl = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 6277var localRef = syntaxTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 6316var localDecl = syntaxTree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 6317var localRef = syntaxTree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 6366var localDecl = syntaxTree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 6368var localRef = syntaxTree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 8578var invocations = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 8651var id = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 8673var id = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ar").Single(); 8695var id = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ar").Single(); 8791(CSharpSyntaxNode)oldTree.GetRoot(), new[] { new TextChangeRange(new TextSpan(282, 0), 1) }); 8799var nodes1 = tree.GetRoot().DescendantNodesAndTokensAndSelf(descendIntoTrivia: true).ToArray(); 8800var nodes2 = fullParseTree.GetRoot().DescendantNodesAndTokensAndSelf(descendIntoTrivia: true).ToArray(); 9677var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var"); 9681Assert.Equal(OperationKind.Literal, model.GetOperation(tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single()).Kind); 9702var root = tree.GetRoot();
Semantics\TypeOfTests.cs (1)
33var node = (ObjectCreationExpressionSyntax)tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "new C(0)").Last();
Semantics\UnsafeTests.cs (2)
6302var root = tree.GetRoot(); 6379var root = tree.GetRoot();
SourceGeneration\GeneratorDriverTests.cs (7)
1145var rootFromGetRoot = tree.GetRoot(); 4306var generator1 = new PipelineCallbackGenerator((ctx) => { ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen1Source.cs", c.SyntaxTrees.First().GetRoot().ToFullString() + " //generator1"); }); }).AsSourceGenerator(); 4307var generator2 = new PipelineCallbackGenerator2((ctx) => { ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen2Source.cs", c.SyntaxTrees.First().GetRoot().ToFullString() + " //generator2"); }); }).AsSourceGenerator(); 4351var generator1 = new PipelineCallbackGenerator((ctx) => { ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen1Source.cs", "//" + c.SyntaxTrees.First().GetRoot().ToFullString() + " generator1"); }); }).AsSourceGenerator(); 4352var generator2 = new PipelineCallbackGenerator2((ctx) => { ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen2Source.cs", "//" + c.SyntaxTrees.First().GetRoot().ToFullString() + " generator2"); }); }).AsSourceGenerator(); 4375var generator1 = new PipelineCallbackGenerator((ctx) => { ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen1Source.cs", c.SyntaxTrees.First().GetRoot().ToFullString() + " //generator1"); }); }).AsSourceGenerator(); 4376var generator2 = new PipelineCallbackGenerator2((ctx) => { initWasCalled = true; ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen2Source.cs", c.SyntaxTrees.First().GetRoot().ToFullString() + " //generator2"); }); }).AsSourceGenerator();
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (360)
Compilation\CompilationAPITests.cs (4)
564var rd1 = t1.GetRoot().GetDirectives().Cast<ReferenceDirectiveTriviaSyntax>().ToArray(); 572var rd2 = t2.GetRoot().GetDirectives().Cast<ReferenceDirectiveTriviaSyntax>().ToArray(); 579var rd3 = t3.GetRoot().GetDirectives().Cast<ReferenceDirectiveTriviaSyntax>().ToArray(); 586var rd4 = t4.GetRoot().GetDirectives().Cast<ReferenceDirectiveTriviaSyntax>().ToArray();
Compilation\GetSemanticInfoTests.cs (22)
2566var expr = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 4436var fieldSyntax = tree.GetRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Single(); 4490var memberAccessSyntax = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 4535var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 4589var memberAccesses = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToArray(); 4641var memberAccess = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 4687int position = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First().SpanStart; 4732int position = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First().SpanStart; 4752var trueLiteral = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 4785var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 4828var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 4875var statement = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 4910var equalsToken = tree.GetRoot().FindToken(position); 5478var invocationSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5521var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 5535var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 5582var nullSyntax = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 5620var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 5667var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 5720var methodGroupSyntax = tree.GetRoot().DescendantNodes().OfType<ArgumentSyntax>().Single().Expression; 5987var root = tree.GetRoot(); 6045var typeParameters = tree.GetRoot().DescendantNodes().OfType<TypeParameterSyntax>().ToArray();
Compilation\GetUnusedImportDirectivesTests.cs (1)
93var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression;
Compilation\ReferenceManagerTests.cs (2)
1353var rd1 = (ReferenceDirectiveTriviaSyntax)t1.GetRoot().GetDirectives().Single(); 1359var rd2 = (ReferenceDirectiveTriviaSyntax)t2.GetRoot().GetDirectives().Single();
Compilation\SemanticModelAPITests.cs (38)
42var root = tree.GetRoot(); 109SyntaxNode root = tree.GetRoot(); 1728var aliasDecl = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single(); 1739var fieldDecl = tree.GetRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Single(); 2310var accessorSyntax = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 2313var statementSyntax = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single(); 3127var syntax = tree.GetRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(). 3259var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3300var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3341var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3375var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3417var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3458var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3499var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3741var memberAccess = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 3785var localFunctionBody = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 3819var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 3846var syntax = tree.GetRoot().DescendantNodes().OfType<AliasQualifiedNameSyntax>().Single(); 3873var methodDecl = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 3910var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 4059var x = tree.GetRoot().FindToken(match.Index + 4).Parent; 4107var actual = tree.GetRoot().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray(); 4144var actual = tree.GetRoot().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray(); 4187var actual = tree.GetRoot().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray(); 4211var actual = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 4239var actual = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 4277var actual = tree.GetRoot().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray(); 4424var root = syntaxTree.GetRoot(); 4457var root = tree.GetRoot(); 4611var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(ident => ident.Identifier.Text == "global").Single(); 4625var nodes = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(ident => ident.Identifier.Text == "global").ToArray(); 4644var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M"); 4661var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4676var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4692var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "NotNullWhen"); 4708var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4727var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4743var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2");
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (1)
5206var node = tree.GetRoot().DescendantNodes().Single(node => node is IdentifierNameSyntax { Identifier: { ValueText: "b" } });
Compilation\SemanticModelGetSemanticInfoTests.cs (5)
14789var nodes = (from node in tree.GetRoot().DescendantNodes() 14885var nodes = (from node in tree.GetRoot().DescendantNodes() 14996var nodes = (from node in tree.GetRoot().DescendantNodes() 15375foreach (var qc in tree.GetRoot().DescendantNodes().OfType<QueryClauseSyntax>()) 15380var qe = tree.GetRoot().DescendantNodes().OfType<QueryExpressionSyntax>().Single();
Compilation\UsedAssembliesTests.cs (1)
136var unit = (CompilationUnitSyntax)tree.GetRoot();
DocumentationComments\CrefTests.cs (1)
6333var nonCrefPosition = tree.GetRoot().DescendantTrivia().Single(t => t.IsKind(SyntaxKind.SingleLineDocumentationCommentTrivia)).SpanStart;
SymbolDisplay\SymbolDisplayTests.cs (26)
5450var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 6433var root = srcTree.GetRoot(); 6476var root = srcTree.GetRoot(); 6510var root = srcTree.GetRoot(); 6572var root = srcTree.GetRoot(); 6605var root = srcTree.GetRoot(); 6666var root = srcTree.GetRoot(); 6699var root = srcTree.GetRoot(); 6744var root = srcTree.GetRoot(); 6867var declarations = semanticModel.SyntaxTree.GetRoot().DescendantNodes().Where(n => n.Kind() == SyntaxKind.StructDeclaration).Cast<BaseTypeDeclarationSyntax>().ToArray(); 6905var declarations = semanticModel.SyntaxTree.GetRoot().DescendantNodes().Where(n => n.Kind() == SyntaxKind.StructDeclaration).Cast<BaseTypeDeclarationSyntax>().ToArray(); 6943var declarations = semanticModel.SyntaxTree.GetRoot().DescendantNodes().Where(n => n.Kind() == SyntaxKind.StructDeclaration).Cast<BaseTypeDeclarationSyntax>().ToArray(); 7003var declaration = (BaseTypeDeclarationSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration); 7075var declaration = (BaseTypeDeclarationSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration); 7335var declaration = (BaseTypeDeclarationSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration); 7488var declaration = (BaseTypeDeclarationSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration); 7516var structure = semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.RawKind == (int)VisualBasic.SyntaxKind.StructureStatement); 7737var variable = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single().Variable; 7832var constructor = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 7892var constructor = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 7924var continuation = tree.GetRoot().DescendantNodes().OfType<QueryContinuationSyntax>().Single(); 8227var declaration = (LocalDeclarationStatementSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.LocalDeclarationStatement); 8278var declaration = (LocalDeclarationStatementSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.LocalDeclarationStatement); 8312var name = tree.GetRoot().DescendantNodes().OfType<VisualBasic.Syntax.VariableDeclaratorSyntax>().Single(); 8703var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 8759var binaryExpression = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
Symbols\AccessorOverriddenOrHiddenMembersTests.cs (1)
1005var nodes = syntaxTree.GetRoot().DescendantNodes();
Symbols\CheckedUserDefinedOperatorsTests.cs (10)
7210var xNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 7211var yNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single(); 7282var xNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 7283var yNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single(); 7353var xNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 7354var yNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single(); 7426var xNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 7427var yNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single(); 7490var xNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 7491var yNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single();
Symbols\ConversionTests.cs (4)
1728var castSyntax = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single(); 1735var forEachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1798var syntax = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single(); 1832var syntax = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single();
Symbols\CorLibrary\CorTypes.cs (2)
294var node = tree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single(); 359var node = tree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single();
Symbols\CovariantReturnTests.cs (2)
379foreach (var declaration in tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>()) 2622foreach (var localDeclaration in vbTree.GetRoot().DescendantNodes().OfType<VisualBasic.Syntax.LocalDeclarationStatementSyntax>())
Symbols\EnumTests.cs (1)
353var expr = tree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.BitwiseNotExpression);
Symbols\ExtensionMethodTests.cs (5)
3778var member = (MemberAccessExpressionSyntax)syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3866var instance = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Instance").First(); 3913var instance = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Instance").First(); 3958var instance = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Instance").First(); 4008var instance = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Instance").First();
Symbols\FunctionPointerTypeSymbolTests.cs (16)
51var paramType = syntaxTree.GetRoot() 124var parameterDecls = syntaxTree.GetRoot().DescendantNodes() 204var parameterDecls = syntaxTree.GetRoot().DescendantNodes() 285syntaxTree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(), 339var functionPointers = syntaxTree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().ToArray(); 405var parameterDecls = syntaxTree.GetRoot().DescendantNodes() 485var parameterDecls = syntaxTree.GetRoot().DescendantNodes() 602var parameterDecls = syntaxTree.GetRoot().DescendantNodes() 684var paramType = syntaxTree.GetRoot() 1148var functionPointerTypeSyntax = syntaxTree.GetRoot() 1259var functionPointerTypeSyntax = syntaxTree.GetRoot() 1316var baseNameSyntax = syntaxTree.GetRoot() 1427var anonymousObjectCreations = syntaxTree.GetRoot() 1685var mDeclSyntax = syntaxTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Skip(2).Single(); 1796var methodDecls = syntaxTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray(); 1926var decls = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
Symbols\GenericConstraintTests.cs (2)
7393var nest = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == "Nest").Single(); 7418var nest = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == "Nest").Single();
Symbols\Metadata\MetadataTypeTests.cs (2)
372var id = newTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(s => s.ToString() == "StaticModClass").First(); 387id = newTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(s => s.ToString() == "StaticModClass").First();
Symbols\RelaxedShiftOperatorTests.cs (6)
102var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 146var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 190var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 234var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 278var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 322var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
Symbols\RequiredMembersTests.cs (1)
6951var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First();
Symbols\Source\BaseClassTests.cs (1)
2031var baseY = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "y").OfType<ExpressionSyntax>().First();
Symbols\Source\DeclaringSyntaxNodeTests.cs (1)
140var node = tree.GetRoot().FindToken(position).Parent.FirstAncestorOrSelf<TNode>();
Symbols\Source\DelegateTests.cs (2)
735var root = syntaxTree.GetRoot(); 762var root = syntaxTree.GetRoot();
Symbols\Source\EventTests.cs (2)
435var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().First(); 481var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().First();
Symbols\Source\ExternAliasTests.cs (1)
478var root = tree.GetRoot();
Symbols\Source\FileModifierTests.cs (20)
1233var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last().Expression; 1367var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last().Expression; 1433var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last().Expression; 1491var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last().Expression; 1805var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last(); 1880var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last(); 2600var node = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 2639var node = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 3510var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 3559var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 3612var invoked = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3641var body = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!; 3711var body = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!; 3773var body = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!; 3814var body = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!; 3977var methodNameSyntax = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 4124var voidTypeSyntax = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single().Type!; 4410var node = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 4454var node = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 4477var node = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single();
Symbols\Source\LocalTests.cs (1)
59var expressionSyntax = tree.GetRoot().DescendantNodes().
Symbols\Source\MethodTests.cs (7)
236var node = tree.GetRoot().DescendantNodes().OfType<PredefinedTypeSyntax>().Where(n => n.Keyword.Kind() == SyntaxKind.VoidKeyword).First(); 264var node = tree.GetRoot().DescendantNodes().OfType<PredefinedTypeSyntax>().Where(n => n.Keyword.Kind() == SyntaxKind.VoidKeyword).Last(); 288var tree = comp.SyntaxTrees.Single().GetRoot(); 309var tree = comp.SyntaxTrees.Single().GetRoot(); 2540var methods = syntax.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray(); 2571var type = syntax.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single(); 2572var methods = syntax.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray();
Symbols\Source\NullablePublicAPITests.cs (105)
52var root = syntaxTree.GetRoot(); 86var root = syntaxTree.GetRoot(); 570return syntaxTree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.LocalFunctionStatementSyntax>().Select(func => semanticModel.GetDeclaredSymbol(func)).Cast<IMethodSymbol>().ToArray(); 945var invocations = syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>(); 1002var variables = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 1093var root = syntaxTree.GetRoot(); 1120var root = syntaxTree.GetRoot(); 1208var root = syntaxTree.GetRoot(); 1260var root = syntaxTree.GetRoot(); 1358var root = syntaxTree.GetRoot(); 1438var root = syntaxTree.GetRoot(); 1510var root = syntaxTree.GetRoot(); 1566var root = syntaxTree.GetRoot(); 1623var root = syntaxTree.GetRoot(); 1666var root = syntaxTree.GetRoot(); 1709var root = syntaxTree.GetRoot(); 1848var root = syntaxTree.GetRoot(); 1891var root = syntaxTree.GetRoot(); 1936var root = syntaxTree.GetRoot(); 1983var root = syntaxTree.GetRoot(); 2044var root = syntaxTree.GetRoot(); 2087var root = syntaxTree.GetRoot(); 2130var root = syntaxTree.GetRoot(); 2173var root = syntaxTree.GetRoot(); 2215var root = syntaxTree.GetRoot(); 2245var root = syntaxTree.GetRoot(); 2280var root = syntaxTree.GetRoot(); 2324var root = syntaxTree.GetRoot(); 2365var root = syntaxTree.GetRoot(); 2410var root = syntaxTree.GetRoot(); 2450var root = syntaxTree.GetRoot(); 2498var root = syntaxTree.GetRoot(); 2543var root = syntaxTree.GetRoot(); 2592var root = syntaxTree.GetRoot(); 2626var root = syntaxTree.GetRoot(); 2660var root = syntaxTree.GetRoot(); 2698var root = syntaxTree.GetRoot(); 2734var root = syntaxTree.GetRoot(); 2780var root = syntaxTree.GetRoot(); 2823var root = syntaxTree.GetRoot(); 2872var root = syntaxTree.GetRoot(); 2913var root = syntaxTree.GetRoot(); 2954var root = syntaxTree.GetRoot(); 2996var root = syntaxTree.GetRoot(); 3038var root = syntaxTree.GetRoot(); 3098var root = syntaxTree.GetRoot(); 3145var root = syntaxTree.GetRoot(); 3190var root = syntaxTree.GetRoot(); 3255var root = syntaxTree.GetRoot(); 3307var root = syntaxTree.GetRoot(); 3356var root = syntaxTree.GetRoot(); 3403var root = syntaxTree.GetRoot(); 3448var root = syntaxTree.GetRoot(); 3485var root = syntaxTree.GetRoot(); 3534var root = syntaxTree.GetRoot(); 3595var root = syntaxTree.GetRoot(); 3658var root = syntaxTree.GetRoot(); 3697var localFunctionBody = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 3732var localFunctionBody = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 3766var root = syntaxTree.GetRoot(); 3805var root = syntaxTree.GetRoot(); 3851var root = syntaxTree.GetRoot(); 3910var root = syntaxTree.GetRoot(); 3975var root = syntaxTree.GetRoot(); 4044var root = syntaxTree.GetRoot(); 4111var root = syntaxTree.GetRoot(); 4174var root = syntaxTree.GetRoot(); 4208var root = syntaxTree.GetRoot(); 4242var typeOf = syntaxTree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single(); 4269var root = syntaxTree.GetRoot(); 4303var root = syntaxTree.GetRoot(); 4335var exprs = tree.GetRoot().DescendantNodes().OfType<DefaultExpressionSyntax>().ToArray(); 4365var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4393var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4421var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4451var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4481var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4511var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4543var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4576var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4604var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4637var initializer = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 4668var initializer = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 4699var initializer = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 4730var suppressions = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Where(p => p.IsKind(SyntaxKind.SuppressNullableWarningExpression)).ToList(); 4780var invocations = syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>(); 4816var memberAccesses = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToArray(); 4902var ctorDecl = tree.GetRoot() 4933var localFunction = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4966var ternary = tree.GetRoot().DescendantNodes().OfType<ConditionalExpressionSyntax>().Single(); 5010var tupleLiteral = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 5049var constructor = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 5065var switchExpressionInput = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single().GoverningExpression; 5102var binaryRight = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single().Right; 5134var binaryRight = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single().Right; 5162var binaryRightArgument = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single().Right.DescendantNodes().OfType<ArgumentSyntax>().Single().Expression; 5197var xUsage = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single().Expression; 5232var xUsage = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single().Expression; 5254var root = tree.GetRoot(); 5277var root = tree.GetRoot(); 5309var root = tree.GetRoot(); 5332var root = tree.GetRoot(); 5354var root = tree.GetRoot(); 5399var root = tree.GetRoot(); 5456var root = tree.GetRoot();
Symbols\Source\UpdatedContainingSymbolAndNullableAnntotationTests.cs (1)
34var root = syntaxTree.GetRoot();
Symbols\Source\UsingAliasTests.cs (2)
697var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Short").Skip(1).Single(); 740var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Short").Skip(1).Single();
Symbols\StaticAbstractMembersInInterfacesTests.cs (28)
8453var node = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 9041var node = postfixOp != "" ? (ExpressionSyntax)tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First() : tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().First(); 9356var node = tree.GetRoot().DescendantNodes().OfType<ConditionalExpressionSyntax>().First(); 9755var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 10752var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + " 1").Single(); 10945var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + " 1").Single(); 11135var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + " y").Single(); 11329var node1 = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + op + " y").First(); 11583var node1 = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + op + " y").First(); 11960var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(n => n.ToString() == "x " + op + "= 1").Single(); 12139var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 13180var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Right; 13266var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Left; 13388var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Left; 14089var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Left; 14098node = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First().ArgumentList.Arguments[0].Expression; 14714var node = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 15120var node = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 15388var node = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 19560var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 19643var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 19735var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 19824var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 28773var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 30280var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().First(); 30471var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 30937var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().First();
Symbols\SymbolEqualityTests.cs (18)
40var root = tree.GetRoot(); 83var root = tree.GetRoot(); 123var root = tree.GetRoot(); 164var root = tree.GetRoot(); 410var root = syntaxTree.GetRoot(); 448var root = syntaxTree.GetRoot(); 479var root = syntaxTree.GetRoot(); 522var root = syntaxTree.GetRoot(); 553var root = syntaxTree.GetRoot(); 589var root = syntaxTree.GetRoot(); 623var root = syntaxTree.GetRoot(); 672var root = syntaxTree.GetRoot(); 724var root = syntaxTree.GetRoot(); 774var root = syntaxTree.GetRoot(); 825var root = syntaxTree.GetRoot(); 886var root = syntaxTree.GetRoot(); 933var root = syntaxTree.GetRoot(); 961var syntaxNode = syntaxTree.GetRoot().DescendantNodes().
Symbols\SymbolExtensionTests.cs (5)
101var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var"); 119var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var"); 137var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var"); 156var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Last(id => id.Identifier.Text == "var"); 252var method = model.GetSymbolInfo(tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Method").Single()).Symbol.GetSymbol<MethodSymbol>();
Symbols\UnsignedRightShiftTests.cs (13)
123var unsignedShift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First(); 124var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.RightShiftExpression).First(); 626var unsignedShift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftAssignmentExpression).First(); 627var shift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.RightShiftAssignmentExpression).First(); 1176var unsignedShift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First(); 1177var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.RightShiftExpression).First(); 1584var unsignedShift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftAssignmentExpression).First(); 1585var shift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.RightShiftAssignmentExpression).First(); 1983var unsignedShift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First(); 2235var unsignedShift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First(); 2377var unsignedShift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftAssignmentExpression).First(); 2511var unsignedShift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First(); 2608var unsignedShift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftAssignmentExpression).First();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (98)
Diagnostics\DiagnosticTest.cs (1)
1981var nodes = ParseWithRoundTripCheck(text).GetRoot().DescendantNodes(descendIntoTrivia: true);
Diagnostics\LineSpanDirectiveTests.cs (2)
443foreach (var syntax in tree.GetRoot().DescendantNodesAndSelf()) 463var directives = tree.GetRoot().DescendantNodesAndSelf(descendIntoTrivia: true).OfType<DirectiveTriviaSyntax>();
Diagnostics\LocationsTests.cs (2)
561var treeSpan = tree.GetRoot().FullSpan; 589var treeSpan = tree.GetRoot().FullSpan;
IncrementalParsing\IncrementalParsingTests.cs (13)
492Assert.True(tree.GetRoot().DescendantNodesAndSelf().Any(n => n is AttributeSyntax)); 493Assert.False(tree.GetRoot().DescendantNodesAndSelf().Any(n => n is CollectionExpressionSyntax)); 502Assert.False(tree.GetRoot().DescendantNodesAndSelf().Any(n => n is AttributeSyntax)); 503Assert.True(tree.GetRoot().DescendantNodesAndSelf().Any(n => n is CollectionExpressionSyntax)); 524Assert.False(tree.GetRoot().DescendantNodesAndSelf().Any(n => n is AttributeSyntax)); 525Assert.True(tree.GetRoot().DescendantNodesAndSelf().Any(n => n is CollectionExpressionSyntax)); 534Assert.True(tree.GetRoot().DescendantNodesAndSelf().Any(n => n is AttributeSyntax)); 535Assert.False(tree.GetRoot().DescendantNodesAndSelf().Any(n => n is CollectionExpressionSyntax)); 565var localFunc1 = tree.GetRoot().DescendantNodesAndSelf().Single(n => n is LocalFunctionStatementSyntax); 582var localFunc2 = tree.GetRoot().DescendantNodesAndSelf().Single(n => n is LocalFunctionStatementSyntax); 3054var tempRoot = tempTree.GetRoot(); 3110WalkTreeAndVerify(incrTree.GetRoot(), fullTree.GetRoot());
LexicalAndXml\LexicalTests.cs (1)
3824Assert.False(tree.GetRoot().DescendantTokens().Any(
Parsing\ExpressionParsingTests.cs (1)
3135var root = SyntaxFactory.ParseSyntaxTree(text).GetRoot();
Parsing\FileModifierParsingTests.cs (1)
35Validate(text, (CSharpSyntaxNode)tree.GetRoot(), expectedParsingDiagnostics);
Parsing\ParserErrorMessageTests.cs (7)
3767var methodDeclaration = (MethodDeclarationSyntax)tree.GetRoot().DescendantNodes().Single(node => node is MethodDeclarationSyntax); 3770var delegateDeclaration = (DelegateDeclarationSyntax)tree.GetRoot().DescendantNodes().Single(node => node is DelegateDeclarationSyntax); 3773var localFunctionStatement = (LocalFunctionStatementSyntax)tree.GetRoot().DescendantNodes().Single(node => node is LocalFunctionStatementSyntax); 3776var lambdaExpression = (ParenthesizedLambdaExpressionSyntax)tree.GetRoot().DescendantNodes().Single(node => node is ParenthesizedLambdaExpressionSyntax); 3779var anonymousMethodExpression = (AnonymousMethodExpressionSyntax)tree.GetRoot().DescendantNodes().Single(node => node is AnonymousMethodExpressionSyntax); 3782var indexerDeclaration = (IndexerDeclarationSyntax)tree.GetRoot().DescendantNodes().Single(node => node is IndexerDeclarationSyntax); 3785var operatorDeclaration = (OperatorDeclarationSyntax)tree.GetRoot().DescendantNodes().Single(node => node is OperatorDeclarationSyntax);
Parsing\ParsingErrorRecoveryTests.cs (13)
7761var toString = tree.GetRoot().ToFullString(); 7776var toString = tree.GetRoot().ToFullString(); 7807var toString = tree.GetRoot().ToFullString(); 7841var toString = tree.GetRoot().ToFullString(); 7866var toString = tree.GetRoot().ToFullString(); 7893var toString = tree.GetRoot().ToFullString(); 7907var toString = tree.GetRoot().ToFullString(); 7919var eofToken = ((CompilationUnitSyntax)tree.GetRoot()).EndOfFileToken; 7933var root = SyntaxFactory.ParseSyntaxTree(source).GetRoot(); 7954var root = SyntaxFactory.ParseSyntaxTree(source).GetRoot(); 7975var root = SyntaxFactory.ParseSyntaxTree(source).GetRoot(); 7998var root = SyntaxFactory.ParseSyntaxTree(source).GetRoot(); 8022var root = SyntaxFactory.ParseSyntaxTree(source).GetRoot();
Parsing\RecordParsing.cs (2)
278UsingNode((CSharpSyntaxNode)tree.GetRoot()); 311UsingNode((CSharpSyntaxNode)tree.GetRoot());
Parsing\StatementParsingTests.cs (4)
3411var root = tree.GetRoot(); 3438var root = tree.GetRoot(); 3461var root = tree.GetRoot(); 3532tree.GetDiagnostics(tree.GetRoot()).Verify(
Syntax\FieldAndValueKeywordTests.cs (1)
1277var expr = syntaxTree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression;
Syntax\LambdaUtilitiesTests.cs (2)
51var node = tree.GetRoot().FindNode(span.Value); 57var methodDef = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(d => d.Identifier.ValueText == "M").Single();
Syntax\SyntaxDiffingTests.cs (2)
284var root = oldTree.GetRoot(); 344var root = oldTree.GetRoot();
Syntax\SyntaxEquivalenceTests.cs (5)
40Assert.True(SyntaxFactory.AreEquivalent(node1, tree3.GetRoot(), ignoreChildNode)); 492VerifyEquivalent(tree1.GetRoot(), tree2.GetRoot(), ignoreChildNode: k => k == SyntaxKind.NullableDirectiveTrivia); 513VerifyEquivalent(tree3.GetRoot(), tree4.GetRoot(), ignoreChildNode: k => k == SyntaxKind.NullableDirectiveTrivia);
Syntax\SyntaxListTests.cs (3)
332var node = tree.GetRoot().DescendantNodes().OfType<InitializerExpressionSyntax>().First(); 356var node = tree.GetRoot().DescendantNodes().OfType<InitializerExpressionSyntax>().First(); 402return tree.GetRoot().DescendantNodes().OfType<InitializerExpressionSyntax>().First();
Syntax\SyntaxNodeTests.cs (15)
46var directives = tree.GetRoot().GetDirectives(); 705var root = tree.GetRoot(); 1059List<SyntaxToken> tokens = syntaxTree.GetRoot().DescendantTokens().ToList(); 1062SyntaxToken token = syntaxTree.GetRoot().GetFirstToken(); 1164List<SyntaxToken> tokens = syntaxTree.GetRoot().DescendantTokens().ToList(); 1167var token = syntaxTree.GetRoot().GetLastToken(includeZeroWidth: false); // skip EOF 1209List<SyntaxToken> tokens = syntaxTree.GetRoot().DescendantTokens().ToList(); 1212SyntaxToken token = syntaxTree.GetRoot().GetFirstToken(includeZeroWidth: true); 1254List<SyntaxToken> tokens = syntaxTree.GetRoot().DescendantTokens().ToList(); 1800var nodeOrToken = (SyntaxNodeOrToken)syntaxTree.GetRoot(); 2032var actualTokens = syntaxTree.GetRoot().DescendantTokens(syntaxTree.GetRoot().FullSpan); 3588var root = (CompilationUnitSyntax)tree.GetRoot(); 3638var root = (CompilationUnitSyntax)tree.GetRoot(); 3671var root = (CompilationUnitSyntax)tree.GetRoot();
Syntax\SyntaxRewriterTests.cs (19)
317Assert.Same(node, node.SyntaxTree.GetRoot()); 326Assert.Same(node1, node1.SyntaxTree.GetRoot()); 330Assert.Same(node2, node2.SyntaxTree.GetRoot()); 342Assert.Same(newRoot, newRoot.SyntaxTree.GetRoot()); 354Assert.Same(newRoot, newRoot.SyntaxTree.GetRoot()); 362var root = tree.GetRoot(); 381var root = tree.GetRoot(); 400var root = tree.GetRoot(); 425var root = tree.GetRoot(); 443var root = tree.GetRoot(); 466var root = tree.GetRoot(); 493var root = tree.GetRoot(); 515var root = tree.GetRoot(); 528var root = tree.GetRoot(); 545Assert.Same(rewrittenRoot, rewrittenRoot.SyntaxTree.GetRoot()); 560Assert.Same(ifStmt1, expr1.SyntaxTree.GetRoot()); 578Assert.Same(ifStmt2, expr2.SyntaxTree.GetRoot()); 624Assert.Same(ifStmt2, expr2.SyntaxTree.GetRoot()); 650var oldRoot = oldTree.GetRoot();
Syntax\SyntaxTreeTests.cs (4)
249Assert.Equal(newRoot.ToString(), newTree.GetRoot().ToString()); 267Assert.Equal(newRoot.ToString(), newTree.GetRoot().ToString()); 280Assert.Equal(newRoot.ToString(), newTree.GetRoot().ToString()); 332Assert.Equal(string.Empty, CSharpSyntaxTree.Create((CSharpSyntaxNode)oldTree.GetRoot()).FilePath);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (10)
CompilationTestUtils.cs (1)
456var root = tree.GetRoot();
CSharpTestBase.cs (7)
774return tree.GetRoot().DescendantNodes().OfType<T>().Where(e => e.ToString() == text); 1107var parsedText = tree.GetRoot(); 1337bool hasTopLevelStatements = syntaxTrees.Any(s => s.GetRoot().ChildNodes().OfType<GlobalStatementSyntax>().Any()); 1562return GetSyntaxNodeList(syntaxTree.GetRoot(), null); 1695string text = tree.GetRoot().ToFullString(); 1739string text = tree.GetRoot().ToFullString(); 1754var node = tree.GetRoot().FindToken(start).Parent;
SemanticModelTestBase.cs (2)
35return GetExprSyntaxList(syntaxTree.GetRoot(), null); 141var nameSyntaxToBind = tree.GetRoot().FindToken(position, findInsideTrivia: true).Parent as IdentifierNameSyntax;
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (2)
CodeGen\WinMdEventTests.cs (1)
671var syntax = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
CodeGen\WinRTCollectionTests.cs (1)
7424var add = tree.GetRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Add").Single();
Microsoft.CodeAnalysis.CSharp.Workspaces (21)
Rename\CSharpRenameRewriterLanguageService.cs (2)
291var speculativeTree = originalNode.SyntaxTree.GetRoot(_cancellationToken).ReplaceNode(originalNode, newNode); 306speculativeTree = originalNode.SyntaxTree.GetRoot(_cancellationToken).ReplaceNode(originalNode, newNode);
Simplification\CSharpSimplificationService.cs (1)
187var root = model.SyntaxTree.GetRoot(cancellationToken);
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (1)
220var root = (CompilationUnitSyntax)model.SyntaxTree.GetRoot(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
37directive.FullSpan.End == syntaxTree.GetRoot(cancellationToken).FullSpan.End;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (5)
178var root = (CompilationUnitSyntax)syntaxTree.GetRoot(cancellationToken); 222var trivia = syntaxTree.GetRoot(cancellationToken).FindTrivia(position); 391var token = syntaxTree.GetRoot(cancellationToken).FindToken(position, findInsideTrivia: true); 440var root = (CompilationUnitSyntax)syntaxTree.GetRoot(cancellationToken); 492var trivia = syntaxTree.GetRoot(cancellationToken).FindTrivia(position, findInsideTrivia: false);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (1)
162return syntaxTree.GetRoot(cancellationToken).FindTrivia(span.Start - 1, findInsideTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
331? ((CompilationUnitSyntax)structure.SyntaxTree.GetRoot(CancellationToken.None)).EndOfFileToken
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Helpers\RemoveUnnecessaryImports\CSharpUnnecessaryImportsProvider.cs (1)
28var root = model.SyntaxTree.GetRoot(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
1108var trivia = syntaxTree.GetRoot(cancellationToken).FindTrivia(position, findInsideTrivia: false);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (2)
191var root = tree.GetRoot(cancellationToken); 204var newDeclarationTypeNode = newTree.GetRoot(cancellationToken).GetAnnotatedNodes(annotation).Single();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (2)
85return (TypeDeclarationSyntax)tree.GetRoot(cancellationToken); 206return contextTree?.GetRoot(cancellationToken).FindToken(contextLocation!.SourceSpan.Start).Parent;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (1)
33var root = (CompilationUnitSyntax)contextNode.SyntaxTree.GetRoot(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (2)
430if (syntaxTree.GetRoot(cancellationToken) is CompilationUnitSyntax compilationUnit && 1987if (syntaxTree.GetRoot(cancellationToken) is CompilationUnitSyntax compilationUnit &&
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (3)
CodeGeneration\SyntaxGeneratorTests.cs (1)
4993var root = tree.GetRoot();
CSharpSyntaxFactsServiceTests.cs (1)
19var token = tree.GetRoot().FindToken(position);
EmbeddedLanguages\VirtualChars\CSharpVirtualCharServiceTests.cs (1)
122var compilationUnit = (CompilationUnitSyntax)tree.GetRoot();
Microsoft.CodeAnalysis.EditorFeatures (3)
CommentSelection\AbstractCommentSelectionBase.cs (1)
150var newRoot = oldSyntaxTree.WithChangedText(newText).GetRoot(cancellationToken);
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCommitter.cs (1)
192var documentWithOriginalName = document.WithSyntaxRoot(syntaxTreeWithOriginalName.GetRoot(cancellationToken));
TextStructureNavigation\AbstractTextStructureNavigatorProvider.TextStructureNavigator.cs (1)
331token = syntaxTree.GetRoot(cancellationToken).FindToken(point, true);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (2)
Semantics\SpeculationAnalyzerTestsBase.cs (2)
36var initialNode = initialTree.GetRoot().DescendantNodes().First(n => IsExpressionNode(n) && n.ToString() == (expressionToAnalyze ?? initialExpression)); 39var replacementNode = replacementTree.GetRoot().DescendantNodes().First(n => IsExpressionNode(n) && n.ToString() == (expressionToAnalyze ?? replacementExpression));
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (13)
CodeFixes\CodeFixServiceTests.cs (1)
1202var variableDeclarations = context.SemanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType<CodeAnalysis.CSharp.Syntax.VariableDeclarationSyntax>();
CodeGeneration\CodeGenerationTests.cs (6)
543testContext.Result = testContext.Document.WithSyntaxRoot(testContext.SemanticModel.SyntaxTree.GetRoot().ReplaceNode(oldNode, newNode)); 562testContext.Result = testContext.Document.WithSyntaxRoot(testContext.SemanticModel.SyntaxTree.GetRoot().ReplaceNode(declarationNode, newNode)); 614testContext.Result = testContext.Document.WithSyntaxRoot(testContext.SemanticModel.SyntaxTree.GetRoot().ReplaceNode(declarationNode, updatedDeclarationNode)); 886return SemanticModel.SyntaxTree.GetRoot().FindNode(destSpan, getInnermostNodeForTie: true); 907var token = semanticModel.SyntaxTree.GetRoot().FindToken(selection.Start); 919var token = SemanticModel.SyntaxTree.GetRoot().FindToken(destSpan.Start);
Diagnostics\DiagnosticAnalyzerServiceTests.cs (6)
923context.RegisterSyntaxTreeAction(c => c.ReportDiagnostic(Diagnostic.Create(s_syntaxRule, c.Tree.GetRoot().GetLocation()))); 924context.RegisterSemanticModelAction(c => c.ReportDiagnostic(Diagnostic.Create(s_semanticRule, c.SemanticModel.SyntaxTree.GetRoot().GetLocation()))); 925context.RegisterCompilationAction(c => c.ReportDiagnostic(Diagnostic.Create(s_compilationRule, c.Compilation.SyntaxTrees.First().GetRoot().GetLocation()))); 939context.RegisterSyntaxTreeAction(c => c.ReportDiagnostic(Diagnostic.Create(s_syntaxRule, c.Tree.GetRoot().GetLocation()))); 940context.RegisterSemanticModelAction(c => c.ReportDiagnostic(Diagnostic.Create(s_semanticRule, c.SemanticModel.SyntaxTree.GetRoot().GetLocation()))); 941context.RegisterCompilationAction(c => c.ReportDiagnostic(Diagnostic.Create(s_compilationRule, c.Compilation.SyntaxTrees.First().GetRoot().GetLocation())));
Microsoft.CodeAnalysis.EditorFeatures.Wpf (1)
Peek\PeekHelpers.cs (1)
50var root = identifierLocation.SourceTree.GetRoot(cancellationToken);
Microsoft.CodeAnalysis.Features (19)
AddImport\References\Reference.cs (1)
93var root = contextNode.SyntaxTree.GetRoot(cancellationToken);
ChangeSignature\AbstractChangeSignatureService.cs (1)
460var root = tree.GetRoot();
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaHelpers.cs (1)
222var root = nodeWithTokens.SyntaxTree.GetRoot();
Completion\Providers\AbstractOverrideCompletionProvider.ItemGetter.cs (1)
151var root = _syntaxTree.GetRoot(_cancellationToken);
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (2)
57var token = syntaxTree.GetRoot(cancellationToken).FindToken(position, findInsideTrivia: true); 267var trivia = syntaxTree.GetRoot(cancellationToken).FindTrivia(position, findInsideTrivia: false);
DocumentHighlighting\AbstractDocumentHighlightsService.cs (1)
97var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
EmbeddedLanguages\Classification\AbstractEmbeddedLanguageClassificationService.cs (1)
57var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
EncapsulateField\AbstractEncapsulateFieldService.cs (1)
178document = document.WithSyntaxRoot(fieldDeclaration.SyntaxTree.GetRoot(cancellationToken).ReplaceNode(fieldDeclaration.GetSyntax(cancellationToken),
ExtractMethod\MethodExtractor.VariableSymbol.cs (1)
250var token = tree.GetRoot(cancellationToken).FindToken(span.Start);
ExtractMethod\SelectionValidator.cs (1)
80return IsFinalSpanSemanticallyValidSpan(semanticModel.SyntaxTree.GetRoot(cancellationToken), textSpan, returnStatements, cancellationToken);
QuickInfo\CommonSemanticQuickInfoProvider.cs (1)
142var root = linkedModel.SyntaxTree.GetRoot(cancellationToken);
ReplaceDocCommentTextWithTag\AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (1)
128var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
src\Analyzers\Core\Analyzers\AddAccessibilityModifiers\AbstractAddAccessibilityModifiersDiagnosticAnalyzer.cs (1)
43ProcessCompilationUnit(context, option, (TCompilationUnitSyntax)context.Tree.GetRoot(context.CancellationToken));
src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderDiagnosticAnalyzer.cs (1)
48var root = tree.GetRoot(context.CancellationToken);
src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (1)
50var root = tree.GetRoot(cancellationToken);
src\Analyzers\Core\Analyzers\MatchFolderAndNamespace\AbstractMatchFolderAndNamespaceDiagnosticAnalyzer.cs (1)
95var root = namespaceDeclaration.SyntaxTree.GetRoot(cancellationToken);
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
127var root = tree.GetRoot(cancellationToken);
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (1)
126var root = firstBlock.Syntax.SyntaxTree.GetRoot(context.CancellationToken);
Microsoft.CodeAnalysis.Features.Test.Utilities (1)
EditAndContinue\EditAndContinueTestVerifier.cs (1)
65var oldRoot = oldTree.GetRoot();
Microsoft.CodeAnalysis.Features.UnitTests (4)
EditAndContinue\RudeEditDiagnosticTests.cs (1)
23var syntaxNode = tree.GetRoot();
FindUsages\DefinitionItemFactoryTests.cs (3)
1452var f = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().Single(n => n is LocalFunctionStatementSyntax)); 1518var x = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().Single(n => n is VariableDeclaratorSyntax)); 1589var r = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().Single(n => n is FromClauseSyntax));
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (3)
Diagnostics\NonLocalDiagnosticTests.cs (2)
93var root = tree.GetRoot(); 104var root = tree.GetRoot();
Diagnostics\PullDiagnosticTests.cs (1)
137context.ReportDiagnostic(Diagnostic.Create(_descriptor, context.Tree.GetRoot(context.CancellationToken).GetLocation())));
Microsoft.CodeAnalysis.Test.Utilities (24)
CommonTestBase.cs (2)
599var root = model.SyntaxTree.GetRoot(); 648foreach (var node in model.SyntaxTree.GetRoot().DescendantNodes())
Compilation\CompilationExtensions.cs (3)
202SyntaxNode root = tree.GetRoot(); 290var root = tree.GetRoot(); 394var nodes = tree.GetRoot().DescendantNodesAndSelf();
Diagnostics\CommonDiagnosticAnalyzers.cs (14)
71var location = context.Tree.GetRoot().GetLocation(); 106var root = tree.GetRoot(); 184var root = tree.GetRoot(); 261var root = tree.GetRoot(); 314var root = tree.GetRoot(); 943_invalidLocation = treeInAnotherCompilation.GetRoot().GetLocation(); 1081context.ReportDiagnostic(Diagnostic.Create(Descriptor, tree.GetRoot().GetLocation())); 1107Diagnostic.Create(Descriptor, context.SemanticModel.SyntaxTree.GetRoot().GetLocation()))); 1665ReportDiagnosticsCore(addDiagnostic, tree.GetRoot().GetLastToken().GetLocation(), tree.FilePath); 2600var fields = context.Tree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.FieldDeclarationSyntax>(); 2697context.ReportDiagnostic(Diagnostic.Create(s_descriptor, context.Tree.GetRoot().GetLocation())); 2849var root = tree.GetRoot(); 2934context.RegisterSyntaxTreeAction(syntaxContext => HandleCallback(syntaxContext.Tree.GetRoot().GetLocation(), context.Compilation, syntaxContext.ReportDiagnostic, syntaxContext.CancellationToken)); 2946context.RegisterSemanticModelAction(context => HandleCallback(context.SemanticModel.SyntaxTree.GetRoot().GetLocation(), context.SemanticModel.Compilation, context.ReportDiagnostic, context.CancellationToken));
Diagnostics\DiagnosticDescription.cs (2)
285if (!_syntaxPredicate(d._location.SourceTree.GetRoot().FindToken(_location.SourceSpan.Start, true).Parent)) 298if (!d._syntaxPredicate(_location.SourceTree.GetRoot().FindToken(_location.SourceSpan.Start, true).Parent))
Diagnostics\SuppressMessageAttributeTests.DiagnosticAnalyzers.cs (2)
205var comments = context.Tree.GetRoot().DescendantTrivia() 244foreach (var nodeOrToken in context.Tree.GetRoot().DescendantNodesAndTokens())
MarkedSource\SourceWithMarkedNodes.cs (1)
45Root = parser(Source).GetRoot();
Microsoft.CodeAnalysis.UnitTests (3)
Diagnostics\OperationTests.cs (2)
310var literal = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 323var classDecl = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single();
Diagnostics\SuppressMessageTargetSymbolResolverTests.cs (1)
1397var token = model.SyntaxTree.GetRoot().FindToken(pos);
Microsoft.CodeAnalysis.VisualBasic (21)
CommandLine\VisualBasicCompiler.vb (1)
273For Each directive As ExternalSourceDirectiveTriviaSyntax In tree.GetRoot().GetDirectives(
Compilation\DocumentationComments\UnprocessedDocumentationCommentFinder.vb (1)
46finder.Visit(tree.GetRoot(cancellationToken))
Compilation\SemanticModel.vb (4)
570Dim atEOF As Boolean = (position = fullEnd AndAlso position = SyntaxTree.GetRoot().FullSpan.End) 614Dim atEOF As Boolean = (position = fullEnd AndAlso position = SyntaxTree.GetRoot().FullSpan.End) 620token = SyntaxTree.GetRoot().FindToken(position, True) 628token = SyntaxTree.GetRoot().FindToken(position)
Compilation\SyntaxTreeSemanticModel.vb (1)
58Return DirectCast(_syntaxTree.GetRoot(), VisualBasicSyntaxNode)
Compilation\VisualBasicCompilation.vb (2)
2316If Not filterSpanWithinTree.HasValue OrElse filterSpanWithinTree.Value = tree.GetRoot(cancellationToken).FullSpan Then 2621Dim checksumDirectives = tree.GetRoot().GetDirectives(Function(d) d.Kind = SyntaxKind.ExternalChecksumDirectiveTrivia AndAlso
Declarations\DeclarationTreeBuilder.vb (1)
29Dim decl = DirectCast(builder.ForDeclaration(tree.GetRoot()), RootSingleNamespaceDeclaration)
src\Compilers\VisualBasic\BasicAnalyzerDriver\VisualBasicDeclarationComputer.vb (1)
20ComputeDeclarationsCore(model, model.SyntaxTree.GetRoot(cancellationToken),
Symbols\Source\SourceAssemblySymbol.vb (1)
493Dim compilationUnitSyntax = DirectCast(rootNs.Location.SourceTree.GetRoot(), CompilationUnitSyntax)
Symbols\Symbol.vb (1)
373Dim token = CType(location.SourceTree.GetRoot().FindToken(location.SourceSpan.Start), SyntaxToken)
Syntax\SyntaxEquivalence.vb (2)
19Return AreEquivalent(before.GetRoot(), after.GetRoot(), ignoreChildNode, topLevel)
Syntax\SyntaxFactory.vb (1)
1078Dim compilationUnit As CompilationUnitSyntax = DirectCast(tree.GetRoot(), CompilationUnitSyntax)
Syntax\VisualBasicSyntaxTree.LazySyntaxTree.vb (1)
76Dim root = CloneNodeAsRoot(CType(tree.GetRoot(cancellationToken), VisualBasicSyntaxNode))
Syntax\VisualBasicSyntaxTree.vb (1)
524Return SyntaxDiffer.GetPossiblyDifferentTextSpans(oldTree.GetRoot(), Me.GetRoot())
Syntax\VisualBasicWarningStateMap.vb (1)
28For Each d As DirectiveTriviaSyntax In syntaxTree.GetRoot().GetDirectives()
VisualBasicExtensions.vb (2)
260Return DirectCast(syntaxTree.GetRoot(cancellationToken), VisualBasicSyntaxNode) 505Return DirectCast(tree.GetRoot(), CompilationUnitSyntax)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (8)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\DirectiveSyntaxExtensions.vb (1)
39Return GetDirectiveInfo(syntaxTree.GetRoot(cancellationToken), cancellationToken).DirectiveMap.Keys.Where(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (1)
750Return tree.GetRoot().ReplaceNode(oldBlock, newBlock)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb (4)
122Return FindTriviaToLeft(syntaxTree.GetRoot(cancellationToken), position) 305Dim compilationUnit = TryCast(syntaxTree.GetRoot(cancellationToken), CompilationUnitSyntax) 353directive.FullSpan.End = syntaxTree.GetRoot(cancellationToken).FullSpan.End 359Dim token = syntaxTree.GetRoot(cancellationToken).FindToken(line.Start)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicUnnecessaryImportsProvider.vb (2)
30Dim root = model.SyntaxTree.GetRoot(cancellationToken) 73Dim root = DirectCast(model.SyntaxTree.GetRoot(cancellationToken), CompilationUnitSyntax)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (2)
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicCommonGenerationServiceMethods.vb (1)
14Dim root = semanticModel.SyntaxTree.GetRoot
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTreeExtensions.vb (1)
107Dim token = syntaxTree.GetRoot(cancellationToken).FindToken(position)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests (3)
src\Features\VisualBasicTest\Utils.vb (3)
86Return syntaxTree.GetRoot().DigToFirstNodeOfType(Of T)() 98Return syntaxTree.GetRoot().ChildNodesAndTokens().Where(Function(n) n.IsNode). 105Return syntaxTree.GetRoot().ChildNodesAndTokens().Where(Function(n) n.IsNode).
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (4)
LineCommit\CommitFormatter.vb (2)
240Dim token = syntaxTree.GetRoot(cancellationToken).FindToken(Math.Min(endPosition, syntaxTree.GetRoot(cancellationToken).FullSpan.End))
LineCommit\ContainingStatementInfo.vb (2)
60Dim trivia = syntaxTree.GetRoot(cancellationToken).FindTrivia(point) 98Dim token = syntaxTree.GetRoot(cancellationToken).FindToken(point, findInsideTrivia:=True)
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (1)
Attributes\AttributeTests.vb (1)
2103Dim expr = tree.GetRoot().DescendantNodes().OfType(Of BinaryExpressionSyntax).First()
Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler (1)
SyntaxHelpers.vb (1)
202Return DirectCast(DirectCast(syntaxTree.GetRoot(), CompilationUnitSyntax).Members.Single(), StatementSyntax)
Microsoft.CodeAnalysis.VisualBasic.Features (14)
ChangeSignature\VisualBasicChangeSignatureService.vb (1)
102Dim token = tree.GetRoot(cancellationToken).FindToken(If(position <> tree.Length, position, Math.Max(0, position - 1)))
Completion\KeywordRecommenders\PreprocessorDirectives\PreprocessorHelpers.vb (1)
30Visit(syntaxTree.GetRoot(cancellationToken))
Debugging\ProximityExpressionsGetter.Worker.vb (1)
27Dim token = _syntaxTree.GetRoot(cancellationToken).FindToken(_position)
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.vb (1)
82Dim root = semanticModel.SyntaxTree.GetRoot(cancellationToken)
DocumentationComments\VisualBasicDocumentationCommentSnippetService.vb (3)
27Return syntaxTree.GetRoot(cancellationToken).FindToken(position).GetContainingMember() 234Return syntaxTree.GetRoot(cancellationToken).FindTokenOnRightOfPosition( 243Return syntaxTree.GetRoot(cancellationToken).FindTokenOnLeftOfPosition(
EditAndContinue\BreakpointSpans.vb (1)
30Dim root = tree.GetRoot(cancellationToken)
ExtractMethod\VisualBasicSelectionValidator.vb (3)
102Dim root = semanticModel.SyntaxTree.GetRoot(cancellationToken) 193semanticModel.SyntaxTree.GetRoot(cancellationToken), GetControlFlowSpan(selectionInfo), cancellationToken) 289Dim root = semanticModel.SyntaxTree.GetRoot(cancellationToken)
NavigationBar\VisualBasicNavigationBarItemService.vb (1)
66nodesToVisit.Push(DirectCast(semanticModel.SyntaxTree.GetRoot(cancellationToken), SyntaxNode))
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicCommonGenerationServiceMethods.vb (1)
14Dim root = semanticModel.SyntaxTree.GetRoot
src\Compilers\VisualBasic\BasicAnalyzerDriver\VisualBasicDeclarationComputer.vb (1)
20ComputeDeclarationsCore(model, model.SyntaxTree.GetRoot(cancellationToken),
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (15)
EditAndContinue\BreakpointSpansTests.vb (1)
74Dim root = tree.GetRoot()
EditAndContinue\Helpers\EditingTestBase.vb (4)
217Dim match = SyntaxComparer.TopLevel.ComputeMatch(tree1.GetRoot(), tree2.GetRoot()) 267Dim root = tree.GetRoot() 271Return SyntaxUtilities.TryGetDeclarationBody(SyntaxFactory.SyntaxTree(declaration).GetRoot())
EditAndContinue\SyntaxUtilitiesTests.vb (6)
15Dim oldRoot = SyntaxFactory.ParseSyntaxTree(oldSource).GetRoot() 16Dim newRoot = SyntaxFactory.ParseSyntaxTree(newSource).GetRoot() 67").GetRoot() 81").GetRoot() 107").GetRoot() 125").GetRoot()
EditAndContinue\VisualBasicEditAndContinueAnalyzerTests.vb (1)
39Dim node = tree.GetRoot().FindToken(expected.Key).Parent
Utils.vb (3)
86Return syntaxTree.GetRoot().DigToFirstNodeOfType(Of T)() 98Return syntaxTree.GetRoot().ChildNodesAndTokens().Where(Function(n) n.IsNode). 105Return syntaxTree.GetRoot().ChildNodesAndTokens().Where(Function(n) n.IsNode).
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (36)
Compilation\SemanticModelAPITests.vb (8)
1039Dim root = tree.GetRoot() 1078Dim root = tree.GetRoot() 1387Dim localDecl = tree.GetRoot().DescendantNodes().OfType(Of LocalDeclarationStatementSyntax)().Single() 2943Dim root = tree.GetRoot() 2984Dim root = tree.GetRoot() 3168For Each name In From x In NameSyntaxFinder.FindNames(tree.GetRoot()) Where x.ToString() = "sv" Select x 3635For Each name In From x In ExpressionSyntaxFinder.FindExpression(tree.GetRoot()) 3824For Each name In SyntaxNodeFinder.FindNodes(tree.GetRoot(), SyntaxKind.DeclareSubStatement)
Compilation\SuppressAccessibilityChecksTests.vb (6)
55Dim invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single() 68Dim invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single() 81Dim invocation = syntaxTree.GetRoot().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single() 188Dim invocation = syntaxTree.GetRoot().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single() 234]]>.Value).GetRoot() 256speculativeModel.SyntaxTree.GetRoot() _
FlowAnalysis\IterationJumpYieldStatementTests.vb (1)
1345Dim foreachBlock = tree.GetRoot.DescendantNodes.OfType(Of ForEachBlockSyntax).Single
Semantics\BinaryOperators.vb (3)
987Dim nodes = (From node In tree.GetRoot().DescendantNodes() 1327Dim nodes = (From node In tree.GetRoot().DescendantNodes() 1422Dim nodes = (From node In tree.GetRoot().DescendantNodes()
Semantics\Conversions.vb (11)
102Dim [nothing] = New BoundLiteral(DirectCast(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), ConstantValue.Nothing, Nothing) 103Dim intZero = New BoundLiteral(DirectCast(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), ConstantValue.Create(0I), m13p(c)) 104Dim longZero = New BoundLiteral(DirectCast(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), ConstantValue.Create(0L), m13p(d)) 271Dim _nothing = New BoundLiteral(DirectCast(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), ConstantValue.Nothing, Nothing) 311literal = New BoundLiteral(DirectCast(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), zero, integralType) 338literal = New BoundConversion(dummyTree.GetVisualBasicRoot(Nothing), New BoundLiteral(DirectCast(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), ConstantValue.Null, Nothing), ConversionKind.WideningNothingLiteral, False, True, zero, convertibleType, Nothing) 369literal = New BoundConversion(dummyTree.GetVisualBasicRoot(Nothing), New BoundLiteral(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), ConstantValue.Null, Nothing), ConversionKind.WideningNothingLiteral, False, True, zero, type1, Nothing) 627New BoundLiteral(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), ConstantValue.Null, Nothing), 751Dim zero = New BoundConversion(dummyTree.GetVisualBasicRoot(Nothing), New BoundLiteral(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), ConstantValue.Null, Nothing), ConversionKind.Widening, True, True, ConstantValue.Default(mv.Type.GetConstantValueTypeDiscriminator()), mv.Type, Nothing) 1121Dim _nothing = New BoundLiteral(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), ConstantValue.Nothing, Nothing) 1188New BoundLiteral(DirectCast(dummyTree.GetRoot(Nothing), VisualBasicSyntaxNode), ConstantValue.Null, Nothing),
Semantics\QueryExpressions_LookupSymbols.vb (1)
764Dim node = tree.GetRoot().DescendantNodes().OfType(Of QueryExpressionSyntax)().First()
Semantics\QueryExpressions_SemanticModel.vb (1)
2963Dim node = tree.GetRoot().DescendantNodes().OfType(Of QueryExpressionSyntax)().First()
Semantics\ScriptSemanticsTests.vb (1)
171Dim node1 = DirectCast(syntaxTree.GetRoot(), CompilationUnitSyntax)
Semantics\SyntaxTreeRootTests.vb (2)
30Assert.Equal(GetType(CompilationUnitSyntax), tree.GetRoot().GetType()) 79Assert.Equal(tree, tree.GetRoot().DescendantNodes().OfType(Of ClassStatementSyntax)().Single().SyntaxTree)
Semantics\UnaryOperators.vb (2)
666Dim nodes = (From node In tree.GetRoot().DescendantNodes() 818Dim node1 = (From node In tree.GetRoot().DescendantNodes()
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (42)
DocumentationComments\DocCommentTests.vb (7)
11911Dim crefs = SyntaxNodeFinder.FindNodes(Of CrefReferenceSyntax)(tree.GetRoot(), SyntaxKind.CrefReference) 11916Return SyntaxNodeFinder.FindNodes(Of CrefReferenceSyntax)(tree.GetRoot(), SyntaxKind.CrefReference) 12089Dim token As SyntaxToken = tree.GetRoot().FindToken(position, True) 12248Dim node1 = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "f").Single() 12254Dim node = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of TypeSyntax)().Where(Function(n) n.ToString() = "Integer").Single() 12308Dim node1 = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "f").Single() 12314Dim node = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of TypeSyntax)().Where(Function(n) n.ToString() = "System.Int32").Single()
SymbolsTests\AnonymousDelegates\AnonymousDelegates_CreationAndEmit.vb (1)
490Dim x = tree.GetRoot().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "x").Single()
SymbolsTests\AnonymousTypes\AnonymousTypesSemanticsTests.vb (32)
109Dim declaratorQ = tree.GetRoot().FindToken(posQ).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)() 116Dim declaratorX = tree.GetRoot().FindToken(posX).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)() 123Dim declaratorZ = tree.GetRoot().FindToken(posZ).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)() 245Dim declaratorW = tree.GetRoot().FindToken(posW).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)() 250Dim declaratorZF = tree.GetRoot().FindToken(posZF).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)() 252tree.GetRoot().FindToken(select1).GetLocation, 255tree.GetRoot().FindToken(x2 - 2).GetLocation(), 256tree.GetRoot().FindToken(y4 - 2).GetLocation()) 260Dim declaratorZL = tree.GetRoot().FindToken(posZL).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)() 262tree.GetRoot().FindToken(select2).GetLocation, 265tree.GetRoot().FindToken(x5 - 2).GetLocation(), 266tree.GetRoot().FindToken(y5 - 2).GetLocation()) 316Dim declaratorT = tree.GetRoot().FindToken(posT).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)() 321Dim declaratorA = tree.GetRoot().FindToken(posA).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)() 323tree.GetRoot().FindToken(sub2).Parent.Parent.GetLocation, 326tree.GetRoot().FindToken(x1 - 2).GetLocation(), 327tree.GetRoot().FindToken(y1 - 2).GetLocation()) 331Dim declaratorB = tree.GetRoot().FindToken(posB).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)() 333tree.GetRoot().FindToken(sub4).Parent.Parent.GetLocation, 336tree.GetRoot().FindToken(x2 - 2).GetLocation(), 337tree.GetRoot().FindToken(y2 - 2).GetLocation()) 383Dim declaratorT = tree.GetRoot().FindToken(posT).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)() 388Dim declaratorA = tree.GetRoot().FindToken(posA).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)() 390tree.GetRoot().FindToken(sub1).Parent.Parent.GetLocation, 393tree.GetRoot().FindToken(x1 - 2).GetLocation(), 394tree.GetRoot().FindToken(y1 - 2).GetLocation()) 398Dim declaratorB = tree.GetRoot().FindToken(posB).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)() 401tree.GetRoot().FindToken(sub2).Parent.Parent.GetLocation, 404tree.GetRoot().FindToken(x2 - 2).GetLocation(), 405tree.GetRoot().FindToken(y2 - 2).GetLocation()) 1982stack.Push(tree.GetRoot()) 2058Dim x = tree.GetRoot().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "x").Single()
SymbolsTests\MyBaseMyClassSemanticsTests.vb (1)
131stack.Push(tree.GetRoot())
SymbolsTests\WithStatementSymbolsTests.vb (1)
284stack.Push(tree.GetRoot())
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (125)
IncrementalParser\IncrementalParser.vb (23)
85root = tree.GetRoot() 96root = tree.GetRoot() 108Assert.Equal(False, tree.GetRoot().ContainsDiagnostics) 710Dim exp1 = newTree.GetRoot().ChildNodesAndTokens()(0).ChildNodesAndTokens()(1) 711Dim inc1 = incTree.GetRoot().ChildNodesAndTokens()(0).ChildNodesAndTokens()(1) 748Assert.Equal(False, oldTree.GetRoot().ContainsDiagnostics) 749Assert.Equal(False, newTree.GetRoot().ContainsDiagnostics) 750Assert.Equal(False, incTree.GetRoot().ContainsDiagnostics) 774Assert.Equal(False, expectedTree.GetRoot().ContainsDiagnostics) 775Assert.Equal(False, incrementalTree.GetRoot().ContainsDiagnostics) 799Assert.Equal(True, expectedTree.GetRoot().ContainsDiagnostics) 800Assert.Equal(True, incrementalTree.GetRoot().ContainsDiagnostics) 1129Dim children1 = newTree.GetRoot().ChildNodesAndTokens() 1130Dim children2 = fulltree.GetRoot().ChildNodesAndTokens() 1146Assert.Equal(fullTree.GetRoot().ToFullString(), newTree.GetRoot().ToFullString()) 1173Assert.Equal(fulltree.GetRoot().ToFullString(), newTree.GetRoot().ToFullString()) 1189Assert.Equal(fullTree.GetRoot().ToFullString(), newTree.GetRoot().ToFullString()) 1711Dim tempRoot2 = tempTree2.GetRoot() 2577Dim rootA = treeA.GetRoot() 2578Dim rootB = treeB.GetRoot()
IncrementalParser\SyntaxDifferences.vb (2)
17GatherNodes(oldTree.GetRoot(), hashSet) 20GetRebuiltNodes(newTree.GetRoot(), hashSet, nodes)
Parser\DeclarationTests.vb (1)
16Assert.False(tree.GetRoot().ContainsDiagnostics)
Parser\ParseAsyncTests.vb (5)
371Dim asyncExpressions = tree.GetRoot().DescendantNodes.OfType(Of AwaitExpressionSyntax).ToArray() 375Dim invocationExpression = tree.GetRoot().DescendantNodes.OfType(Of InvocationExpressionSyntax).ToArray() 379Dim allParsedExpressions = tree.GetRoot().DescendantNodes.OfType(Of ExpressionSyntax)() 436Dim awaitExpressions = tree.GetRoot().DescendantNodes.OfType(Of AwaitExpressionSyntax).ToArray() 440Dim awaitParsedAsIdentifier = tree.GetRoot().DescendantNodes.OfType(Of IdentifierNameSyntax).Where(Function(id) id.Identifier.ValueText.Equals("Await")).ToArray()
Parser\ParseDirectives.vb (2)
1262Dim tk = tree.GetRoot().FindToken(text.IndexOf("class c2", StringComparison.Ordinal)) 1265tk = tree.GetRoot().FindToken(text.IndexOf("class c1", StringComparison.Ordinal))
Parser\ParseErrorTests.vb (4)
4736Assert.Equal(code, tree.GetRoot().ToString()) 4744Assert.Equal(code, tree.GetRoot().ToString()) 4754Assert.Equal(code, tree.GetRoot().ToString()) 4763Dim emptyStatement = tree.GetRoot().DescendantNodes().OfType(Of EmptyStatementSyntax).Single()
Parser\ParseExpression.vb (4)
2249Dim nodes = tree.GetRoot().DescendantNodes().ToArray() 2266Dim nodes = tree.GetRoot().DescendantNodes().ToArray() 2283Dim nodes = tree.GetRoot().DescendantNodes().ToArray() 2301Dim nodes = tree.GetRoot().DescendantNodes().ToArray()
Parser\ParseIteratorTests.vb (5)
152Dim yieldStatements = tree.GetRoot().DescendantNodes.OfType(Of YieldStatementSyntax)().ToArray() 156Dim methodSyntaxList = tree.GetRoot().DescendantNodes.OfType(Of MethodBlockBaseSyntax)().ToArray() 224Dim yieldStatements = tree.GetRoot().DescendantNodes.OfType(Of YieldStatementSyntax)().ToArray() 362Dim actual = From expression In tree.GetRoot().DescendantNodes() 409Dim yieldStatements = tree.GetRoot().DescendantNodes.OfType(Of YieldStatementSyntax).ToArray()
Parser\ParseStatements.vb (3)
4359Dim tokens = tree.GetRoot().DescendantTokens().ToArray() 7875Dim root = tree.GetRoot() 7902Dim root = tree.GetRoot()
Parser\ParseXml.vb (1)
1916Assert.Equal(code, tree.GetRoot().ToString())
Scanner\XmlScannerTests.vb (1)
375Dim eof = tree.GetRoot().ChildTokens.Single()
Syntax\ManualTests.vb (2)
115Dim node = VisualBasicSyntaxTree.ParseText(" ").GetRoot() 227Dim token = tree.GetRoot().FindToken(text.Lines.Item(3).Start)
Syntax\SyntaxAnnotationTests.vb (33)
46Dim fromNode = VisualBasicSyntaxTree.ParseText(_helloWorldCode).GetRoot() 54Dim fromNode = VisualBasicSyntaxTree.ParseText(_helloWorldCode).GetRoot() 55Dim toNode = VisualBasicSyntaxTree.ParseText(_helloWorldCode).GetRoot() 64Dim toToken = VisualBasicSyntaxTree.ParseText(_helloWorldCode).GetRoot().DescendantTokens().First() 71Dim fromToken = VisualBasicSyntaxTree.ParseText(_helloWorldCode).GetRoot().DescendantTokens().First() 79Dim fromToken = VisualBasicSyntaxTree.ParseText(_helloWorldCode).GetRoot().DescendantTokens().First() 80Dim toToken = VisualBasicSyntaxTree.ParseText(_helloWorldCode).GetRoot().DescendantTokens().First() 90Dim toTrivia = GetAllTrivia(tree.GetRoot()).FirstOrDefault() 99Dim fromTrivia = GetAllTrivia(tree.GetRoot()).FirstOrDefault() 107Dim fromTrivia = GetAllTrivia(tree.GetRoot()).FirstOrDefault() 108Dim toTrivia = GetAllTrivia(tree.GetRoot()).FirstOrDefault() 123Dim matchingNodesOrTokens = tree.GetRoot().GetAnnotatedNodesAndTokens(annotation) 132Dim matchingTrivia = tree.GetRoot().GetAnnotatedTrivia(annotation) 147Dim node = GetAllNodesAndTokens(tree.GetRoot()).First(Function(t) t.IsNode).AsNode() 151Dim newRoot = tree.GetRoot().ReplaceNode(node, annotatedNode) 178Dim token = GetAllNodesAndTokens(tree.GetRoot()).First(Function(t) t.IsToken).AsToken() 182Dim newRoot = tree.GetRoot().ReplaceToken(token, annotatedToken) 209Dim trivia = GetAllTrivia(tree.GetRoot()).First() 213Dim newRoot = tree.GetRoot().ReplaceTrivia(trivia, annotatedTrivia) 236Dim newRoot = tree.GetRoot() 249TestMultipleAnnotationsInTree(tree.GetRoot(), newRoot, annotations) 266Dim firstNode = GetAllNodesAndTokens(tree.GetRoot()).First(Function(t) t.IsNode).AsNode() 271Dim newRoot = tree.GetRoot().ReplaceNode(lastChildOfFirstNode, annotatedNode) 361Dim sourceTreeRoot = DirectCast(rewriter.Visit(tree1.GetRoot()), VisualBasicSyntaxNode) 363Dim destTreeRoot = CopyAnnotationsTo(sourceTreeRoot, tree2.GetRoot()) 438Dim currentRoot = tree.GetRoot() 467Dim candidatePool = GetAllNodesAndTokens(tree.GetRoot()) 477Dim newRoot = Replace(tree.GetRoot(), firstItem, firstAnnotated) 519For Each trivia In GetAllTrivia(tree.GetRoot()) 522Dim newRoot = tree.GetRoot().ReplaceTrivia(trivia, newTrivia) 531For Each nodeOrToken In GetAllNodesAndTokens(tree.GetRoot()) 537newRoot = tree.GetRoot().ReplaceToken(nodeOrToken.AsToken(), newToken) 540newRoot = tree.GetRoot().ReplaceNode(nodeOrToken.AsNode(), newNode)
Syntax\SyntaxListTests.vb (2)
261Dim node = tree.GetRoot().DescendantNodes().OfType(Of CollectionInitializerSyntax)().First() 287Dim node = tree.GetRoot().DescendantNodes().OfType(Of CollectionInitializerSyntax)().First()
Syntax\SyntaxRewriterTests.vb (11)
479Assert.Same(expression, tree.GetRoot()) 498Dim oldRoot = oldTree.GetRoot() 531Dim root = tree.GetRoot() 550Dim root = tree.GetRoot() 569Dim root = tree.GetRoot() 594Dim root = tree.GetRoot() 612Dim root = tree.GetRoot() 636Dim field = tree.GetRoot().DescendantNodes().OfType(Of FieldDeclarationSyntax).Single() 663Dim field = tree.GetRoot().DescendantNodes().OfType(Of FieldDeclarationSyntax).Single() 685Dim root = tree.GetRoot() 698Dim root = tree.GetRoot()
Syntax\SyntaxSubmissionsTests.vb (1)
15Dim compilation = DirectCast(tree.GetRoot(), CompilationUnitSyntax)
Syntax\SyntaxTreeTests.vb (4)
116Assert.Equal(newRoot.ToString(), newTree.GetRoot().ToString()) 133Assert.Equal(newRoot.ToString(), newTree.GetRoot().ToString()) 146Assert.Equal(newRoot.ToString(), newTree.GetRoot().ToString()) 193Assert.Equal(String.Empty, VisualBasicSyntaxTree.Create(CType(oldTree.GetRoot, VisualBasicSyntaxNode), path:=Nothing).FilePath)
TestSyntaxNodes.vb (21)
1734Dim node As SyntaxNode = tree.GetRoot() 1736Assert.Equal(0, tree.GetRoot().FindToken(node.FullSpan.Length - 1).TrailingTrivia.Count) 1737Assert.Equal(1, tree.GetRoot().FindToken(0).LeadingTrivia.Count) 1764Dim node As SyntaxNode = tree.GetRoot() 1985Dim openParenToken = CType(tree.GetRoot().FindToken(location + "List".Length), SyntaxToken) 2214Dim tokens As List(Of SyntaxToken) = tree.GetRoot().DescendantTokens().ToList() 2216Dim token As SyntaxToken = tree.GetRoot().GetFirstToken() 2231token = tree.GetRoot().GetFirstToken() 2238Dim lastToken = tree.GetRoot().DescendantTokens().Last 2255Dim root = tree.GetRoot() 2352Dim trivia = tree.GetRoot().FindTrivia(position) 2839Dim Root As CompilationUnitSyntax = CType(tree.GetRoot(), CompilationUnitSyntax) 2885Dim Root As CompilationUnitSyntax = CType(tree.GetRoot(), CompilationUnitSyntax) 2930For Each node In tree.GetRoot.ChildNodes 3265Dim Root As CompilationUnitSyntax = CType(tree.GetRoot(), CompilationUnitSyntax) 3339Dim Root As CompilationUnitSyntax = CType(tree.GetRoot(), CompilationUnitSyntax) 3365Dim Root As CompilationUnitSyntax = CType(tree.GetRoot(), CompilationUnitSyntax) 3389Dim Root As CompilationUnitSyntax = CType(tree.GetRoot(), CompilationUnitSyntax) 3410Dim trivia = tree.GetRoot().FindTrivia(4000) 3433Dim Root As CompilationUnitSyntax = CType(tree.GetRoot(), CompilationUnitSyntax) 3452Dim Root As CompilationUnitSyntax = CType(tree.GetRoot(), CompilationUnitSyntax)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (21)
CompilationTestUtils.vb (2)
661Dim node = tree.GetRoot().FindToken(position) 1139node = tree.GetRoot().FindToken(pos).Parent
ParserTestUtilities.vb (18)
80Dim root = tree.GetRoot() 114Dim root = tree.GetRoot() 225Dim incTreeRoot = oldTree.GetRoot() 227Dim newTreeRoot = newTree.GetRoot() 229incTreeRoot = incTree.GetRoot() 246VerifyParents(oldTree.GetRoot()) 247VerifyParents(newTree.GetRoot()) 248VerifyParents(incTree.GetRoot()) 295VerifySyntaxKinds(tree.GetRoot(), expected) 319GetOccurrenceCount(kind, tree.GetRoot(), actualCount) 326InternalTraverseAllNodes(tree.GetRoot()) 336If TryFindNodeOrToken(tree.GetRoot(), kind, occurrence, foundNode) Then 371InternalVerifyNoWhitespaceInKeywords(tree.GetRoot()) 377Dim node = tree.GetRoot() 387Dim node = tree.GetRoot() 397Dim node = tree.GetRoot() 439For Each child In tree.GetRoot().ChildNodesAndTokens() 447Dim node = tree.GetRoot()
SyntaxTreeExtensions.vb (1)
69Return node.GetRoot().Dump()
Microsoft.CodeAnalysis.VisualBasic.Workspaces (16)
Rename\VisualBasicRenameRewriterLanguageService.vb (5)
190Dim speculativeTree = originalNode.SyntaxTree.GetRoot(_cancellationToken).ReplaceNode(originalNode, newNode) 198newNode = Me._speculativeModel.SyntaxTree.GetRoot(_cancellationToken).GetAnnotatedNodes(Of SyntaxNode)(annotation).First() 212speculativeTree = originalNode.SyntaxTree.GetRoot(_cancellationToken).ReplaceNode(originalNode, expandedNewNode) 222probableRenameNode = Me._speculativeModel.SyntaxTree.GetRoot(_cancellationToken).GetAnnotatedNodes(Of SyntaxNode)(annotation).First() 223speculativeNewNode = Me._speculativeModel.SyntaxTree.GetRoot(_cancellationToken).GetAnnotatedNodes(Of SyntaxNode)(annotationForSpeculativeNode).First()
Simplification\VisualBasicSimplificationService.vb (2)
128nodeToSpeculate = speculativeModel.SyntaxTree.GetRoot() 165Dim root = model.SyntaxTree.GetRoot(cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\DirectiveSyntaxExtensions.vb (1)
39Return GetDirectiveInfo(syntaxTree.GetRoot(cancellationToken), cancellationToken).DirectiveMap.Keys.Where(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (1)
750Return tree.GetRoot().ReplaceNode(oldBlock, newBlock)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb (4)
122Return FindTriviaToLeft(syntaxTree.GetRoot(cancellationToken), position) 305Dim compilationUnit = TryCast(syntaxTree.GetRoot(cancellationToken), CompilationUnitSyntax) 353directive.FullSpan.End = syntaxTree.GetRoot(cancellationToken).FullSpan.End 359Dim token = syntaxTree.GetRoot(cancellationToken).FindToken(line.Start)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Helpers\RemoveUnnecessaryImports\VisualBasicUnnecessaryImportsProvider.vb (2)
30Dim root = model.SyntaxTree.GetRoot(cancellationToken) 73Dim root = DirectCast(model.SyntaxTree.GetRoot(cancellationToken), CompilationUnitSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTreeExtensions.vb (1)
107Dim token = syntaxTree.GetRoot(cancellationToken).FindToken(position)
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (7)
CodeGeneration\SyntaxGeneratorTests.vb (1)
1108Dim node = tree.GetRoot().DescendantNodes().First()
Formatting\VisualBasicFormattingTestBase.vb (3)
65spans.Add(syntaxTree.GetRoot().FullSpan) 74spans.Add(syntaxTree.GetRoot().FullSpan) 80AssertFormatWithTransformation(workspace.Services.SolutionServices, expected, syntaxTree.GetRoot(), spans, options, False)
VisualBasicSyntaxFactsServiceTests.vb (3)
510Dim node = tree.GetRoot().FindNode(span) 528Dim token = tree.GetRoot().FindToken(position) 544Dim node = tree.GetRoot().FindToken(position).Parent
Microsoft.CodeAnalysis.Workspaces (31)
Classification\Classifier.cs (1)
90var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
Classification\SyntaxClassification\AbstractSyntaxClassificationService.Worker.cs (1)
65var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
Editing\DocumentEditor.cs (1)
36var root = model.SyntaxTree.GetRoot(cancellationToken);
Editing\SymbolEditor.cs (2)
298var newDeclaration = model.SyntaxTree.GetRoot(cancellationToken).GetCurrentNode(declaration); 489var newDeclaration = model.SyntaxTree.GetRoot(cancellationToken).GetCurrentNode(decl);
FindSymbols\TopLevelSyntaxTree\DeclaredSymbolInfo.cs (1)
223var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
Rename\RenameUtilities.cs (1)
47var bindableToken = semanticModel.SyntaxTree.GetRoot(cancellationToken).FindToken(position, findInsideTrivia: true);
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (1)
120var root = tree.GetRoot(cancellationToken);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
22var root = tree.GetRoot();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (4)
20=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindToken(location.SourceSpan.Start); 23=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan); 26=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: getInnermostNodeForTie); 29=> location.GetSourceTreeOrThrow().GetRoot(cancellationToken).FindNode(location.SourceSpan, findInsideTrivia, getInnermostNodeForTie);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
95? ((ICompilationUnitSyntax)token.Parent!.SyntaxTree!.GetRoot(CancellationToken.None)).EndOfFileToken
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (6)
122var root = syntaxTree.GetRoot(cancellationToken); 133var root = syntaxTree.GetRoot(cancellationToken); 170var root = syntaxTree.GetRoot(cancellationToken); 208return syntaxTree.GetRoot(cancellationToken).FindTokenOnRightOfPosition( 223return syntaxTree.GetRoot(cancellationToken).FindTokenOnLeftOfPosition( 251var root = syntaxTree.GetRoot(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (3)
51var operation = GetIndentationDataFor(tree.GetRoot(cancellationToken), token, position); 102tree.GetRoot(cancellationToken), 167baseToken = baseToken.SyntaxTree.GetRoot(cancellationToken).FindToken(textLine.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
55Root = (TSyntaxRoot)tree.GetRoot(cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SyntaxPath.cs (1)
139return TryResolve(syntaxTree.GetRoot(cancellationToken), out node);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (1)
527var root = attributeToRemove.SyntaxTree.GetRoot();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
53var root = SyntaxTree.WithChangedText(text).GetRoot(cancellationToken);
Workspace\Solution\Document.cs (2)
166/// to <see cref="SyntaxTree.GetRoot"/> or <see cref="SyntaxTree.GetRootAsync"/> may end up causing computation 251return tree.GetRoot(cancellationToken);
Workspace\Solution\DocumentState.cs (2)
695var newTreeContent = newTree.GetRoot().ToFullString(); 698var oldTreeContent = oldTree?.GetRoot().ToFullString();
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (3)
VisualStudioMSBuildWorkspaceTests.cs (3)
62var type = tree.GetRoot().DescendantTokens().First(t => t.ToString() == "class").Parent; 440var type = tree.GetRoot().DescendantTokens().First(t => t.ToString() == "class").Parent; 2848var type = tree.GetRoot().DescendantTokens().First(t => t.ToString() == "class").Parent;
Microsoft.CodeAnalysis.Workspaces.UnitTests (41)
FindReferencesTests.cs (4)
183SyntaxNode declareMethod = tree.GetRoot().DescendantNodes().OfType<Microsoft.CodeAnalysis.VisualBasic.Syntax.DeclareStatementSyntax>().FirstOrDefault(); 184SyntaxNode normalMethod = tree.GetRoot().DescendantNodes().OfType<Microsoft.CodeAnalysis.VisualBasic.Syntax.MethodStatementSyntax>().ToList()[1]; 222var propertyStatement = tree.GetRoot().DescendantNodes().OfType<Microsoft.CodeAnalysis.VisualBasic.Syntax.PropertyStatementSyntax>().FirstOrDefault(); 286var methodlist = tree.GetRoot().DescendantNodes().OfType<Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax>().ToList();
FormattingTests.cs (1)
86var formattedRoot = Formatter.Format(tree.GetRoot(), workspace.Services.SolutionServices, options, CancellationToken.None);
SolutionTests\SolutionTests.cs (14)
307var root = tree.GetRoot(); 2483var root = CSharp.SyntaxFactory.ParseSyntaxTree(SourceText.From("class C {}", encoding: null, SourceHashAlgorithm.Sha1)).GetRoot(); 3188var root = tree.GetRoot(); 3196var root2 = tree2.GetRoot(); 3402Assert.Equal(text, docTree.GetRoot().ToString()); 3423Assert.Equal(text, docTree.GetRoot().ToString()); 3432var tree = CSharp.SyntaxFactory.ParseSyntaxTree("public class C {}").GetRoot(CancellationToken.None); 3687var root = tree.GetRoot(); 3704var root2 = tree2.GetRoot(); 3783Assert.Same(tree2, tree2.GetRoot().SyntaxTree); 3811Assert.Same(tree3, tree3.GetRoot().SyntaxTree); 3818var tree4 = tree.WithRootAndOptions(tree.GetRoot(), newOptions); 3822Assert.Same(tree4, tree4.GetRoot().SyntaxTree); 3829Assert.Same(tree, tree.WithRootAndOptions(tree.GetRoot(), tree.Options));
SymbolKeyTests.cs (5)
620var symbols = tree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.InvocationExpressionSyntax>().Select(s => model.GetSymbolInfo(s).Symbol).ToList(); 656var symbols = tree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.InvocationExpressionSyntax>().Select(s => model.GetSymbolInfo(s).GetAnySymbol()).ToList(); 679var symbols = tree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.UsingDirectiveSyntax>().Select(s => model.GetDeclaredSymbol(s)).ToList(); 1274var root = tree.GetRoot(); 1497GetAllSymbols(model, model.SyntaxTree.GetRoot(), list, predicate);
SyntaxNodeTests.cs (2)
30var root = tree.GetRoot(); 51var root = tree.GetRoot();
SyntaxPathTests.cs (12)
81var root = tree.GetRoot(); 106var root = tree.GetRoot(); 120var root = tree.GetRoot(); 147var namespaceDecl = (NamespaceDeclarationSyntax)(tree.GetRoot() as CompilationUnitSyntax).Members[0]; 185var namespaceDecl = (NamespaceDeclarationSyntax)(tree.GetRoot() as CompilationUnitSyntax).Members[0]; 218var namespaceDecl = (NamespaceDeclarationSyntax)((CompilationUnitSyntax)tree.GetRoot()).Members[0]; 250var namespaceDecl = (NamespaceDeclarationSyntax)((CompilationUnitSyntax)tree.GetRoot()).Members[0]; 278var namespaceDecl = (NamespaceDeclarationSyntax)((CompilationUnitSyntax)tree.GetRoot()).Members[0]; 309var namespaceDecl = (NamespaceDeclarationSyntax)((CompilationUnitSyntax)tree.GetRoot()).Members[0]; 338var namespaceDecl = (NamespaceDeclarationSyntax)((CompilationUnitSyntax)tree.GetRoot()).Members[0]; 377var namespaceDecl = (NamespaceDeclarationSyntax)((CompilationUnitSyntax)tree.GetRoot()).Members[0]; 399var root = (CompilationUnitSyntax)tree.GetRoot();
UtilityTest\FormattingRangeHelperTests.cs (3)
19var root = SyntaxFactory.ParseSyntaxTree("{Foo();}").GetRoot(); 29var root = SyntaxFactory.ParseSyntaxTree("{Fizz();\nBuzz();}").GetRoot(); 39var token = SyntaxFactory.ParseSyntaxTree("else\nFoo();").GetRoot().GetFirstToken();
Microsoft.DotNet.GenFacades (1)
NotSupportedAssemblyGenerator.cs (1)
88SyntaxNode root = rewriter.Visit(syntaxTree.GetRoot());
Microsoft.Extensions.Logging.Generators (3)
src\libraries\Common\src\Roslyn\SyntaxValueProvider_ForAttributeWithSimpleName.cs (3)
108.Select((info, cancellationToken) => getGlobalAliasesInCompilationUnit(info.Tree.GetRoot(cancellationToken))) 180var root = tree.GetRoot(cancellationToken); 197var compilationUnit = syntaxTree.GetRoot(cancellationToken);
Microsoft.Gen.ContextualOptions.Unit.Tests (4)
EmitterTests.cs (4)
38syntaxTree.GetRoot().DescendantNodes().OfType<StructDeclarationSyntax>().Single().Members.Single().Modifiers, 62.GetRoot() 91.GetRoot() 119.GetRoot()
Microsoft.Interop.LibraryImportGenerator (1)
Analyzers\ShapeBreakingDiagnosticSuppressor.cs (1)
36ISymbol diagnosedSymbol = model.GetDeclaredSymbol(diagnostic.Location.SourceTree.GetRoot(context.CancellationToken).FindNode(diagnostic.Location.SourceSpan), context.CancellationToken);
Microsoft.ML.CodeGenerator (1)
Utils.cs (1)
188var syntaxNode = tree.GetRoot();
Microsoft.ML.InternalCodeAnalyzer (2)
BestFriendAnalyzer.cs (1)
66foreach (var node in model.SyntaxTree.GetRoot().DescendantNodes(n => !n.IsKind(SyntaxKind.UsingDirective)))
RelaxTestNamingSuppressor.cs (1)
41var root = tree.GetRoot(context.CancellationToken);
Microsoft.VisualStudio.LanguageServices (2)
Venus\ContainedLanguageCodeSupport.cs (2)
211var destinationType = syntaxFacts.GetContainingTypeDeclaration(targetSyntaxTree.GetRoot(cancellationToken), position); 224var newRoot = targetSyntaxTree.GetRoot(cancellationToken).ReplaceNode(destinationType, newType);
Microsoft.VisualStudio.LanguageServices.UnitTests (1)
CodeModel\CSharp\SyntaxNodeKeyTests.vb (1)
241Dim node = tree.GetRoot().FindToken(cursorPosition).Parent
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)
Help\VisualBasicHelpContextService.vb (2)
41Dim token = tree.GetRoot(cancellationToken).FindToken(span.Start, findInsideTrivia:=True) 53Dim trivia = tree.GetRoot(cancellationToken).FindTrivia(span.Start, findInsideTrivia:=True)
Mvc.Api.Analyzers.Test (4)
ActualApiResponseMetadataFactoryTest.cs (4)
77var methodSyntax = syntaxTree.GetRoot().FindNode(method.Locations[0].SourceSpan); 374var methodSyntax = (MethodDeclarationSyntax)syntaxTree.GetRoot().FindNode(method.Locations[0].SourceSpan); 394var methodSyntax = syntaxTree.GetRoot().FindNode(method.Locations[0].SourceSpan); 413var methodSyntax = syntaxTree.GetRoot().FindNode(method.Locations[0].SourceSpan);
System.Text.Json.SourceGeneration (3)
src\libraries\Common\src\Roslyn\SyntaxValueProvider_ForAttributeWithSimpleName.cs (3)
108.Select((info, cancellationToken) => getGlobalAliasesInCompilationUnit(info.Tree.GetRoot(cancellationToken))) 180var root = tree.GetRoot(cancellationToken); 197var compilationUnit = syntaxTree.GetRoot(cancellationToken);