3005 references to GetRoot
IdeCoreBenchmarks (2)
SyntacticChangeRangeBenchmark.cs (2)
56
var newRoot = newTree.
GetRoot
();
65
var newRoot = newTree.
GetRoot
();
Microsoft.CodeAnalysis (19)
Compilation\Compilation.cs (1)
2447
diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_EncodinglessSyntaxTree, tree.
GetRoot
().GetLocation()));
DiagnosticAnalyzer\AnalyzerDriver.cs (3)
1188
for (var node = location.SourceTree.
GetRoot
(cancellationToken).FindNode(location.SourceSpan, getInnermostNodeForTie: true);
1243
walker.Visit(tree.
GetRoot
(cancellationToken));
1250
var root = tree.
GetRoot
(cancellationToken);
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (1)
162
for (var node = location.SourceTree.
GetRoot
().FindNode(location.SourceSpan, getInnermostNodeForTie: true);
InternalUtilities\GeneratedCodeUtilities.cs (1)
120
var root = tree.
GetRoot
(cancellationToken);
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithSimpleName.cs (2)
72
.Select((info, cancellationToken) => getGlobalAliasesInCompilationUnit(syntaxHelper, info.Tree.
GetRoot
(cancellationToken)))
160
var compilationUnit = syntaxTree.
GetRoot
(cancellationToken);
SourceGeneration\SyntaxStore.cs (1)
89
var 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)
39
var syntaxRoot = (SyntaxNodeOrToken)syntaxTree.
GetRoot
();
Syntax\SyntaxDiffer.cs (4)
53
return GetTextChanges(before.
GetRoot
(), after.
GetRoot
());
89
return GetPossiblyDifferentTextSpans(before.
GetRoot
(), after.
GetRoot
());
Syntax\SyntaxNode.cs (1)
971
SyntaxNode? cuRoot = node.SyntaxTree?.
GetRoot
();
Syntax\SyntaxNodeExtensions.cs (1)
436
return node != null ? oldTree.WithRootAndOptions(node, oldTree.Options).
GetRoot
() : null;
Syntax\SyntaxTree.cs (1)
415
var root = this.
GetRoot
(cancellationToken);
Syntax\SyntaxTreeExtensions.cs (1)
22
var root = tree.
GetRoot
();
Microsoft.CodeAnalysis.CodeStyle (28)
AbstractAddAccessibilityModifiersDiagnosticAnalyzer.cs (1)
39
ProcessCompilationUnit(context, option, (TCompilationUnitSyntax)context.Tree.
GetRoot
(context.CancellationToken));
AbstractConsecutiveStatementPlacementDiagnosticAnalyzer.cs (1)
46
var root = context.Tree.
GetRoot
(cancellationToken);
AbstractFileHeaderDiagnosticAnalyzer.cs (1)
44
var root = tree.
GetRoot
(context.CancellationToken);
AbstractIndentation.Indenter.cs (1)
55
Root = (TSyntaxRoot)tree.
GetRoot
(cancellationToken);
AbstractMatchFolderAndNamespaceDiagnosticAnalyzer.cs (1)
93
var root = namespaceDeclaration.SyntaxTree.
GetRoot
(cancellationToken);
AbstractMultipleBlankLinesDiagnosticAnalyzer.cs (1)
42
var root = context.Tree.
GetRoot
(cancellationToken);
AbstractOrderModifiersDiagnosticAnalyzer.cs (1)
49
var root = context.Tree.
GetRoot
(context.CancellationToken);
AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
125
var root = tree.
GetRoot
(cancellationToken);
AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
539
foreach (var root in namedTypeSymbol.Locations.Select(l => l.SourceTree.
GetRoot
(cancellationToken)))
BottomUpBaseIndentationFinder.cs (3)
51
var operation = GetIndentationDataFor(tree.
GetRoot
(cancellationToken), token, position);
102
tree.
GetRoot
(cancellationToken),
167
baseToken = baseToken.SyntaxTree.
GetRoot
(cancellationToken).FindToken(textLine.Start);
FormattingAnalyzerHelper.cs (1)
25
var formattingChanges = Formatter.GetFormattedTextChanges(tree.
GetRoot
(cancellationToken), formattingProvider, options, cancellationToken);
GeneratedCodeUtilities.cs (1)
120
var root = tree.
GetRoot
(cancellationToken);
J\s\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (1)
22
var root = tree.
GetRoot
();
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (5)
122
var root = syntaxTree.
GetRoot
(cancellationToken);
133
var root = syntaxTree.
GetRoot
(cancellationToken);
170
var root = syntaxTree.
GetRoot
(cancellationToken);
208
return syntaxTree.
GetRoot
(cancellationToken).FindTokenOnRightOfPosition(
223
return syntaxTree.
GetRoot
(cancellationToken).FindTokenOnLeftOfPosition(
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);
SymbolKey.AliasSymbolKey.cs (1)
44
var result = Resolve(semanticModel, syntaxTree.
GetRoot
(reader.CancellationToken), name, target, reader.CancellationToken);
SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
54
var root = syntaxTree.
GetRoot
(reader.CancellationToken);
SyntaxPath.cs (1)
139
return TryResolve(syntaxTree.
GetRoot
(cancellationToken), out node);
SyntaxTokenExtensions.cs (1)
95
? ((ICompilationUnitSyntax)token.Parent!.SyntaxTree!.
GetRoot
(CancellationToken.None)).EndOfFileToken
Microsoft.CodeAnalysis.CodeStyle.Fixes (2)
AbstractCodeGenerationService.cs (1)
527
var root = attributeToRemove.SyntaxTree.
GetRoot
();
ParsedDocument.cs (1)
52
var root = SyntaxTree.WithChangedText(text).
GetRoot
(cancellationToken);
Microsoft.CodeAnalysis.CSharp (39)
Binder\BinderFactory.BinderFactoryVisitor.cs (3)
105
if (compilationUnit != syntaxTree.
GetRoot
())
917
if (compilationUnit != syntaxTree.
GetRoot
())
1049
Debug.Assert(token == this.syntaxTree.
GetRoot
().GetLastToken());
Binder\InMethodBinder.cs (1)
248
Debug.Assert(oldLocation != newLocation || oldLocation == Location.None || newLocation.SourceTree?.
GetRoot
().ContainsDiagnostics == true,
CommandLine\CSharpCompiler.cs (1)
349
foreach (LineDirectiveTriviaSyntax directive in tree.
GetRoot
().GetDirectives(
Compilation\CSharpCompilation.cs (6)
1513
return ((SourceNamespaceSymbol)SourceModule.GlobalNamespace).GetImports((CSharpSyntaxNode)tree.
GetRoot
(), basesBeingResolved: null);
2419
var node = info.Tree.
GetRoot
(cancellationToken).FindToken(info.Span.Start, findInsideTrivia: false).
2827
bool reportUnusedUsings = (!span.HasValue || span.Value == tree.
GetRoot
(cancellationToken).FullSpan) && ReportUnusedImportsInTree(tree);
2959
var root = syntaxTree.
GetRoot
(cancellationToken);
3362
CSharpSyntaxTree.Dummy.
GetRoot
(),
3495
var checksumDirectives = tree.
GetRoot
().GetDirectives(d => d.Kind() == SyntaxKind.PragmaChecksumDirectiveTrivia &&
Compilation\CSharpSemanticModel.cs (2)
1276
bool atEOF = position == fullEnd && position == this.SyntaxTree.
GetRoot
().FullSpan.End;
1280
token = (atEOF ? (CSharpSyntaxNode)this.SyntaxTree.
GetRoot
() : Root).FindTokenIncludingCrefAndNameAttributes(position);
Compilation\SpeculativeSemanticModelWithMemberModel.cs (1)
58
var attributedNode = model.SyntaxTree.
GetRoot
().FindToken(position).Parent;
Compilation\SyntaxTreeSemanticModel.cs (1)
79
return (CSharpSyntaxNode)_syntaxTree.
GetRoot
();
Compiler\UnprocessedDocumentationCommentFinder.cs (1)
34
finder.Visit(tree.
GetRoot
(cancellationToken));
CSharpDeclarationComputer.cs (1)
29
ComputeDeclarations(model, associatedSymbol: null, model.SyntaxTree.
GetRoot
(cancellationToken),
CSharpExtensions.cs (1)
397
return (CompilationUnitSyntax)tree.
GetRoot
(cancellationToken);
Declarations\DeclarationTreeBuilder.cs (1)
45
return (RootSingleNamespaceDeclaration)builder.Visit(syntaxTree.
GetRoot
());
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (3)
51
var token = semanticModelOpt.SyntaxTree.
GetRoot
().FindToken(positionOpt);
188
var token = semanticModel.SyntaxTree.
GetRoot
().FindToken(position);
228
var token = location.SourceTree.
GetRoot
().FindToken(positionOpt);
Symbols\MethodSymbolExtensions.cs (1)
213
return (CSharpSyntaxNode)CSharpSyntaxTree.Dummy.
GetRoot
();
Symbols\RangeVariableSymbol.cs (1)
64
SyntaxToken token = (SyntaxToken)_locations[0].SourceTree.
GetRoot
().FindToken(_locations[0].SourceSpan.Start);
Symbols\ReducedExtensionMethodSymbol.cs (1)
135
var syntax = (CSharpSyntaxNode)syntaxTree.
GetRoot
();
Symbols\Source\SourceAssemblySymbol.cs (1)
1550
var root = (CompilationUnitSyntax)tree.
GetRoot
();
Symbols\Source\SourceMethodSymbolWithAttributes.cs (1)
945
if (ReferenceEquals(returnTypeSyntax, CSharpSyntaxTree.Dummy.
GetRoot
()))
Symbols\Symbol.cs (2)
381
SyntaxToken token = location.SourceTree.
GetRoot
().FindToken(location.SourceSpan.Start);
397
SyntaxNode parent = location.SourceTree.
GetRoot
();
Symbols\SymbolExtensions.cs (1)
374
return (CSharpSyntaxNode)CSharpSyntaxTree.Dummy.
GetRoot
();
Symbols\Synthesized\SynthesizedEntryPointSymbol.cs (1)
288
return (CSharpSyntaxNode)syntaxTree.
GetRoot
();
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (1)
267
foreach (var global in ((CompilationUnitSyntax)tree.
GetRoot
(cancellationToken)).Members.OfType<GlobalStatementSyntax>())
Syntax\CSharpPragmaWarningStateMap.cs (1)
60
foreach (var d in syntaxTree.
GetRoot
().GetDirectives())
Syntax\CSharpSyntaxTree.LazySyntaxTree.cs (1)
71
var root = CloneNodeAsRoot((CSharpSyntaxNode)tree.
GetRoot
(cancellationToken));
Syntax\NullableContextStateMap.cs (1)
141
foreach (var d in tree.
GetRoot
().GetDirectives())
Syntax\SyntaxEquivalence.cs (2)
27
return AreEquivalent(before.
GetRoot
(), after.
GetRoot
(), ignoreChildNode, topLevel);
Syntax\SyntaxFactory.cs (1)
2319
var compilation = (CompilationUnitSyntax)tree.
GetRoot
();
Syntax\SyntaxTreeDiagnosticEnumerator.cs (1)
62
var length = _syntaxTree.
GetRoot
().FullSpan.Length;
Microsoft.CodeAnalysis.CSharp.CodeStyle (19)
ArrowExpressionClausePlacementDiagnosticAnalyzer.cs (1)
39
Recurse(context, option.Notification.Severity, context.Tree.
GetRoot
(context.CancellationToken));
ConditionalExpressionPlacementDiagnosticAnalyzer.cs (1)
40
Recurse(context, option.Notification.Severity, context.Tree.
GetRoot
(context.CancellationToken));
ConsecutiveBracePlacementDiagnosticAnalyzer.cs (1)
49
var root = tree.
GetRoot
(cancellationToken);
ConstructorInitializerPlacementDiagnosticAnalyzer.cs (1)
41
Recurse(context, option.Notification.Severity, context.Tree.
GetRoot
(context.CancellationToken));
ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
38
var root = (CompilationUnitSyntax)syntaxTree.
GetRoot
(cancellationToken);
CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
56
var root = semanticModel.SyntaxTree.
GetRoot
(cancellationToken);
CSharpSyntaxFacts.cs (1)
1096
var trivia = syntaxTree.
GetRoot
(cancellationToken).FindTrivia(position, findInsideTrivia: false);
CSharpUnnecessaryImportsProvider.cs (1)
28
var root = model.SyntaxTree.
GetRoot
(cancellationToken);
CSharpUseImplicitTypeHelper.cs (2)
191
var root = tree.
GetRoot
(cancellationToken);
204
var newDeclarationTypeNode = newTree.
GetRoot
(cancellationToken).GetAnnotatedNodes(annotation).Single();
EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
40
Recurse(context, option.Notification.Severity, context.Tree.
GetRoot
(context.CancellationToken));
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (1)
37
directive.FullSpan.End == syntaxTree.
GetRoot
(cancellationToken).FullSpan.End;
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (5)
221
var root = (CompilationUnitSyntax)syntaxTree.
GetRoot
(cancellationToken);
265
var trivia = syntaxTree.
GetRoot
(cancellationToken).FindTrivia(position);
418
var token = syntaxTree.
GetRoot
(cancellationToken).FindToken(position, findInsideTrivia: true);
461
var root = (CompilationUnitSyntax)syntaxTree.
GetRoot
(cancellationToken);
513
var trivia = syntaxTree.
GetRoot
(cancellationToken).FindTrivia(position, findInsideTrivia: false);
SuppressFormattingRule.cs (1)
331
? ((CompilationUnitSyntax)structure.SyntaxTree.
GetRoot
(CancellationToken.None)).EndOfFileToken
SyntaxTriviaExtensions.cs (1)
162
return syntaxTree.
GetRoot
(cancellationToken).FindTrivia(span.Start - 1, findInsideTrivia);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (7)
CompilationUnitSyntaxExtensions.cs (1)
31
var root = (CompilationUnitSyntax)contextNode.SyntaxTree.
GetRoot
(cancellationToken);
CSharpCodeGenerationHelpers.cs (2)
82
return (TypeDeclarationSyntax)tree.
GetRoot
(cancellationToken);
203
return contextTree?.
GetRoot
(cancellationToken).FindToken(contextLocation!.SourceSpan.Start).Parent;
CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
49
var root = diagnostic.Location.SourceTree.
GetRoot
(cancellationToken);
CSharpTypeInferenceService.TypeInferrer.cs (1)
2104
var tokenInOriginalTree = originalSemanticModel.SyntaxTree.
GetRoot
(CancellationToken).FindToken(currentSemanticModel.OriginalPositionForSpeculation);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (2)
430
if (syntaxTree.
GetRoot
(cancellationToken) is CompilationUnitSyntax compilationUnit &&
1978
if (syntaxTree.
GetRoot
(cancellationToken) is CompilationUnitSyntax compilationUnit &&
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
EventHookup\EventHookupSessionManager_EventHookupSession.cs (1)
285
semanticModel.SyntaxTree.
GetRoot
(),
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (33)
CodeActions\Preview\PreviewTests.cs (1)
88
solution = solution.WithDocumentSyntaxRoot(_oldDocument.Id, CSharpSyntaxTree.ParseText(ChangedDocumentText, cancellationToken: cancellationToken).
GetRoot
(cancellationToken));
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (1)
237
=> context.ReportDiagnostic(Diagnostic.Create(s_syntaxDiagnosticDescriptor, context.Tree.
GetRoot
().GetFirstToken().GetLocation()));
EditAndContinue\BreakpointSpansTests.cs (1)
75
var root = tree.
GetRoot
();
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (1)
57
var token = tree.
GetRoot
().FindToken(expected.Start);
EditAndContinue\Helpers\EditingTestBase.cs (7)
95
var match = SyntaxComparer.TopLevel.ComputeMatch(tree1.
GetRoot
(), tree2.
GetRoot
());
156
var root = tree.
GetRoot
();
166
return ((BaseMethodDeclarationSyntax)SyntaxFactory.SyntaxTree(declaration).
GetRoot
()).Body;
169
return (BlockSyntax)SyntaxFactory.SyntaxTree(declaration.Body).
GetRoot
();
190
var body1 = ((MethodDeclarationSyntax)SyntaxFactory.SyntaxTree(decl1).
GetRoot
()).Body;
193
var body2 = ((MethodDeclarationSyntax)SyntaxFactory.SyntaxTree(decl2).
GetRoot
()).Body;
EditAndContinue\SyntaxUtilitiesTests.cs (15)
20
var oldRoot = SyntaxFactory.ParseSyntaxTree(oldSource).
GetRoot
();
21
var newRoot = SyntaxFactory.ParseSyntaxTree(newSource).
GetRoot
();
85
").
GetRoot
();
103
").
GetRoot
();
131
").
GetRoot
();
153
").
GetRoot
();
183
var m0 = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M0");
184
var m1 = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M1");
185
var m2 = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M2");
186
var m3 = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M3");
188
var f1 = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(m => m.Identifier.ValueText == "f1");
189
var f2 = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(m => m.Identifier.ValueText == "f2");
251
var x = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(m => m.Identifier.ValueText == "X");
252
var m1 = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M1");
253
var m2 = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M2");
Formatting\FormattingEngineTests.cs (2)
2020
var root = tree.
GetRoot
();
2315
var root = syntaxTree.
GetRoot
();
SymbolKey\SymbolKeyTestBase.cs (1)
252
var usingNodes = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>();
Utilities\CSharpServiceTestExtensions.cs (2)
46
return syntaxTree.
GetRoot
().DigToFirstNodeOfType<T>();
50
=> (syntaxTree.
GetRoot
() as CompilationUnitSyntax).Members.OfType<TypeDeclarationSyntax>().First();
Workspaces\WorkspaceTests_EditorFeatures.cs (2)
248
var root = (CompilationUnitSyntax)tree.
GetRoot
();
649
Assert.True(syntaxTree.
GetRoot
().Width() > 0, "syntaxTree.GetRoot().Width should be > 0");
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (180)
CodeGen\CodeGenAsyncMethodBuilderOverrideTests.cs (2)
895
var lambdas = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().ToArray();
947
var lambdas = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().ToArray();
CodeGen\CodeGenAwaitForeachTests.cs (31)
936
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
1661
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
1707
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
1738
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
1775
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
1815
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
1852
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
1886
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
2123
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
2188
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
2273
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
2391
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
2446
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
2504
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
2694
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
2742
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
2863
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
3387
var loop = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
3610
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
3684
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
3794
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single();
3893
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single();
4120
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
4201
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
4422
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
5505
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
8165
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
8241
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
8319
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
8380
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
8451
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single();
CodeGen\CodeGenCheckedTests.cs (3)
2915
var xNode = tree.
GetRoot
().DescendantNodes().OfType<CheckedExpressionSyntax>().Single().Expression;
2922
var checkedNode = tree.
GetRoot
().DescendantNodes().OfType<CheckedExpressionSyntax>().Single();
2947
var xNode = tree.
GetRoot
().DescendantNodes().OfType<CheckedExpressionSyntax>().Single().Expression;
CodeGen\CodeGenDeconstructTests.cs (40)
96
var lhs = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().First();
101
var right = tree.
GetRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
1111
var deconstruction = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
1128
var tuple = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
2688
var lhs = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().First();
3130
var lhs = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().First();
3135
var lhsNested = tree.
GetRoot
().DescendantNodes().OfType<ParenthesizedVariableDesignationSyntax>().ElementAt(1);
3178
var lhs = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().First();
3184
var x234 = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(1);
3189
var x34 = tree.
GetRoot
().DescendantNodes().OfType<ParenthesizedVariableDesignationSyntax>().ElementAt(1);
3242
var x123 = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().First();
3248
var x23 = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
3280
var lhs = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().First();
3286
var lhsNested = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(1);
3330
var lhs = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().First();
3336
var lhsNested = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(2);
3443
var lhs = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().First();
3447
var literal = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
3479
var lhs = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().First();
3483
var literal = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
3635
return tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == name).Single();
3640
return tree.
GetRoot
().DescendantNodes().OfType<DiscardDesignationSyntax>();
3645
return tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ContextualKind() == SyntaxKind.UnderscoreToken);
3662
return tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == name);
4042
var deconstructionForeach = tree.
GetRoot
().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single();
4405
var collection = tree.
GetRoot
().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single().Expression;
5472
var firstX1 = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "x1").Single();
5504
var firstY = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == "y").First();
5509
var secondY = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == "y").ElementAt(1);
5535
var firstX = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == "x").First();
5540
var secondX = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == "x").ElementAt(1);
6408
var yz = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(2);
6413
var y = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(1);
7067
var discard = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().First();
7238
var lhs = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
7520
var lhs = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(2);
8358
var node = tree.
GetRoot
().DescendantNodes().OfType<CastExpressionSyntax>().Single();
8585
var node = tree.
GetRoot
().DescendantNodes().OfType<CastExpressionSyntax>().Single();
8629
var node = tree.
GetRoot
().DescendantNodes().OfType<CastExpressionSyntax>().ElementAt(1);
9010
var node = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().First();
CodeGen\CodeGenForEachTests.cs (1)
1752
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
CodeGen\CodeGenFunctionPointersTests.cs (20)
3054
var addressOfs = syntaxTree.
GetRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().ToArray();
3106
var addressOf = syntaxTree.
GetRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single();
3331
var declarators = syntaxTree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Initializer!.Value.IsKind(SyntaxKind.AddressOfExpression)).ToArray();
3402
var declarator = syntaxTree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
3449
var declarator = syntaxTree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
3560
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
3612
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
3663
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
3702
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
4107
var variableDeclaratorSyntax = syntaxTree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
4910
syntaxTree.
GetRoot
()
7402
var lambda = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
7504
var functionPointerSyntaxes = tree.
GetRoot
().DescendantNodes().OfType<FunctionPointerTypeSyntax>().ToArray();
7560
var functionPointerSyntax = tree.
GetRoot
().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single();
7580
functionPointerSyntax = tree.
GetRoot
().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single();
7629
var functionPointerSyntax = tree.
GetRoot
().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single();
7649
functionPointerSyntax = tree.
GetRoot
().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single();
7716
var functionPointerSyntax = tree.
GetRoot
().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single();
7734
functionPointerSyntax = tree.
GetRoot
().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single();
10757
var lambdas = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().ToArray();
CodeGen\CodeGenInterpolatedString.cs (2)
37
var interpolatedStrings = tree.
GetRoot
().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray();
46
foreach (var token in tree.
GetRoot
().DescendantTokens().Where(t => t.Kind() != SyntaxKind.EndOfFileToken))
CodeGen\CodeGenLocalFunctionTests.cs (5)
146
var localFunction = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
5749
.GetDeclaredSymbol(syntaxTree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single())
5824
.GetDeclaredSymbol(syntaxTree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single())
5897
var localFunctions = syntaxTree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToList();
6162
var localFunctionSyntax = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
CodeGen\CodeGenOperators.cs (3)
5253
ControlFlowGraph.Create((IMethodBodyOperation)model.GetOperation(tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Calculate").Single()));
5543
ControlFlowGraph.Create((IMethodBodyOperation)model.GetOperation(tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Calculate").Single()));
5579
ControlFlowGraph.Create((IMethodBodyOperation)model.GetOperation(tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Calculate").Single()));
CodeGen\CodeGenRefLocalTests.cs (6)
3257
var xDecl = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1);
3260
var refVar = tree.
GetRoot
().DescendantNodes().OfType<RefTypeSyntax>().Single();
3294
var xDecl = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1);
3297
var refVar = tree.
GetRoot
().DescendantNodes().OfType<RefTypeSyntax>().Single();
3328
var xDecl = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1);
3331
var refInt = tree.
GetRoot
().DescendantNodes().OfType<RefTypeSyntax>().Single();
CodeGen\CodeGenTupleEqualityTests.cs (1)
4297
var comparison = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Last();
CodeGen\CodeGenTupleTest.cs (60)
4019
var result = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "result").Single();
4834
var invocation1 = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(0);
4839
var invocation2 = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(2);
5070
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(0);
5114
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(0);
5155
var memberAccess = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ElementAt(0);
5159
var memberAccess2 = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ElementAt(1);
5163
var memberAccess3 = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ElementAt(2);
5199
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(0);
7503
var declaration = tree.
GetRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First();
7536
var declaration = tree.
GetRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First();
7574
var tuples = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>();
7637
var tuples = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>();
9860
var names = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>();
9911
var names = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>();
9953
var names = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>();
9999
var names = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>();
10065
var t1 = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3);
10104
var t1 = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(2);
10107
var t2 = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3);
10138
var names = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>();
12699
var node = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().First();
13980
var nameofNode = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "nameof").Single();
13987
var typeofNodes = tree.
GetRoot
().DescendantNodes().OfType<TypeOfExpressionSyntax>().ToArray();
14251
var m1 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M1").Single();
14267
var m2 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M2").Single();
14281
var f1 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "F1").First();
14295
var p1 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "P1").First();
14312
var m3 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M3").Single();
14330
var m4 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M4").Single();
14337
var m5 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M5").Single();
14344
var m6 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M6").Single();
14439
var e1 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "E1").Single();
14453
var m5 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M5").Single();
14460
var v1 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "v1").Single();
14470
var v2 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "v2").Single();
24218
var nodes = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "elem2").ToArray();
24234
var type = tree.
GetRoot
().DescendantNodes().OfType<TupleTypeSyntax>().Single();
24297
var derived = tree.
GetRoot
().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1);
24307
var xSymbol = model.GetDeclaredSymbol(tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single());
24360
var derived = tree.
GetRoot
().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1);
24370
var xSymbol = model.GetDeclaredSymbol(tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single());
24424
var derived = tree.
GetRoot
().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1);
24434
var collection = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3);
24497
var derived = tree.
GetRoot
().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1);
24507
var collection = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3);
24570
var derived = tree.
GetRoot
().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1);
24580
var collection = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3);
24644
var derived = tree.
GetRoot
().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1);
24654
var collection = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3);
25062
var x = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1);
25091
var y = tree.
GetRoot
().DescendantNodes().OfType<TupleTypeSyntax>().ElementAt(0);
25096
var z = tree.
GetRoot
().DescendantNodes().OfType<TupleTypeSyntax>().ElementAt(1);
25122
var tuple = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0);
25741
var tuple = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
25812
var tuple = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
25877
var tuple = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
25919
var tuple = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
25949
var tuple = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
27605
var literal = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Single();
CodeGen\IndexAndRangeTests.cs (2)
31
var root = syntaxTree.
GetRoot
();
3531
var receivers = tree.
GetRoot
().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Select(e => e.Expression).ToArray();
CodeGen\PatternTests.cs (3)
5013
var switchExpressions = tree.
GetRoot
().DescendantNodes().OfType<SwitchExpressionSyntax>().ToArray();
5139
var attributeArguments = tree.
GetRoot
().DescendantNodes().OfType<AttributeArgumentSyntax>().ToArray();
5288
var attributeArguments = tree.
GetRoot
().DescendantNodes().OfType<AttributeArgumentSyntax>().ToArray();
Emit\EditAndContinue\EditAndContinueTestBase.cs (1)
70
return method0.DeclaringSyntaxReferences.Single().SyntaxTree.
GetRoot
().DescendantNodes().Single(n => n.IsKind(kind));
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (215)
Attributes\AttributeTests.cs (8)
87
var nodes = Parse(aliases).
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>();
707
var root = tree.
GetRoot
();
748
var root = tree.
GetRoot
();
812
var root = tree.
GetRoot
();
854
var root = tree.
GetRoot
();
895
var root = tree.
GetRoot
();
934
var root = tree.
GetRoot
();
1147
var attributeSyntax = comp.SyntaxTrees[0].
GetRoot
().DescendantNodes().OfType<AttributeSyntax>().First();
Attributes\AttributeTests_RefReadOnly.cs (4)
1379
var userFunction = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User");
1421
var userFunction = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User");
1450
var userFunction = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User");
1477
var userFunction = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User");
Attributes\AttributeTests_WellKnownAttributes.cs (7)
5679
var localFunctionSyntax = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
9464
var syntax = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
9513
var syntax = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
9569
var syntax = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Last(n => n.Identifier.ValueText == "OnBehaviorAttached");
11261
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
11286
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
11317
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
Diagnostics\DiagnosticAnalyzerTests.cs (2)
3590
var field1 = tree1.
GetRoot
().DescendantNodes().OfType<FieldDeclarationSyntax>().Single().Declaration.Variables.Single().Identifier;
3657
var localDecl1 = tree.
GetRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First();
Diagnostics\GetDiagnosticsTests.cs (6)
172
model.GetDiagnostics(tree1.
GetRoot
().FullSpan);
221
model.GetDiagnostics(tree1.
GetRoot
().FullSpan);
258
model.GetDiagnostics(tree.
GetRoot
().FullSpan);
721
var localDecl = syntaxTree.
GetRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First();
1000
var localDecl = syntaxTree.
GetRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First();
1161
var localDecl = tree1.
GetRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First();
Emit\NumericIntPtrTests.cs (10)
699
var actualLocals = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString());
1883
var nodes = tree.
GetRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>();
1935
var nodes = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>();
5975
var expr = tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
6211
var expr = tree.
GetRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single();
6587
var expr = tree.
GetRoot
().DescendantNodes().Single(n => n.Kind() == kind);
6819
var expr = tree.
GetRoot
().DescendantNodes().Single(n => n.Kind() == kind);
8092
var expr = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
10513
var returnStatements = tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().ToArray();
10652
var methods = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray();
FlowAnalysis\FlowTests.cs (1)
5841
var declarations = tree.
GetRoot
().DescendantNodes().OfType<PropertyDeclarationSyntax>().ToImmutableArray();
FlowAnalysis\RegionAnalysisTests.cs (6)
5535
var root = tree.
GetRoot
();
5579
var root = tree.
GetRoot
();
5622
var root = tree.
GetRoot
();
6481
var root = tree.
GetRoot
();
8099
var expr = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Single();
8127
var expr = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Single();
Semantics\PatternMatchingTestBase.cs (6)
37
return tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Parent.Kind() == SyntaxKind.DeclarationPattern || p.Parent.Kind() == SyntaxKind.VarPattern);
47
return tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>();
52
return tree.
GetRoot
().DescendantNodes().OfType<DiscardDesignationSyntax>();
62
return tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == name);
419
Assert.Empty(tree.
GetRoot
().DescendantNodes().OfType<GlobalStatementSyntax>());
450
var node = tree.
GetRoot
().DescendantNodes().OfType<T>().ElementAt(index);
Semantics\PatternMatchingTests.cs (37)
849
var yRef = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).Single();
1432
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray();
1433
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray();
1482
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray();
1483
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray();
1591
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray();
1592
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray();
1656
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray();
1657
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray();
1662
var x2Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x2").ToArray();
1663
var x2Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x2").ToArray();
1668
var x3Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x3").ToArray();
1669
var x3Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x3").ToArray();
1739
var x2Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x2").ToArray();
1740
var x2Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x2").ToArray();
1745
var x3Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x3").ToArray();
1746
var x3Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x3").ToArray();
2702
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray();
2703
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray();
2747
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray();
2748
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray();
2791
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray();
2792
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray();
2843
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray();
2844
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray();
3040
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray();
3041
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray();
3087
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray();
3088
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray();
3265
foreach (var isExpression in tree.
GetRoot
().DescendantNodes().OfType<IsPatternExpressionSyntax>())
3445
var declaration = tree.
GetRoot
().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single();
3577
var node = tree.
GetRoot
().DescendantNodes().OfType<IsPatternExpressionSyntax>().First();
6571
var caseDefault = tree.
GetRoot
().DescendantNodes().OfType<CasePatternSwitchLabelSyntax>().First();
11361
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray();
11385
var locals = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
11406
var syntax = tree.
GetRoot
().DescendantNodes().OfType<BlockSyntax>().Single();
11463
var syntax = tree.
GetRoot
().DescendantNodes().OfType<BlockSyntax>().Single();
Semantics\PatternMatchingTests_ListPatterns.cs (11)
3321
var declarations = tree.
GetRoot
().DescendantNodes().OfType<VarPatternSyntax>().ToArray();
3326
var localDeclarations = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
3620
var nodes = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>();
3677
var nodes = tree.
GetRoot
().DescendantNodes()
3722
var designations = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
4088
var declarations = tree.
GetRoot
().DescendantNodes().OfType<VarPatternSyntax>().ToArray();
4175
var declarations = tree.
GetRoot
().DescendantNodes().OfType<VarPatternSyntax>().ToArray();
4252
var declarations = tree.
GetRoot
().DescendantNodes().OfType<VarPatternSyntax>().ToArray();
4366
var declarations = tree.
GetRoot
().DescendantNodes().OfType<VarPatternSyntax>().ToArray();
4408
var nodes = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>();
4559
var declarations = tree.
GetRoot
().DescendantNodes().OfType<VarPatternSyntax>().ToArray();
Semantics\PatternMatchingTests_Scope.cs (73)
678
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single();
679
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single();
713
tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "SpeculateHere").Single().SpanStart,
719
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single();
720
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray();
947
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single();
948
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single();
982
tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "SpeculateHere").Single().SpanStart,
988
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single();
989
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray();
2222
var yRef = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).ToArray();
2358
var yRef = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).ToArray();
2421
var yRef = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).ToArray();
2486
var yRef = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).Single();
2556
var yRef = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).Single();
2712
var yRef = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).ToArray();
6525
var d = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(id => id.Identifier.ValueText == "d").Single();
6590
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single();
6591
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single();
6594
var x4Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x4").Single();
6595
var x4Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x4").ToArray();
6601
var x6Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x6").Single();
6602
var x6Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x6").Single();
6605
var x8Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x8").Single();
6606
var x8Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x8").ToArray();
6610
var x14Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x14").ToArray();
6611
var x14Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x14").Single();
6679
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single();
6680
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single();
6683
var x4Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x4").Single();
6684
var x4Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x4").ToArray();
6690
var x6Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x6").Single();
6691
var x6Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x6").Single();
6694
var x8Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x8").Single();
6695
var x8Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x8").ToArray();
6699
var x14Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x14").ToArray();
6700
var x14Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x14").Single();
6838
var x2Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x2").ToArray();
6839
var x2Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x2").ToArray();
6845
var x3Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x3").Single();
6846
var x3Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x3").ToArray();
6850
var x4Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x4").Single();
6851
var x4Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x4").ToArray();
6884
bool success = model.TryGetSpeculativeSemanticModel(tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "SpeculateHere").Single().SpanStart, statement, out model);
6930
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single();
6931
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray();
6936
var d = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(id => id.Identifier.ValueText == "d").Single();
10589
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray();
10590
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray();
10597
var x2Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x2").Single();
10598
var x2Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x2").Single();
10601
var x3Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x3").Single();
10602
var x3Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x3").Single();
10605
var x4Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x4").Single();
10606
var x4Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x4").ToArray();
10612
var x5Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x5").Single();
10613
var x5Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x5").ToArray();
10617
var x8Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x8").ToArray();
10618
var x8Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x8").ToArray();
10627
var x9Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x9").Single();
10628
var x9Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x9").Single();
10631
var x10Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x10").Single();
10632
var x10Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x10").Single();
10635
var x11Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x11").Single();
10636
var x11Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x11").ToArray();
10640
var x12Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x12").Single();
10641
var x12Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x12").ToArray();
10685
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single();
10686
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single();
10720
tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "SpeculateHere").Single().SpanStart,
10726
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single();
10727
var x1Ref = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray();
12211
var e = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(id => id.Identifier.ValueText == "e").Single();
Semantics\PatternMatchingTests2.cs (9)
724
foreach (var designation in tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>())
731
foreach (var ident in tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>())
2024
var returnStatement = tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single();
2065
var returnStatement = tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single();
2164
foreach (var pat in tree.
GetRoot
().DescendantNodesAndSelf().OfType<PatternSyntax>())
2255
var patterns = tree.
GetRoot
().DescendantNodesAndSelf().OfType<PatternSyntax>().ToArray();
2299
var patterns = tree.
GetRoot
().DescendantNodesAndSelf().OfType<PatternSyntax>().ToArray();
2345
var patterns = tree.
GetRoot
().DescendantNodesAndSelf().OfType<PatternSyntax>().ToArray();
2898
var switches = tree.
GetRoot
().DescendantNodes().OfType<SwitchExpressionSyntax>().ToArray();
Semantics\PatternMatchingTests3.cs (12)
49
var subpatterns = tree.
GetRoot
().DescendantNodes().OfType<SubpatternSyntax>().ToArray();
109
var subpatterns = tree.
GetRoot
().DescendantNodes().OfType<SubpatternSyntax>().ToArray();
160
var subpatterns = tree.
GetRoot
().DescendantNodes().OfType<SubpatternSyntax>().ToArray();
205
var subpatterns = tree.
GetRoot
().DescendantNodes().OfType<SubpatternSyntax>().ToArray();
256
var subpatterns = tree.
GetRoot
().DescendantNodes().OfType<SubpatternSyntax>().ToArray();
299
var subpatterns = tree.
GetRoot
().DescendantNodes().OfType<SubpatternSyntax>().ToArray();
346
var subpatterns = tree.
GetRoot
().DescendantNodes().OfType<SubpatternSyntax>().ToArray();
1611
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
1889
var strDecl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(s => s.Identifier.ValueText == "str").ToArray();
1893
var arrDecl = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(s => s.Identifier.ValueText == "arr").ToArray();
4107
var patterns = tree.
GetRoot
().DescendantNodes().OfType<PatternSyntax>().ToArray();
4334
var patterns = tree.
GetRoot
().DescendantNodes().OfType<PatternSyntax>().ToArray();
Semantics\PatternMatchingTests4.cs (12)
1011
var dpcss = tree.
GetRoot
().DescendantNodes().OfType<PositionalPatternClauseSyntax>().ToArray();
3966
var @switch = tree.
GetRoot
().DescendantNodes().OfType<SwitchStatementSyntax>().Single();
4035
var @switch = tree.
GetRoot
().DescendantNodes().OfType<SwitchStatementSyntax>().Single();
4108
var @switch = tree.
GetRoot
().DescendantNodes().OfType<SwitchStatementSyntax>().Single();
4180
var @is = tree.
GetRoot
().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single();
4224
var @switch = tree.
GetRoot
().DescendantNodes().OfType<SwitchExpressionSyntax>().Single();
4271
var @switch = tree.
GetRoot
().DescendantNodes().OfType<SwitchExpressionSyntax>().Single();
4353
var @switch = tree.
GetRoot
().DescendantNodes().OfType<SwitchExpressionSyntax>().Single();
4435
var @switch = tree.
GetRoot
().DescendantNodes().OfType<SwitchExpressionSyntax>().Single();
4517
var @switch = tree.
GetRoot
().DescendantNodes().OfType<SwitchExpressionSyntax>().Single();
4599
var @switch = tree.
GetRoot
().DescendantNodes().OfType<SwitchExpressionSyntax>().Single();
4683
var @switch = tree.
GetRoot
().DescendantNodes().OfType<SwitchExpressionSyntax>().Single();
Semantics\PatternMatchingTests5.cs (9)
427
var isPattern = tree.
GetRoot
().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single();
564
var isPattern = tree.
GetRoot
().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single();
795
var isPattern = tree.
GetRoot
().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single();
841
var isPattern = tree.
GetRoot
().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single();
895
var isPattern = tree.
GetRoot
().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single();
1106
var subpatterns = tree.
GetRoot
().DescendantNodes().OfType<SubpatternSyntax>().ToArray();
1186
var subpatterns = tree.
GetRoot
().DescendantNodes().OfType<SubpatternSyntax>().ToArray();
1237
var subpatterns = tree.
GetRoot
().DescendantNodes().OfType<SubpatternSyntax>().ToArray();
1289
var subpatterns = tree.
GetRoot
().DescendantNodes().OfType<SubpatternSyntax>().ToArray();
Semantics\PatternSwitchTests.cs (2)
3250
var node = tree.
GetRoot
().DescendantNodes()
3281
var node = tree.
GetRoot
().DescendantNodes()
Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ExpressionCompiler (2)
SyntaxHelpers.cs (2)
223
return (StatementSyntax)syntaxTree.
GetRoot
();
234
return ((ExpressionStatementSyntax)syntaxTree.
GetRoot
()).Expression;
Microsoft.CodeAnalysis.CSharp.Features (29)
AddImport\CSharpAddImportFeatureService.cs (1)
603
return (CompilationUnitSyntax)contextNode.SyntaxTree.
GetRoot
(cancellationToken);
ArrowExpressionClausePlacementDiagnosticAnalyzer.cs (1)
39
Recurse(context, option.Notification.Severity, context.Tree.
GetRoot
(context.CancellationToken));
Completion\CompletionProviders\ImportCompletion\ImportCompletionProviderHelper.cs (1)
30
var location = context.LeftToken.Parent ?? context.SyntaxTree.
GetRoot
(cancellationToken);
Completion\CompletionProviders\Scripting\DirectiveCompletionProviderUtilities.cs (1)
16
var token = tree.
GetRoot
(cancellationToken).FindToken(position, findInsideTrivia: true);
Completion\CompletionProviders\SnippetCompletionProvider.cs (1)
92
var root = syntaxTree.
GetRoot
(cancellationToken);
Completion\KeywordRecommenders\NamespaceKeywordRecommender.cs (1)
94
var root = (CompilationUnitSyntax)syntaxTree.
GetRoot
(cancellationToken);
Completion\KeywordRecommenders\UsingKeywordRecommender.cs (1)
172
((CompilationUnitSyntax)context.SyntaxTree.
GetRoot
(cancellationToken)).Externs.Count > 0)
ConditionalExpressionPlacementDiagnosticAnalyzer.cs (1)
40
Recurse(context, option.Notification.Severity, context.Tree.
GetRoot
(context.CancellationToken));
ConsecutiveBracePlacementDiagnosticAnalyzer.cs (1)
49
var root = tree.
GetRoot
(cancellationToken);
ConstructorInitializerPlacementDiagnosticAnalyzer.cs (1)
41
Recurse(context, option.Notification.Severity, context.Tree.
GetRoot
(context.CancellationToken));
ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
38
var root = (CompilationUnitSyntax)syntaxTree.
GetRoot
(cancellationToken);
ConvertToRawString\ConvertRegularStringToRawStringCodeRefactoringProvider.cs (1)
257
current.SyntaxTree.
GetRoot
(cancellationToken), cancellationToken);
CSharpDeclarationComputer.cs (1)
29
ComputeDeclarations(model, associatedSymbol: null, model.SyntaxTree.
GetRoot
(cancellationToken),
CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
49
var root = diagnostic.Location.SourceTree.
GetRoot
(cancellationToken);
CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
56
var root = semanticModel.SyntaxTree.
GetRoot
(cancellationToken);
Debugging\BreakpointResolver.cs (1)
42
var token = tree.
GetRoot
(cancellationToken).FindToken(location.SourceSpan.Start);
Debugging\CSharpProximityExpressionsService.Worker.cs (1)
38
_token = _syntaxTree.
GetRoot
(cancellationToken).FindToken(_position);
Diagnostics\Analyzers\CSharpSimplifyTypeNamesDiagnosticAnalyzer.cs (1)
67
var root = semanticModel.SyntaxTree.
GetRoot
(cancellationToken);
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.cs (1)
84
var root = semanticModel.SyntaxTree.
GetRoot
(cancellationToken);
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (3)
48
return syntaxTree.
GetRoot
(cancellationToken).FindToken(position).GetAncestor<MemberDeclarationSyntax>();
238
return syntaxTree.
GetRoot
(cancellationToken).FindTokenOnRightOfPosition(
250
return syntaxTree.
GetRoot
(cancellationToken).FindTokenOnLeftOfPosition(
EditAndContinue\BreakpointSpans.cs (1)
37
var root = tree.
GetRoot
(cancellationToken);
EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
40
Recurse(context, option.Notification.Severity, context.Tree.
GetRoot
(context.CancellationToken));
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (1)
145
identifierName.SyntaxTree.
GetRoot
(cancellationToken);
NavigationBar\CSharpNavigationBarItemService.cs (1)
129
nodesToVisit.Push(semanticModel.SyntaxTree.
GetRoot
(cancellationToken));
UsePatternMatching\CSharpIsAndCastCheckWithoutNameCodeFixProvider.cs (1)
68
var updatedRoot = updatedSemanticModel.SyntaxTree.
GetRoot
(cancellationToken);
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (2)
177
var root = updatedSemanticModel.SyntaxTree.
GetRoot
(cancellationToken);
190
var root = semanticModel.SyntaxTree.
GetRoot
(cancellationToken);
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (82)
IOperation\IOperationTests.cs (10)
181
var m = comp.SyntaxTrees.Single().
GetRoot
().DescendantNodes().OfType<BlockSyntax>().Single();
260
var m = tree.
GetRoot
().DescendantNodes().OfType<BlockSyntax>().First();
311
var op = (IForLoopOperation)comp.GetSemanticModel(tree).GetOperation(tree.
GetRoot
().DescendantNodes().OfType<ForStatementSyntax>().Single());
352
var m = tree.
GetRoot
().DescendantNodes().OfType<BlockSyntax>().First();
379
var op = (IForEachLoopOperation)comp.GetSemanticModel(tree).GetOperation(tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single());
413
var nodes = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
463
var assignments = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().ToArray();
509
var statement = tree.
GetRoot
().DescendantNodes().OfType<StatementSyntax>().Single();
667
var catchBlock = syntaxTree.
GetRoot
().DescendantNodes().OfType<CatchClauseSyntax>().Single();
711
var fieldInitializer = tree.
GetRoot
().DescendantNodes().OfType<EqualsValueClauseSyntax>().Last().Value;
IOperation\IOperationTests_IAnonymousFunctionExpression.cs (4)
409
var variableDeclaration = syntaxTree.
GetRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single();
489
var variableDeclaration = syntaxTree.
GetRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single();
847
var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single()));
902
var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single()));
IOperation\IOperationTests_ICoalesceAssignmentOperation.cs (1)
253
var m = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
IOperation\IOperationTests_ICoalesceOperation.cs (11)
36
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
147
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
262
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
377
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
493
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
606
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
721
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
837
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
951
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
1053
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
1168
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
IOperation\IOperationTests_IConstructorBodyOperation.cs (18)
40
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
67
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
123
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
189
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
257
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
323
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
398
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
487
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
514
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
589
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
651
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First();
721
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First();
796
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First();
865
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First();
955
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First();
1072
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
1092
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
1125
var node1 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
IOperation\IOperationTests_IConversionExpression.cs (1)
5213
var assignment = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().First();
IOperation\IOperationTests_IFieldReferenceExpression.cs (1)
706
var root = syntaxTree.
GetRoot
();
IOperation\IOperationTests_ILocalFunctionStatement.cs (2)
1793
var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First()));
1848
var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First()));
IOperation\IOperationTests_IMethodBodyOperation.cs (27)
35
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
56
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
109
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
171
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
243
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
285
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
333
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
400
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
444
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().First();
506
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().First();
562
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
581
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
613
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
657
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
704
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
723
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
755
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
799
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
846
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
865
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
897
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
938
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single();
978
var node1 = tree.
GetRoot
().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single();
1000
var node1 = tree.
GetRoot
().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single();
1035
var node1 = tree.
GetRoot
().DescendantNodes().OfType<AccessorDeclarationSyntax>().First();
1080
var node1 = tree.
GetRoot
().DescendantNodes().OfType<AccessorDeclarationSyntax>().First();
1124
var node1 = tree.
GetRoot
().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single();
IOperation\IOperationTests_IObjectCreationExpression.cs (6)
782
var m1 = comp.SyntaxTrees[0].
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
1069
var main = comp.SyntaxTrees[0].
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
1295
var m1 = comp.SyntaxTrees[0].
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
1574
var main = comp.SyntaxTrees[0].
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
2275
var m = comp.SyntaxTrees[0].
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
2399
var m = comp.SyntaxTrees[0].
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M");
IOperation\IOperationTests_ISymbolInitializer.cs (1)
33
var nodes = tree.
GetRoot
().DescendantNodes().Where(n => n is VariableDeclarationSyntax || n is PropertyDeclarationSyntax).ToArray();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (948)
Semantics\AccessCheckTests.cs (4)
743
IAliasSymbol aliasA = model.GetDeclaredSymbol(tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().Where(u => u.Alias != null).Single()) as IAliasSymbol;
761
var discards = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ContextualKind() == SyntaxKind.UnderscoreToken).ToArray();
897
IAliasSymbol SomeAlias = model.GetDeclaredSymbol(tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().Where(u => u.Alias != null).Single());
911
IMethodSymbol IntegerPlus = model.GetSymbolInfo(tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single()).Symbol as IMethodSymbol;
Semantics\AnonymousFunctionTests.cs (2)
981
var root = syntaxTree.
GetRoot
();
1015
var root = syntaxTree.
GetRoot
();
Semantics\AwaitExpressionTests.cs (2)
84
var awaitExpression = tree.
GetRoot
().DescendantNodes().OfType<AwaitExpressionSyntax>().First();
273
var decl = compilation.SyntaxTrees[0].
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().AsSingleton();
Semantics\BetterCandidates.cs (4)
1089
var invocations = compilation.SyntaxTrees[0].
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
1166
var invocations = compilation.SyntaxTrees[0].
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
1214
var invocations = compilation.SyntaxTrees[0].
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
1267
var invocations = compilation.SyntaxTrees[0].
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
Semantics\BindingTests.cs (22)
2332
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.ThisExpression)).Cast<ThisExpressionSyntax>().Single();
2351
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.ThisExpression)).Cast<ThisExpressionSyntax>().Single();
2690
.
GetRoot
()
2702
.
GetRoot
()
2746
.
GetRoot
()
2801
.
GetRoot
()
2813
.
GetRoot
()
2855
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SimpleLambdaExpression)).Single();
2892
var lambda = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SimpleLambdaExpression)).Single();
2934
var lambda = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SimpleLambdaExpression)).Single();
3004
var node1 = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Use").Single().Parent;
3018
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "AuthenticateAsync").Single().Parent;
3084
var node1 = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Use").Single().Parent;
3098
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "AuthenticateAsync").Single().Parent;
3157
var node1 = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Use").Single().Parent;
3172
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "AuthenticateAsync").Single().Parent;
3242
var node1 = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Use").Single().Parent;
3257
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "AuthenticateAsync").Single().Parent;
3347
var node1 = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "MathMin").Single().Parent;
3472
var node1 = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "E").Single().Parent;
3652
var node = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "G").First();
3679
var lambda = tree.
GetRoot
().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(s => s.Parameter.Identifier.Text == "x");
Semantics\ColorColorTests.cs (9)
1812
var syntaxRoot = syntaxTree.
GetRoot
();
1881
var node1 = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
1891
var node2 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single();
1938
var node1 = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
1948
var node2 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single();
1995
var node1 = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
2005
var node2 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single();
2045
var node1 = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
2054
var node2 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single();
Semantics\ConditionalOperatorTests.cs (3)
1319
var memberBinding = tree.
GetRoot
().DescendantNodes().OfType<MemberBindingExpressionSyntax>().Single();
1373
var memberBinding = tree.
GetRoot
().DescendantNodes().OfType<MemberBindingExpressionSyntax>().Single();
1420
var memberBinding = tree.
GetRoot
().DescendantNodes().OfType<MemberBindingExpressionSyntax>().Single();
Semantics\ConstantTests.cs (1)
3502
var initializer = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer.Value;
Semantics\DeconstructionTests.cs (6)
5989
var mainCall = tree.
GetRoot
().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single();
6032
var mainCall = tree.
GetRoot
().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single();
6072
var mainCall = tree.
GetRoot
().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single();
6114
var two = tree.
GetRoot
().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "2").Single();
6154
var mainCall = tree.
GetRoot
().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single();
6557
var assignment = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
Semantics\DelegateTypeTests.cs (18)
749
var expr = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value;
795
var expr = ((CastExpressionSyntax)tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value).Expression;
895
var expr = tree.
GetRoot
().DescendantNodes().OfType<AnonymousFunctionExpressionSyntax>().Single();
938
var expr = ((CastExpressionSyntax)tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value).Expression;
996
var expr = tree.
GetRoot
().DescendantNodes().OfType<AnonymousFunctionExpressionSyntax>().Single();
1036
var expr = ((CastExpressionSyntax)tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value).Expression;
1219
var expr = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value;
1314
var expr = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value;
1409
var expr = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value;
1823
var exprs = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => d.Initializer!.Value).ToArray();
5313
var expr = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value;
5336
var expr = tree.
GetRoot
().DescendantNodes().OfType<AnonymousFunctionExpressionSyntax>().Single();
7671
var variables = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Initializer != null);
8369
var nodes = tree.
GetRoot
().DescendantNodes();
8456
var variables = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text == "d").ToArray();
9370
var syntax = syntaxTree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
11394
var syntax = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
11439
var expr = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
Semantics\DynamicTests.cs (5)
3550
var node = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single();
3583
var node = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single();
3611
var node = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single();
3639
var node = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single();
3690
var node = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single();
Semantics\ExpressionBodiedMemberTests.cs (21)
41
var node = tree.
GetRoot
()
426
var node = tree.
GetRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single();
475
var node = tree.
GetRoot
().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression;
506
var node = tree.
GetRoot
().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression;
535
var node = tree.
GetRoot
().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression;
540
Assert.Contains("P1", model.LookupNames(tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single().Body.Position));
542
var node2 = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single()
575
var node = tree.
GetRoot
().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression;
580
Assert.Contains("P1", model.LookupNames(tree.
GetRoot
().DescendantNodes().OfType<DestructorDeclarationSyntax>().Single().Body.Position));
582
var node2 = tree.
GetRoot
().DescendantNodes().OfType<DestructorDeclarationSyntax>().Single()
616
Assert.Equal(1, tree.
GetRoot
().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Count());
649
var node = tree.
GetRoot
().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression;
680
var node = tree.
GetRoot
().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression;
711
var node = tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
742
var node = tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
777
var node = tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
808
var node = tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
839
var nodes = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>();
874
var nodes = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>();
913
var nodes = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>();
1021
var nodes = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray();
Semantics\ForEachTests.cs (4)
2128
var loopSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
2180
var loopSyntaxes = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray();
2884
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
3362
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.Kind() == SyntaxKind.ForEachStatement).OfType<ForEachStatementSyntax>().Single();
Semantics\FunctionPointerTests.cs (48)
179
var initializer1 = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().First().Initializer!.Value;
181
var parameter = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First().ArgumentList.Arguments.Single();
183
var initializer2 = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Last().Initializer!.Value;
271
foreach (var literal in tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(v => v.Initializer!.Value))
329
var conversions = tree.
GetRoot
().DescendantNodes().OfType<CastExpressionSyntax>().ToList();
380
var conversions = tree.
GetRoot
().DescendantNodes().OfType<CastExpressionSyntax>().ToList();
432
var conversions = tree.
GetRoot
().DescendantNodes().OfType<CastExpressionSyntax>().ToList();
480
var conversions = tree.
GetRoot
().DescendantNodes().OfType<CastExpressionSyntax>().ToList();
578
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => d.Initializer!.Value).ToList();
817
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => d.Initializer!.Value).ToList();
860
var variableDeclaratorSyntax = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
920
var variableDeclaratorSyntax = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
956
var variableDeclaratorSyntaxes = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
1024
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
1104
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
1249
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
1344
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
1485
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
1542
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
1593
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
1640
var m1Invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
1673
var m1Invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
1706
var m1Invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
1753
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
1800
var m1Invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
1833
var m1Invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
1866
var m1Invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
1914
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
2032
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
2066
var localSyntax = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
2203
var invocationTypes = tree.
GetRoot
()
2260
var invocationTypes = tree.
GetRoot
()
2333
var invocationTypes = tree.
GetRoot
()
2407
var invocationTypes = tree.
GetRoot
()
2475
var invocationTypes = tree.
GetRoot
()
2572
var invocationTypes = tree.
GetRoot
()
2645
var invocationTypes = tree.
GetRoot
()
3157
var invocations = tree.
GetRoot
().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().ToList();
3276
var invocations = tree.
GetRoot
().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().ToList();
3355
var isPatterns = syntaxTree.
GetRoot
().DescendantNodes().OfType<IsPatternExpressionSyntax>().ToArray();
3412
var isPattern = syntaxTree.
GetRoot
().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single();
3454
var isPattern = syntaxTree.
GetRoot
().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single();
3507
var binaryExpressions = syntaxTree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().ToArray();
3561
var isPattern = syntaxTree.
GetRoot
().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single();
3656
var paramTypes = syntaxTree.
GetRoot
().DescendantNodes()
3784
VariableDeclarationSyntax fieldDeclaration = syntaxTree.
GetRoot
().DescendantNodes().OfType<FieldDeclarationSyntax>().Single().Declaration;
3793
var localDeclaration = syntaxTree.
GetRoot
()
3928
var parameterDecls = syntaxTree.
GetRoot
().DescendantNodes()
Semantics\FuzzTests.cs (1)
53
foreach (var node in tree.
GetRoot
().DescendantNodes())
Semantics\GenericConstraintsTests.cs (4)
3140
var call = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
3170
var call = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
3196
var call = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
3225
var call = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
Semantics\GlobalUsingDirectiveTests.cs (46)
3842
var ext = tree.
GetRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
3844
var aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3868
ext = tree.
GetRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
3870
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3890
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3899
ext = tree.
GetRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
3901
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3918
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3932
ext = tree.
GetRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
3934
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3952
ext = tree.
GetRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
3954
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3968
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3977
ext = tree.
GetRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
3979
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3990
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4004
ext = tree.
GetRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
4006
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4024
ext = tree.
GetRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
4026
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4040
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4049
ext = tree.
GetRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
4051
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4062
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4076
ext = tree.
GetRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
4078
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4090
ext = tree.
GetRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
4092
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4100
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4111
ext = tree.
GetRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
4113
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4133
ext = tree.
GetRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
4135
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4149
ext = tree.
GetRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray();
4151
aliases = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
4243
var node = tree.
GetRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
4251
node = tree.
GetRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
4279
node = tree.
GetRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
4287
node = tree.
GetRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
4295
node = tree.
GetRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
4303
node = tree.
GetRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
4315
node = tree.
GetRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
4979
Assert.Equal("alias1=C1", model.GetSpeculativeAliasInfo(tree.
GetRoot
().Span.End, alias1, SpeculativeBindingOption.BindAsExpression).ToTestDisplayString());
4980
Assert.Equal("alias1=C1", model.GetSpeculativeAliasInfo(tree.
GetRoot
().Span.End, alias1, SpeculativeBindingOption.BindAsTypeOrNamespace).ToTestDisplayString());
4984
Assert.Equal("alias1=C1", model.GetSpeculativeAliasInfo(tree.
GetRoot
().Span.End, alias1, SpeculativeBindingOption.BindAsExpression).ToTestDisplayString());
4985
Assert.Equal("alias1=C1", model.GetSpeculativeAliasInfo(tree.
GetRoot
().Span.End, alias1, SpeculativeBindingOption.BindAsTypeOrNamespace).ToTestDisplayString());
Semantics\ImplicitObjectCreationTests.cs (2)
4531
var nodes = (from node in tree.
GetRoot
().DescendantNodes()
4574
var node = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "aParameter").Single();
Semantics\ImportsTests.cs (3)
113
var binder = comp.GetBinderFactory(tree).GetInNamespaceBinder((CSharpSyntaxNode)tree.
GetRoot
());
143
var compilationUnits = trees.Select(tree => (CompilationUnitSyntax)tree.
GetRoot
());
150
var binders = factories.Select(factory => factory.GetInNamespaceBinder((CSharpSyntaxNode)factory.SyntaxTree.
GetRoot
()));
Semantics\IndexAndRangeTests.cs (9)
897
var expression = tree.
GetRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single();
917
var expression = tree.
GetRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single();
938
var expression = tree.
GetRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single();
1121
var expressions = tree.
GetRoot
().DescendantNodes().OfType<RangeExpressionSyntax>().ToArray();
1250
var expression = tree.
GetRoot
().DescendantNodes().OfType<RangeExpressionSyntax>().ElementAt(1);
1283
var expression = tree.
GetRoot
().DescendantNodes().OfType<RangeExpressionSyntax>().ElementAt(2);
1316
var expression = tree.
GetRoot
().DescendantNodes().OfType<RangeExpressionSyntax>().ElementAt(3);
1340
var expressions = tree.
GetRoot
().DescendantNodes().OfType<RangeExpressionSyntax>().ToArray();
1383
var expressions = tree.
GetRoot
().DescendantNodes().OfType<RangeExpressionSyntax>().ToArray();
Semantics\InitOnlyMemberTests.cs (4)
3148
speculativeModel.SyntaxTree.
GetRoot
()
3187
var nodes = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>();
4132
var localFunctionSyntax = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
4137
var delegateSyntax = tree.
GetRoot
().DescendantNodes().OfType<DelegateDeclarationSyntax>().Single();
Semantics\InteractiveUsingTests.cs (2)
87
var syntax = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().Single();
117
var syntax = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().Single();
Semantics\InterpolationTests.cs (2)
4572
var descendentNodes = tree.
GetRoot
().DescendantNodes();
4798
SyntaxNode syntax = tree.
GetRoot
().DescendantNodes().OfType<CastExpressionSyntax>().Single();
Semantics\IteratorTests.cs (5)
327
var yieldNode = (YieldStatementSyntax)tree.
GetRoot
().DescendantNodes().Where(n => n is YieldStatementSyntax).SingleOrDefault();
350
var yieldNode = (YieldStatementSyntax)tree.
GetRoot
().DescendantNodes().Where(n => n is YieldStatementSyntax).SingleOrDefault();
447
var node = tree.
GetRoot
().DescendantNodes().OfType<YieldStatementSyntax>().First();
478
var node = tree.
GetRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
516
var node = tree.
GetRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
Semantics\LambdaDiscardParametersTests.cs (8)
68
var underscores = tree.
GetRoot
().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.Identifier.ToString() == "_").ToArray();
386
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>();
417
var underscoreParameters = tree.
GetRoot
().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.ToString() == "_").ToArray();
422
var underscore = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").Single();
448
var underscores = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").ToArray();
482
var underscore = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").Single();
513
var underscores = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").ToArray();
566
var underscoreParameters = tree.
GetRoot
().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.ToString() == "_").ToArray();
Semantics\LambdaTests.cs (42)
1509
var node = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single();
1544
var node = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single();
1578
var node = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single();
1610
var node = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single();
1975
var node1 = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.AnonymousMethodExpression)).Single();
2411
foreach (var lambda in tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>())
2457
foreach (var lambda in tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>())
2503
foreach (var lambda in tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>())
2536
foreach (var lambda in tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>())
2569
foreach (var lambda in tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>())
2606
foreach (var lambda in tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>())
2658
var lambdas = tree.
GetRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().ToArray();
3608
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>();
3877
var lambda = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
3921
var attributeSyntaxes = tree.
GetRoot
().DescendantNodes().OfType<AttributeSyntax>().ToImmutableArray();
3961
var a = (IdentifierNameSyntax)tree.
GetRoot
().DescendantNodes().OfType<AttributeSyntax>().Single().Name;
3970
var m = newTree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
3974
a = (IdentifierNameSyntax)newTree.
GetRoot
().DescendantNodes().OfType<AttributeSyntax>().Single().Name;
4077
var expr = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
4106
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
4141
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
4169
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
4196
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
4771
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
4856
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
4884
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
4911
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
4939
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
4985
var expr = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().First();
5599
var lambdaSyntax = tree.
GetRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single();
6472
var parameterUsages = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>()
6782
var discard = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>()
6811
var underscore = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>()
6863
var lambdas = tree.
GetRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray();
6977
var action = syntaxTree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.ValueText == "Action");
7071
var root = syntaxTree.
GetRoot
();
7976
var lambdas = tree.
GetRoot
().DescendantNodes()
8024
var lambda = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
8084
var decls = tree.
GetRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().ToImmutableArray();
8123
var defaultValue = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single()
8300
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
8325
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
Semantics\LocalFunctionTests.cs (35)
348
var m = newTree.
GetRoot
()
353
var x = newTree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Single();
394
var a = tree.
GetRoot
().DescendantNodes()
404
var m = newTree.
GetRoot
()
409
a = newTree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().ElementAt(2);
451
var attributeSyntax = tree.
GetRoot
().DescendantNodes().OfType<AttributeSyntax>().Single();
493
var localFunction = tree.
GetRoot
().DescendantNodes()
541
var localFunction = tree.
GetRoot
().DescendantNodes()
805
var localFunction = tree.
GetRoot
().DescendantNodes()
852
var localFunction = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
968
var localFunction = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
1022
var attributeSyntaxes = tree.
GetRoot
().DescendantNodes().OfType<AttributeSyntax>().ToList();
1060
var attrSyntax = tree.
GetRoot
().DescendantNodes().OfType<AttributeSyntax>().Single();
1720
var x = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.ValueText == "x").Single();
1763
var root = tree.
GetRoot
();
1838
var root = tree.
GetRoot
();
2373
LocalFunctionStatementSyntax declaration = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First();
2570
var exprs = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToImmutableArray();
4604
var descendents = tree.
GetRoot
().DescendantNodes();
4642
var descendents = tree.
GetRoot
().DescendantNodes();
4880
var b2 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b2").Single();
4883
var b1 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b1").Single();
6407
var exprs = tree.
GetRoot
().DescendantNodes().OfType<TypeOfExpressionSyntax>().Select(n => n.Type).ToImmutableArray();
6454
var exprs = tree.
GetRoot
().DescendantNodes().OfType<SizeOfExpressionSyntax>().Select(n => n.Type).ToImmutableArray();
6468
return tree.
GetRoot
().DescendantNodes().
6956
var nodes = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>();
7016
var nodes = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>();
7369
return tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == identifier).Single().SpanStart;
7557
var tParameterUsages = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>()
8602
var parameterUsages = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>()
8657
var method = tree2.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
8660
var invocation = tree2.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
8697
var nameofExpression = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
9474
var node = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>()
10094
var node = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>()
Semantics\LookupTests.cs (10)
1501
var node = tree.
GetRoot
().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "m.M").Single();
1505
var node2 = (ExpressionSyntax)SyntaxFactory.SyntaxTree(node).
GetRoot
();
1643
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.ToString() == "returne<double>").First();
1670
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.ToString() == "System.Object").First();
1725
var syntaxes = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToArray();
2014
var call = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
2044
var node = tree.
GetRoot
().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().Single().Expression;
2074
var node = tree.
GetRoot
().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().Single().Expression;
2100
var node = tree.
GetRoot
().DescendantNodes().OfType<GenericNameSyntax>().Single();
2122
var node = tree.
GetRoot
().DescendantNodes().OfType<AttributeSyntax>().Single();
Semantics\MethodTypeInferenceTests.cs (8)
858
return tree.
GetRoot
().DescendantNodes().OfType<DiscardDesignationSyntax>();
863
return tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ContextualKind() == SyntaxKind.UnderscoreToken);
1046
var syntax = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
1076
var syntax = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
1118
var book = (IdentifierNameSyntax)tree.
GetRoot
().DescendantTokens().Last(t => t.Text == "b").Parent;
1159
var author = (IdentifierNameSyntax)tree.
GetRoot
().DescendantTokens().Last(t => t.Text == "a").Parent;
1200
var bookResult = (IdentifierNameSyntax)tree.
GetRoot
().DescendantTokens().Last(t => t.Text == "bookResult").Parent;
1204
var authorResult = (IdentifierNameSyntax)tree.
GetRoot
().DescendantTokens().Last(t => t.Text == "authorResult").Parent;
Semantics\NameOfTests.cs (9)
690
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.ToString() == "SomeClass.Goo").OfType<ExpressionSyntax>().First();
716
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.ToString() == "SomeClass.Goo").OfType<ExpressionSyntax>().First();
751
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First();
798
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First();
835
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First();
871
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.ToString() == "a.Nested").OfType<ExpressionSyntax>().First();
917
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.ToString() == "A.Extension").OfType<ExpressionSyntax>().First();
950
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First();
1118
var node = tree.
GetRoot
().DescendantNodes().Where(n => n.ToString() == "X1.Extension").OfType<ExpressionSyntax>().First();
Semantics\NativeIntegerTests.cs (12)
1789
var actualLocals = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString());
2346
var actualLocals = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString());
2466
var actualLocals = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString());
3634
var nodes = tree.
GetRoot
().DescendantNodes().ToArray();
4118
var nodes = tree.
GetRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().ToArray();
6035
var nodes = tree.
GetRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>();
6083
var nodes = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>();
9469
var expr = tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
9704
var expr = tree.
GetRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single();
10081
var expr = tree.
GetRoot
().DescendantNodes().Single(n => n.Kind() == kind);
10306
var expr = tree.
GetRoot
().DescendantNodes().Single(n => n.Kind() == kind);
12355
var expr = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
Semantics\NullableContextTests.cs (15)
67
var classDeclPosition = syntaxTree.
GetRoot
().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SpanStart;
68
var methodDeclPosition = syntaxTree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single().SpanStart;
102
var classDecl1 = syntaxTree1.
GetRoot
().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SpanStart;
103
var classDecl2 = syntaxTree2.
GetRoot
().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SpanStart;
350
var syntax = syntaxTree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Skip(1).Single();
389
var syntax = syntaxTree.
GetRoot
().DescendantNodes().OfType<AttributeArgumentSyntax>().Single();
424
var syntax = syntaxTree.
GetRoot
().DescendantNodes().OfType<EqualsValueClauseSyntax>().First().Value;
1771
var returnStatements = syntaxTree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().ToArray();
1841
var syntax = syntaxTree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single().Right;
1878
var attributeArguments = syntaxTree.
GetRoot
().DescendantNodes().OfType<AttributeArgumentSyntax>().ToArray();
1927
var attributeArguments = syntaxTree.
GetRoot
().DescendantNodes().OfType<AttributeArgumentSyntax>().ToArray();
1969
var equalsValueClauses = syntaxTree.
GetRoot
().DescendantNodes().OfType<EqualsValueClauseSyntax>().ToArray();
2009
var declarations = syntaxTree.
GetRoot
().DescendantNodes().OfType<FieldDeclarationSyntax>().Select(f => f.Declaration.Variables[0]).ToArray();
2048
var declarations = syntaxTree.
GetRoot
().DescendantNodes().OfType<PropertyDeclarationSyntax>().ToArray();
2228
var typeOf = syntaxTree.
GetRoot
().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single();
Semantics\NullableConversionTests.cs (1)
804
var target = syntaxTree.
GetRoot
().DescendantNodes().OfType<CastExpressionSyntax>().ToList()[2];
Semantics\NullableReferenceTypesTests.cs (138)
1742
var suppression = tree.
GetRoot
().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First();
1776
var suppression = tree.
GetRoot
().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First();
1829
var suppression = tree.
GetRoot
().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single();
1855
var suppressions = tree.
GetRoot
().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().ToArray();
1880
var suppressions = tree.
GetRoot
().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().ToArray();
1951
var suppression = tree.
GetRoot
().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First();
2264
var suppression = tree.
GetRoot
().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single();
2303
var suppression = tree.
GetRoot
().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single();
2335
var suppression = tree.
GetRoot
().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single();
2369
var suppression = tree.
GetRoot
().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single();
2467
var suppression = tree.
GetRoot
().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First();
3322
foreach (var lambda in tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>())
3681
var lambda = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SimpleLambdaExpression)).Single();
4514
var firstCref = tree.
GetRoot
().DescendantNodes(descendIntoTrivia: true).OfType<NameMemberCrefSyntax>().First();
4518
var lastCref = tree.
GetRoot
().DescendantNodes(descendIntoTrivia: true).OfType<NameMemberCrefSyntax>().Last();
4550
var lastCref = tree.
GetRoot
().DescendantNodes(descendIntoTrivia: true).OfType<NameMemberCrefSyntax>().Last();
4582
var lastCref = tree.
GetRoot
().DescendantNodes(descendIntoTrivia: true).OfType<NameMemberCrefSyntax>().Last();
5157
var declaration = syntaxTree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
7757
var specifier = tree.
GetRoot
().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().Single();
10522
var foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray();
13499
var returnStatement = tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Skip(1).Single();
33045
var outVar = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single();
33062
var varDecl = tree.
GetRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Where(d => d.Declaration.Type.IsVar).Single();
53896
var nullNode = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().First();
53902
var invocationNode = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
53926
var nullNode = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().First();
53932
var invocationNode = tree.
GetRoot
().DescendantNodes().OfType<ImplicitArrayCreationExpressionSyntax>().Single();
53959
var defaultNode = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().First();
53965
var invocationNode = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
53996
var defaultNode = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().First();
54002
var invocationNode = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
54032
var invocationNode = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
54066
var invocationNode = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
54097
var invocationNode = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
54124
var nullNode = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().First();
54130
var invocationNode = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
54164
var invocationNode = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
54198
var invocationNode = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
54229
var invocationNode = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
54257
var newNode = tree.
GetRoot
().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().First();
54262
var invocationNode = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
54292
var newNode = tree.
GetRoot
().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().First();
54297
var invocationNode = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
54328
var nullNode = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().First();
54333
var invocationNode = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
54408
var invocationNode = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
54411
var invocationNode2 = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Last();
54439
var lambdaNode = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Last();
54444
var invocationNode = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
56563
var declarator = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().First();
56568
var declaration = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclarationSyntax>().First();
56597
var declarator = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().First();
56625
var declarator = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().First();
56657
var declarator = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().First();
56686
var declarator = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().First();
56719
var declarator = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().First();
56751
var declarator = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().First();
56784
var declarator = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Skip(1).First();
56818
var declarator = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Skip(1).First();
56844
var declarator = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().First();
56873
var declarator = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().First();
56902
var declarators = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
60393
var declarators = syntaxTree.
GetRoot
().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>().ToImmutableArray();
63425
var function1 = tree1.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Last();
63429
var function2 = tree2.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
63434
var object2 = tree2.
GetRoot
().DescendantNodes().OfType<PredefinedTypeSyntax>()
67835
var declarators = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
67871
var declarators = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
67912
var declarators = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
67949
var declarators = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
67986
var declarators = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
68021
var declarators = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
68054
var declarators = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
68091
var declarators = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
68363
var discards = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Select(a => a.Left).ToArray();
68457
var arguments = tree.
GetRoot
().DescendantNodes().OfType<ArgumentSyntax>();
68504
var arguments = tree.
GetRoot
().DescendantNodes().OfType<ArgumentSyntax>();
68543
var discardPatterns = tree.
GetRoot
().DescendantNodes().OfType<DiscardPatternSyntax>().ToArray();
70336
var node = tree.
GetRoot
().DescendantNodes().OfType<EnumMemberDeclarationSyntax>().ElementAt(1);
77612
var declarator = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().First();
90553
var localDeclaration = syntaxTree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1);
94029
var localSyntaxes = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray();
95358
var localSyntaxes = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray();
108042
var localSyntaxes = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>();
108096
var localSyntaxes = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>();
109464
var arrays = tree.
GetRoot
().DescendantNodes().OfType<ArrayTypeSyntax>().ToArray();
109866
var decl = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single();
109897
var decl = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single();
110075
var decl = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
110300
var decl = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
141088
var declaration = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
141095
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
141129
var declaration = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
141136
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
141169
var declaration = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
141176
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
141207
var declaration = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
141214
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
141245
var declaration = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
141252
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
141285
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
141318
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
141349
var declaration = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
141356
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
141388
var declaration = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
141395
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
141665
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
141696
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
141729
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
142011
var @foreach = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
142050
var @foreach = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
142090
var @foreach = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
142129
var @foreach = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
142166
var root = tree.
GetRoot
();
150439
var locals = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
150507
var locals = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
151641
var identifiers = tree.
GetRoot
().DescendantNodes().Where(n => n.ToString() == "global::Program").ToArray();
152339
var invocationNode = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
152342
var invocationNode2 = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Last();
153173
var declarators = tree.
GetRoot
().DescendantNodes().OfType<EqualsValueClauseSyntax>().ToArray();
153221
var method1 = model.GetDeclaredSymbol(tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single());
153223
var invocations = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
153653
var item = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First();
153689
var item = tree.
GetRoot
().DescendantNodes().OfType<ElementAccessExpressionSyntax>().First();
153784
var item = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
153822
var item = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First();
153863
var item = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First();
153903
var item = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First();
153937
var item = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First();
153974
var item = tree.
GetRoot
().DescendantNodes().OfType<ElementAccessExpressionSyntax>().First();
154069
var item = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
154117
var item = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First();
154159
var item = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First();
154196
var item = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First();
154407
var declarations = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclarationSyntax>();
156279
var stackallocNode = tree.
GetRoot
().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().Single();
156830
var arms = syntaxTree.
GetRoot
().DescendantNodes().OfType<SwitchExpressionArmSyntax>().ToImmutableArray();
156876
var sections = syntaxTree.
GetRoot
().DescendantNodes().OfType<SwitchSectionSyntax>().ToImmutableArray();
Semantics\NullCoalesceAssignmentTests.cs (5)
36
var syntaxRoot = syntaxTree.
GetRoot
();
74
var syntaxRoot = syntaxTree.
GetRoot
();
117
var syntaxRoot = syntaxTree.
GetRoot
();
156
var syntaxRoot = syntaxTree.
GetRoot
();
182
var syntaxRoot = syntaxTree.
GetRoot
();
Semantics\ObjectAndCollectionInitializerTests.cs (14)
3452
var nodes = (from node in tree.
GetRoot
().DescendantNodes()
3500
var nodes = (from node in tree.
GetRoot
().DescendantNodes()
3557
var nodes = (from node in tree.
GetRoot
().DescendantNodes()
3593
var nodes = (from node in tree.
GetRoot
().DescendantNodes()
3630
var nodes = (from node in tree.
GetRoot
().DescendantNodes()
3671
var root = tree.
GetRoot
();
3721
var root = tree.
GetRoot
();
3765
var root = tree.
GetRoot
();
3845
var nodes = tree.
GetRoot
().DescendantNodes().OfType<InitializerExpressionSyntax>().Skip(1).Single().Expressions;
3927
var nodes = tree.
GetRoot
().DescendantNodes().OfType<GenericNameSyntax>().ToArray();
3968
var node1 = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
4006
var nodes = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(n => n.ToString() == "2");
4046
var node1 = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
4078
var nodes = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(n => n.ToString() == "2");
Semantics\OperatorTests.cs (20)
47
var orNodes = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().ToArray();
2985
var negOne = tree.
GetRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single();
2991
var boolPlusPlus = tree.
GetRoot
().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().ElementAt(0);
2997
var errorPlusPlus = tree.
GetRoot
().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().ElementAt(1);
6938
var syntax = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
7055
var syntax = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Last();
7210
var syntax = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Last();
7328
var syntax = tree.
GetRoot
();
7329
var methodBody = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body;
7487
var nodes = (from node in tree.
GetRoot
().DescendantNodes()
7703
var nodes = (from node in tree.
GetRoot
().DescendantNodes()
7872
var nodes = (from node in tree.
GetRoot
().DescendantNodes()
8032
var nodes = (from node in tree.
GetRoot
().DescendantNodes()
8553
var nodes = (from node in tree.
GetRoot
().DescendantNodes()
8588
var nodes = tree.
GetRoot
().DescendantNodes().Where(node => node is BinaryExpressionSyntax || node is AssignmentExpressionSyntax).ToArray();
8632
var nodes = (from node in tree.
GetRoot
().DescendantNodes()
8682
var nodes = (from node in tree.
GetRoot
().DescendantNodes()
8756
var nodes = (from node in tree.
GetRoot
().DescendantNodes()
11336
var negNode = tree.
GetRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single();
11417
var fieldInitializerOperations = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>()
Semantics\OutVarTests.cs (75)
178
Assert.False(compilation.SyntaxTrees.Single().
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any());
386
Assert.False(compilation.SyntaxTrees.Single().
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any());
423
Assert.False(compilation.SyntaxTrees.Single().
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any());
461
Assert.False(compilation.SyntaxTrees.Single().
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any());
499
Assert.False(compilation.SyntaxTrees.Single().
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any());
537
Assert.False(compilation.SyntaxTrees.Single().
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any());
575
Assert.False(compilation.SyntaxTrees.Single().
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any());
622
Assert.False(compilation.SyntaxTrees.Single().
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any());
659
Assert.False(compilation.SyntaxTrees.Single().
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any());
697
Assert.False(compilation.SyntaxTrees.Single().
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any());
737
Assert.False(compilation.SyntaxTrees.Single().
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any());
776
Assert.False(compilation.SyntaxTrees.Single().
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any());
816
Assert.False(compilation.SyntaxTrees.Single().
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any());
833
return tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == name);
838
return tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>()
854
return tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>()
860
return tree.
GetRoot
().DescendantNodes().OfType<DiscardDesignationSyntax>();
865
return tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ContextualKind() == SyntaxKind.UnderscoreToken);
870
return tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>()
5313
var node = tree.
GetRoot
().DescendantNodes().OfType<EqualsValueClauseSyntax>().First();
5583
var node = tree.
GetRoot
().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single();
9702
var d = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(id => id.Identifier.ValueText == "d").Single();
10269
var d = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(id => id.Identifier.ValueText == "d").Single();
11077
var node = tree.
GetRoot
().DescendantNodes().OfType<EqualsValueClauseSyntax>().First();
11335
var node = tree.
GetRoot
().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single();
17749
var x2Decl = tree.
GetRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single();
18444
var initializer = tree.
GetRoot
().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single();
20647
Assert.Equal(1, compilation.SyntaxTrees[0].
GetRoot
().DescendantNodesAndSelf().OfType<DeclarationExpressionSyntax>().Count());
21356
var e = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(id => id.Identifier.ValueText == "e").Single();
32173
var b = (IFieldSymbol)model.GetDeclaredSymbol(tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "b").Single());
32213
var b = (IFieldSymbol)model.GetDeclaredSymbol(tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "b").Single());
32253
var a = (IFieldSymbol)model.GetDeclaredSymbol(tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "a").Single());
32326
var bDecl = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "b").Single();
32424
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>()
32462
var x1Decl = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>()
33447
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "x").Single();
33635
var z1 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "z1").First();
35120
var varType = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single();
35159
var varType = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single();
35203
var varType = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single();
35234
var varType = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single();
35273
var varType = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single();
35305
var varType = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single();
35341
var varType = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single();
35380
var varType = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single();
35410
var varType = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single();
35447
var varType = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single();
35638
var foreachStatement = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
35793
var node = tree.
GetRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
35839
var node = tree.
GetRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
35923
var initializerSyntax = tree.
GetRoot
().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single();
35942
var blockBodySyntax = tree.
GetRoot
().DescendantNodes().OfType<BlockSyntax>().First();
35967
var expressionBodySyntax = tree.
GetRoot
().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().First();
35990
var declarationSyntax = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First();
36063
var expressionBodySyntax = tree.
GetRoot
().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().First();
36087
var blockBodySyntax = tree.
GetRoot
().DescendantNodes().OfType<BlockSyntax>().First();
36111
var propertyExpressionBodySyntax = tree.
GetRoot
().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().ElementAt(1);
36116
var declarationSyntax = tree.
GetRoot
().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single();
36171
var node3 = tree.
GetRoot
().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().First();
36264
var node = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test3").Last();
36304
var method = tree2.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
36307
var invocation = tree2.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
36351
var method = tree2.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
36354
var invocation = tree2.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
36358
Assert.Same(symbolInfo.Symbol, speculativeModel.GetDeclaredSymbol(tree2.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Where(l => l.Identifier.ValueText == "M2").Single()));
36391
var method = tree2.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
36394
var invocation = tree2.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
36433
var method = tree2.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
36436
var invocation = tree2.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
36440
Assert.Same(symbolInfo.Symbol, speculativeModel.GetDeclaredSymbol(tree2.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Where(l => l.Identifier.ValueText == "M2").Single()));
36468
var method = tree2.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
36471
var invocation = tree2.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
36506
var method = tree2.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
36509
var invocation = tree2.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
36513
Assert.Same(symbolInfo.Symbol, speculativeModel.GetDeclaredSymbol(tree2.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Where(l => l.Identifier.ValueText == "M2").Single()));
Semantics\OverloadResolutionTests.cs (9)
7151
var callSyntax = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
7261
var callSyntax = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
7435
var syntax = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
7476
var syntax = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
9077
var callSyntax = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
9425
var callSyntax = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
11337
var expr = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
11386
var expr = tree.
GetRoot
().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single();
11436
var expr = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
Semantics\PrimaryConstructorTests.cs (48)
385
var parameters = tree.
GetRoot
().DescendantNodes().OfType<ParameterSyntax>().ToArray();
853
var outVarSyntax = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Single();
895
var xs = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray();
964
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1);
977
var baseWithargs = tree.
GetRoot
().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single();
1076
var equalsValue = tree.
GetRoot
().DescendantNodes().OfType<EqualsValueClauseSyntax>().First();
1086
var baseWithargs = tree.
GetRoot
().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single();
1112
var equalsValue = tree.
GetRoot
().DescendantNodes().OfType<EqualsValueClauseSyntax>().Last();
1192
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1);
1203
var y = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").First();
1216
var test = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").First();
1257
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
1303
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
1314
var classDeclarations = tree.
GetRoot
().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray();
1359
var xs = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray();
1375
var classDeclarations = tree.
GetRoot
().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray();
1418
var xs = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray();
1443
var classDeclarations = tree.
GetRoot
().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray();
1507
var xs = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray();
1532
var classDeclarations = tree.
GetRoot
().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray();
1706
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
1746
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
1789
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
1859
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1);
2010
var baseWithargs = tree.
GetRoot
().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single();
2065
Assert.False(model.TryGetSpeculativeSemanticModel(tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart,
2109
Assert.Equal(TypeInfo.None, model.GetSpeculativeTypeInfo(tree.
GetRoot
().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single().ArgumentList.OpenParenToken.SpanStart,
2113
var baseWithargs = tree.
GetRoot
().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single();
2192
var baseWithargs = tree.
GetRoot
().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single();
2217
Assert.False(model.TryGetSpeculativeSemanticModel(tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart,
2248
Assert.Equal(TypeInfo.None, model.GetSpeculativeTypeInfo(tree.
GetRoot
().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single().ArgumentList.OpenParenToken.SpanStart,
2252
var baseWithargs = tree.
GetRoot
().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single();
2317
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
2366
tree.
GetRoot
().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().First();
2376
tree.
GetRoot
().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Skip(1).First();
2381
var baseWithoutParens = tree.
GetRoot
().DescendantNodes().OfType<SimpleBaseTypeSyntax>().Single();
2533
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
2544
var typeDeclaration = tree.
GetRoot
().DescendantNodes().OfType<TypeDeclarationSyntax>().Single();
2571
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
2608
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
2644
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
6217
var xReference = tree.
GetRoot
().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].Expression;
6243
var mCall = tree.
GetRoot
().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].Expression;
6244
var attrApplication = tree.
GetRoot
().DescendantNodes().OfType<AttributeSyntax>().Single();
6245
var mDefinition = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
7179
var p1 = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "p1").Single();
7746
var p1s = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "p1").ToArray();
8152
var p1s = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "p1").ToArray();
Semantics\QueryTests.cs (2)
2272
var queryContinuation = tree.
GetRoot
().FindToken(sourceCode.IndexOf("into w", StringComparison.Ordinal)).Parent;
2325
var joinInto = tree.
GetRoot
().FindToken(sourceCode.IndexOf("into x8", StringComparison.Ordinal)).Parent;
Semantics\RawInterpolationTests_Handler.cs (2)
2899
var descendentNodes = tree.
GetRoot
().DescendantNodes();
3125
SyntaxNode syntax = tree.
GetRoot
().DescendantNodes().OfType<CastExpressionSyntax>().Single();
Semantics\RecordStructTests.cs (20)
534
var creation = tree.
GetRoot
().DescendantNodes().OfType<AnonymousObjectCreationExpressionSyntax>().Single();
554
var method = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
574
var method = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
596
var method = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
2307
var x = tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
2331
var x = tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
2594
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
2605
var recordDeclaration = tree.
GetRoot
().DescendantNodes().OfType<RecordDeclarationSyntax>().Single();
2629
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
2663
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
2698
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
5819
var parameterSyntax = tree.
GetRoot
().DescendantNodes().OfType<ParameterSyntax>().Single();
5825
var initializerSyntax = tree.
GetRoot
().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single();
5861
var outVarSyntax = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Single();
6895
var with = tree.
GetRoot
().DescendantNodes().OfType<WithExpressionSyntax>().Single();
7566
var with = tree.
GetRoot
().DescendantNodes().OfType<WithExpressionSyntax>().Single();
8771
var withExpr = tree.
GetRoot
().DescendantNodes().OfType<WithExpressionSyntax>().Single();
10774
tree.
GetRoot
().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().First();
10784
tree.
GetRoot
().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Skip(1).First();
10789
var baseWithoutParens = tree.
GetRoot
().DescendantNodes().OfType<SimpleBaseTypeSyntax>().Single();
Semantics\RecordTests.cs (51)
282
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
448
var parameterSyntax = tree.
GetRoot
().DescendantNodes().OfType<ParameterSyntax>().Single();
454
var initializerSyntax = tree.
GetRoot
().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single();
480
var outVarSyntax = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Single();
1820
var root = comp.SyntaxTrees[0].
GetRoot
();
2494
var x = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Last().Left;
8093
var root = tree.
GetRoot
();
8606
var root = tree.
GetRoot
();
8721
var root = tree.
GetRoot
();
8866
var root = tree.
GetRoot
();
21155
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1);
21168
var baseWithargs = tree.
GetRoot
().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single();
21268
var equalsValue = tree.
GetRoot
().DescendantNodes().OfType<EqualsValueClauseSyntax>().First();
21279
var baseWithargs = tree.
GetRoot
().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single();
21305
var equalsValue = tree.
GetRoot
().DescendantNodes().OfType<EqualsValueClauseSyntax>().Last();
21385
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1);
21396
var y = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").First();
21409
var test = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").First();
21450
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
21496
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
21507
var recordDeclarations = tree.
GetRoot
().DescendantNodes().OfType<RecordDeclarationSyntax>().Skip(1).ToArray();
21552
var xs = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray();
21568
var recordDeclarations = tree.
GetRoot
().DescendantNodes().OfType<RecordDeclarationSyntax>().Skip(1).ToArray();
21611
var xs = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray();
21636
var recordDeclarations = tree.
GetRoot
().DescendantNodes().OfType<RecordDeclarationSyntax>().Skip(1).ToArray();
21700
var xs = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray();
21725
var recordDeclarations = tree.
GetRoot
().DescendantNodes().OfType<RecordDeclarationSyntax>().Skip(1).ToArray();
21899
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
21936
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
21976
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
22011
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
22090
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1);
22241
var baseWithargs = tree.
GetRoot
().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single();
22296
Assert.False(model.TryGetSpeculativeSemanticModel(tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart,
22340
Assert.Equal(TypeInfo.None, model.GetSpeculativeTypeInfo(tree.
GetRoot
().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single().ArgumentList.OpenParenToken.SpanStart,
22344
var baseWithargs = tree.
GetRoot
().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single();
22423
var baseWithargs = tree.
GetRoot
().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single();
22448
Assert.False(model.TryGetSpeculativeSemanticModel(tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart,
22479
Assert.Equal(TypeInfo.None, model.GetSpeculativeTypeInfo(tree.
GetRoot
().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single().ArgumentList.OpenParenToken.SpanStart,
22483
var baseWithargs = tree.
GetRoot
().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single();
22928
var recordDeclaration = tree.
GetRoot
().DescendantNodes().OfType<RecordDeclarationSyntax>().First();
23382
var recordDeclaration = tree.
GetRoot
().DescendantNodes().OfType<RecordDeclarationSyntax>().ElementAt(1);
24654
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
24665
var recordDeclaration = tree.
GetRoot
().DescendantNodes().OfType<RecordDeclarationSyntax>().Single();
24689
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
24723
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
24758
var x = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First();
30350
var xReference = tree.
GetRoot
().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].Expression;
30374
var mCall = tree.
GetRoot
().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].Expression;
30375
var attrApplication = tree.
GetRoot
().DescendantNodes().OfType<AttributeSyntax>().Single();
30376
var mDefinition = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
Semantics\RefEscapingTests.cs (1)
50
var root = tree.
GetRoot
();
Semantics\RefFieldTests.cs (63)
10575
var decls = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray();
10649
var delegateTypesAndLambdas = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => getDelegateTypeAndLambda(model, d)).ToArray();
10771
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
10940
var lambdas = tree.
GetRoot
().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray();
11488
var expr = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression;
11568
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
11637
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
11705
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
11887
var decls = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().
11926
var discard = tree.
GetRoot
().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray();
12074
var decls = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().
12106
var discard = tree.
GetRoot
().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray();
12300
var decls = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
12337
var discard = tree.
GetRoot
().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray();
12483
var decls = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
12513
var discard = tree.
GetRoot
().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray();
12658
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
12713
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
12772
var decls = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
12815
var decls = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
12844
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
12869
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
12889
var decls = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
12911
var decls = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
12946
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
13010
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
13086
var decls = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
13157
var decls = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
13221
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
13862
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
13904
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
14029
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
14105
var decls = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray();
14350
var decls = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
14381
var discard = tree.
GetRoot
().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray();
14558
var decls = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray();
14584
var decls = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray();
14639
var decls = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray();
16057
var invocations = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
16098
var anonymousMethod = tree.
GetRoot
().DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single();
16138
var anonymousMethod = tree.
GetRoot
().DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single();
16236
var lambdas = tree.
GetRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().ToArray();
16282
var root = syntaxTree.
GetRoot
();
17398
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text == "f").ToArray();
22291
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text is "r1" or "r2").ToArray();
22359
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text is "r1" or "r2").ToArray();
23361
var lambdas = tree.
GetRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray();
23397
var lambdas = tree.
GetRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray();
23434
var lambdas = tree.
GetRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray();
24201
var delegateTypesAndLambdas = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => getDelegateTypeAndLambda(model, d)).ToArray();
26033
foreach (var node in tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText is "a" or "b" or "c"))
26085
foreach (var node in tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText is "a" or "b" or "c"))
26137
foreach (var node in tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText is "a" or "b" or "c"))
26292
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
26382
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
26502
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
26603
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
26648
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
26708
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
26938
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
26986
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
28093
var fieldInitializerSyntax = tree.
GetRoot
().DescendantNodes().OfType<EqualsValueClauseSyntax>().First();
28136
var constructorSyntax = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
Semantics\RefLocalsAndReturnsTests.cs (10)
4355
var assignment = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
4383
var assignment = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
4411
var assignment = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
4439
var assignment = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
4467
var assignment = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
4495
var assignment = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
4529
var assignment = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
4815
var decls = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
4859
var decls = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
4898
var decls = tree.
GetRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
Semantics\ScriptSemanticsTests.cs (4)
1313
var x = syntaxTree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
1342
x = syntaxTree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
1357
x = syntaxTree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
1389
var node1 = (CompilationUnitSyntax)syntaxTree.
GetRoot
();
Semantics\SemanticErrorTests.cs (3)
7484
var node = tree.
GetRoot
().DescendantNodes().OfType<ElementAccessExpressionSyntax>().First();
13277
var node = tree.
GetRoot
().DescendantNodes().OfType<ElementAccessExpressionSyntax>().First();
24022
var node = tree.
GetRoot
().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().First();
Semantics\StructConstructorTests.cs (3)
1050
var syntax = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First();
1145
var syntax = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First();
1242
var syntax = tree.
GetRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First();
Semantics\SuppressAccessibilityChecksTests.cs (5)
54
var invocation = semanticModel.SyntaxTree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
72
var invocation = semanticModel.SyntaxTree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
87
var invocation = semanticModel.SyntaxTree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
169
var invocation = syntaxTree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
228
speculativeModel.SyntaxTree.
GetRoot
()
Semantics\SwitchTests.cs (1)
1154
var node = syntaxTree.
GetRoot
().DescendantNodes().First(x => x.IsKind(SyntaxKind.SimpleMemberAccessExpression));
Semantics\SyntaxTreeRootTests.cs (2)
44
Assert.Equal(typeof(CompilationUnitSyntax), tree.
GetRoot
().GetType());
108
Assert.Equal(tree, tree.
GetRoot
().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SyntaxTree);
Semantics\TargetTypedConditionalOperatorTests.cs (2)
668
var expr = tree.
GetRoot
().DescendantNodes().OfType<ConditionalExpressionSyntax>().Single();
689
var expr = tree.
GetRoot
().DescendantNodes().OfType<ConditionalExpressionSyntax>().Single();
Semantics\TopLevelStatementsTests.cs (99)
193
var unit1 = (CompilationUnitSyntax)tree1.
GetRoot
();
249
var symbolInfo = model1.GetSymbolInfo(tree1.
GetRoot
());
253
var typeInfo = model1.GetTypeInfo(tree1.
GetRoot
());
257
foreach (var globalStatement in tree1.
GetRoot
().DescendantNodes().OfType<GlobalStatementSyntax>())
318
var unit1 = (CompilationUnitSyntax)tree1.
GetRoot
();
356
var unit2 = (CompilationUnitSyntax)tree2.
GetRoot
();
400
var symbolInfo = model1.GetSymbolInfo(tree1.
GetRoot
());
404
var typeInfo = model1.GetTypeInfo(tree1.
GetRoot
());
408
foreach (var globalStatement in tree1.
GetRoot
().DescendantNodes().OfType<GlobalStatementSyntax>())
481
var localDecl = tree1.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
487
Assert.NotNull(model1.GetOperation(tree1.
GetRoot
()));
492
var localFuncRef = tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local").Single();
500
var localRef = tree2.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").Single();
507
Assert.NotNull(model2.GetOperation(tree2.
GetRoot
()));
533
var localDecl = tree1.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
540
var localRefs = tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").ToArray();
573
var localDecl = tree1.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
579
Assert.NotNull(model1.GetOperation(tree1.
GetRoot
()));
584
var localFuncRef = tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local").Single();
591
var localRef = tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").Single();
698
var declarator = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
699
var reference = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "s").Single();
871
var symbol1 = model1.GetDeclaredSymbol(tree1.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single());
873
Assert.Same(symbol1, model1.GetSymbolInfo(tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single()).Symbol);
877
var symbol2 = model2.GetDeclaredSymbol(tree2.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single());
879
Assert.Same(symbol2, model2.GetSymbolInfo(tree2.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single()).Symbol);
985
var symbol1 = model1.GetDeclaredSymbol(tree1.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().First());
987
Assert.Same(symbol1, model1.GetSymbolInfo(tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").First()).Symbol);
989
var symbol2 = model1.GetDeclaredSymbol(tree1.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Skip(1).Single());
991
Assert.Same(symbol1, model1.GetSymbolInfo(tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Skip(1).Single()).Symbol);
1040
var symbol1 = model1.GetDeclaredSymbol(tree1.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().First());
1042
Assert.Same(symbol1, model1.GetSymbolInfo(tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").Single()).Symbol);
1395
var nameRef = tree2.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
1399
Assert.Null(model2.GetOperation(tree2.
GetRoot
()));
1413
nameRef = tree2.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
1417
Assert.Null(model2.GetOperation(tree2.
GetRoot
()));
1508
var reference = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "c").Single();
1580
foreach (var id in tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>())
1586
foreach (var id in tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>())
1673
var localDecl = tree1.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().First();
1694
var nameRefs = tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray();
1846
var localDecl = tree1.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
1869
Assert.Null(model2.GetDeclaredSymbol((CompilationUnitSyntax)tree2.
GetRoot
()));
1870
var nameRefs = tree2.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray();
2072
var localDecl = tree1.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
2088
var nameRefs = tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray();
2236
var localDecl = tree1.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
2254
var nameRefs = tree2.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray();
2414
var labelDecl = tree1.
GetRoot
().DescendantNodes().OfType<LabeledStatementSyntax>().Single();
2434
var nameRefs = tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray();
2907
var nameRef = tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias1" && !id.Parent.IsKind(SyntaxKind.NameEquals)).Single();
2912
nameRef = tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias2").Single();
2929
nameRef = tree2.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias2" && !id.Parent.IsKind(SyntaxKind.NameEquals)).Single();
2934
nameRef = tree2.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias1").Single();
3929
var nameRefs = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").ToArray();
4078
var nameRefs = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").ToArray();
4203
var declarator = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
4204
var reference = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local").Single();
4217
VerifyFlowGraph(comp, tree.
GetRoot
(),
4498
var symbol1 = model1.GetDeclaredSymbol(tree1.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single());
4500
Assert.Same(symbol1, model1.GetSymbolInfo(tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").Single()).Symbol);
4504
var symbol2 = model2.GetDeclaredSymbol(tree2.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First());
4506
Assert.Same(symbol2, model2.GetSymbolInfo(tree2.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").Single()).Symbol);
4562
var symbol1 = model1.GetDeclaredSymbol(tree1.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First());
4564
Assert.Same(symbol1, model1.GetSymbolInfo(tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").First()).Symbol);
4566
var symbol2 = model1.GetDeclaredSymbol(tree1.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Skip(1).First());
4568
Assert.Same(symbol1, model1.GetSymbolInfo(tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").Skip(1).Single()).Symbol);
4611
var symbol1 = model1.GetDeclaredSymbol(tree1.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First());
4613
Assert.Same(symbol1, model1.GetSymbolInfo(tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").Single()).Symbol);
4881
var declarator = tree.
GetRoot
().DescendantNodes().OfType<LabeledStatementSyntax>().Single();
4882
var reference = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "label1").Single();
4938
var symbol1 = model1.GetDeclaredSymbol(tree1.
GetRoot
().DescendantNodes().OfType<LabeledStatementSyntax>().Single());
4940
Assert.Same(symbol1, model1.GetSymbolInfo(tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "label1").Single()).Symbol);
4944
var symbol2 = model2.GetDeclaredSymbol(tree2.
GetRoot
().DescendantNodes().OfType<LabeledStatementSyntax>().Single());
4947
Assert.Same(symbol2, model2.GetSymbolInfo(tree2.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "label1").Single()).Symbol);
4966
var declarator = tree.
GetRoot
().DescendantNodes().OfType<LabeledStatementSyntax>().Single();
4967
var reference = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").Single();
6018
var localDecl = tree1.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().First();
6022
var localRefs = tree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").ToArray();
6034
localDecl = tree1.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1);
6074
var localFunctions = syntaxTree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToList();
6148
.GetDeclaredSymbol(syntaxTree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single())
6220
var invocation = syntaxTree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
6264
var localDecl = syntaxTree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
6265
var localRef = syntaxTree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
6304
var localDecl = syntaxTree1.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
6305
var localRef = syntaxTree1.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
6354
var localDecl = syntaxTree1.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
6356
var localRef = syntaxTree2.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
8566
var invocations = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
8639
var id = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Single();
8661
var id = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ar").Single();
8683
var id = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ar").Single();
8779
(CSharpSyntaxNode)oldTree.
GetRoot
(), new[] { new TextChangeRange(new TextSpan(282, 0), 1) });
8787
var nodes1 = tree.
GetRoot
().DescendantNodesAndTokensAndSelf(descendIntoTrivia: true).ToArray();
8788
var nodes2 = fullParseTree.
GetRoot
().DescendantNodesAndTokensAndSelf(descendIntoTrivia: true).ToArray();
9665
var identifier = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var");
9669
Assert.Equal(OperationKind.Literal, model.GetOperation(tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Single()).Kind);
9690
var root = tree.
GetRoot
();
Semantics\TypeOfTests.cs (1)
33
var node = (ObjectCreationExpressionSyntax)tree.
GetRoot
().DescendantNodes().Where(n => n.ToString() == "new C(0)").Last();
Semantics\UnsafeTests.cs (2)
3464
var root = tree.
GetRoot
();
3541
var root = tree.
GetRoot
();
SourceGeneration\GeneratorDriverTests.cs (1)
1145
var rootFromGetRoot = tree.
GetRoot
();
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (336)
Compilation\CompilationAPITests.cs (4)
565
var rd1 = t1.
GetRoot
().GetDirectives().Cast<ReferenceDirectiveTriviaSyntax>().ToArray();
573
var rd2 = t2.
GetRoot
().GetDirectives().Cast<ReferenceDirectiveTriviaSyntax>().ToArray();
580
var rd3 = t3.
GetRoot
().GetDirectives().Cast<ReferenceDirectiveTriviaSyntax>().ToArray();
587
var rd4 = t4.
GetRoot
().GetDirectives().Cast<ReferenceDirectiveTriviaSyntax>().ToArray();
Compilation\GetSemanticInfoTests.cs (22)
2566
var expr = tree.
GetRoot
().DescendantNodes().OfType<ParameterSyntax>().First();
4436
var fieldSyntax = tree.
GetRoot
().DescendantNodes().OfType<FieldDeclarationSyntax>().Single();
4490
var memberAccessSyntax = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
4535
var callSyntax = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
4589
var memberAccesses = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToArray();
4641
var memberAccess = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
4687
int position = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First().SpanStart;
4732
int position = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First().SpanStart;
4752
var trueLiteral = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Single();
4785
var lambdaSyntax = tree.
GetRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single();
4828
var syntax = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
4875
var statement = tree.
GetRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single();
4910
var equalsToken = tree.
GetRoot
().FindToken(position);
5478
var invocationSyntax = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
5521
var lambdaSyntax = tree.
GetRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single();
5535
var lambdaSyntax = tree.
GetRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single();
5582
var nullSyntax = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Single();
5620
var lambdaSyntax = tree.
GetRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single();
5667
var lambdaSyntax = tree.
GetRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single();
5720
var methodGroupSyntax = tree.
GetRoot
().DescendantNodes().OfType<ArgumentSyntax>().Single().Expression;
5987
var root = tree.
GetRoot
();
6045
var typeParameters = tree.
GetRoot
().DescendantNodes().OfType<TypeParameterSyntax>().ToArray();
Compilation\GetUnusedImportDirectivesTests.cs (1)
93
var syntax = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression;
Compilation\ReferenceManagerTests.cs (2)
1353
var rd1 = (ReferenceDirectiveTriviaSyntax)t1.
GetRoot
().GetDirectives().Single();
1359
var rd2 = (ReferenceDirectiveTriviaSyntax)t2.
GetRoot
().GetDirectives().Single();
Compilation\SemanticModelAPITests.cs (31)
42
var root = tree.
GetRoot
();
109
SyntaxNode root = tree.
GetRoot
();
1728
var aliasDecl = tree.
GetRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().Single();
1739
var fieldDecl = tree.
GetRoot
().DescendantNodes().OfType<FieldDeclarationSyntax>().Single();
2310
var accessorSyntax = tree.
GetRoot
().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single();
2313
var statementSyntax = tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single();
3127
var syntax = tree.
GetRoot
().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single().
3259
var method1 = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression;
3300
var method1 = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression;
3341
var method1 = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression;
3375
var method1 = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression;
3417
var method1 = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression;
3458
var method1 = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression;
3499
var method1 = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression;
3741
var memberAccess = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
3785
var localFunctionBody = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
3819
var callSyntax = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
3846
var syntax = tree.
GetRoot
().DescendantNodes().OfType<AliasQualifiedNameSyntax>().Single();
3873
var methodDecl = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
3910
var method = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
4059
var x = tree.
GetRoot
().FindToken(match.Index + 4).Parent;
4107
var actual = tree.
GetRoot
().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray();
4144
var actual = tree.
GetRoot
().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray();
4187
var actual = tree.
GetRoot
().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray();
4211
var actual = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray();
4239
var actual = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray();
4277
var actual = tree.
GetRoot
().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray();
4424
var root = syntaxTree.
GetRoot
();
4457
var root = tree.
GetRoot
();
4611
var node = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(ident => ident.Identifier.Text == "global").Single();
4625
var nodes = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(ident => ident.Identifier.Text == "global").ToArray();
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (1)
5208
var node = tree.
GetRoot
().DescendantNodes().Single(node => node is IdentifierNameSyntax { Identifier: { ValueText: "b" } });
Compilation\SemanticModelGetSemanticInfoTests.cs (5)
14789
var nodes = (from node in tree.
GetRoot
().DescendantNodes()
14885
var nodes = (from node in tree.
GetRoot
().DescendantNodes()
14996
var nodes = (from node in tree.
GetRoot
().DescendantNodes()
15375
foreach (var qc in tree.
GetRoot
().DescendantNodes().OfType<QueryClauseSyntax>())
15380
var qe = tree.
GetRoot
().DescendantNodes().OfType<QueryExpressionSyntax>().Single();
Compilation\UsedAssembliesTests.cs (1)
136
var unit = (CompilationUnitSyntax)tree.
GetRoot
();
DocumentationComments\CrefTests.cs (1)
6333
var nonCrefPosition = tree.
GetRoot
().DescendantTrivia().Single(t => t.IsKind(SyntaxKind.SingleLineDocumentationCommentTrivia)).SpanStart;
SymbolDisplay\SymbolDisplayTests.cs (26)
5314
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
6297
var root = srcTree.
GetRoot
();
6340
var root = srcTree.
GetRoot
();
6374
var root = srcTree.
GetRoot
();
6436
var root = srcTree.
GetRoot
();
6469
var root = srcTree.
GetRoot
();
6530
var root = srcTree.
GetRoot
();
6563
var root = srcTree.
GetRoot
();
6608
var root = srcTree.
GetRoot
();
6731
var declarations = semanticModel.SyntaxTree.
GetRoot
().DescendantNodes().Where(n => n.Kind() == SyntaxKind.StructDeclaration).Cast<BaseTypeDeclarationSyntax>().ToArray();
6769
var declarations = semanticModel.SyntaxTree.
GetRoot
().DescendantNodes().Where(n => n.Kind() == SyntaxKind.StructDeclaration).Cast<BaseTypeDeclarationSyntax>().ToArray();
6807
var declarations = semanticModel.SyntaxTree.
GetRoot
().DescendantNodes().Where(n => n.Kind() == SyntaxKind.StructDeclaration).Cast<BaseTypeDeclarationSyntax>().ToArray();
6867
var declaration = (BaseTypeDeclarationSyntax)semanticModel.SyntaxTree.
GetRoot
().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration);
6939
var declaration = (BaseTypeDeclarationSyntax)semanticModel.SyntaxTree.
GetRoot
().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration);
7199
var declaration = (BaseTypeDeclarationSyntax)semanticModel.SyntaxTree.
GetRoot
().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration);
7352
var declaration = (BaseTypeDeclarationSyntax)semanticModel.SyntaxTree.
GetRoot
().DescendantNodes().Single(n => n.Kind() == SyntaxKind.StructDeclaration);
7380
var structure = semanticModel.SyntaxTree.
GetRoot
().DescendantNodes().Single(n => n.RawKind == (int)VisualBasic.SyntaxKind.StructureStatement);
7601
var variable = tree.
GetRoot
().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single().Variable;
7696
var constructor = tree.
GetRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
7756
var constructor = tree.
GetRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
7788
var continuation = tree.
GetRoot
().DescendantNodes().OfType<QueryContinuationSyntax>().Single();
8091
var declaration = (LocalDeclarationStatementSyntax)semanticModel.SyntaxTree.
GetRoot
().DescendantNodes().Single(n => n.Kind() == SyntaxKind.LocalDeclarationStatement);
8142
var declaration = (LocalDeclarationStatementSyntax)semanticModel.SyntaxTree.
GetRoot
().DescendantNodes().Single(n => n.Kind() == SyntaxKind.LocalDeclarationStatement);
8176
var name = tree.
GetRoot
().DescendantNodes().OfType<VisualBasic.Syntax.VariableDeclaratorSyntax>().Single();
8500
var decls = tree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
8556
var binaryExpression = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
Symbols\AccessorOverriddenOrHiddenMembersTests.cs (1)
1005
var nodes = syntaxTree.
GetRoot
().DescendantNodes();
Symbols\CheckedUserDefinedOperatorsTests.cs (10)
7210
var xNode = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
7211
var yNode = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single();
7282
var xNode = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
7283
var yNode = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single();
7353
var xNode = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
7354
var yNode = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single();
7426
var xNode = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
7427
var yNode = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single();
7490
var xNode = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
7491
var yNode = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single();
Symbols\ConversionTests.cs (4)
1727
var castSyntax = tree.
GetRoot
().DescendantNodes().OfType<CastExpressionSyntax>().Single();
1734
var forEachSyntax = tree.
GetRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
1797
var syntax = tree.
GetRoot
().DescendantNodes().OfType<CastExpressionSyntax>().Single();
1831
var syntax = tree.
GetRoot
().DescendantNodes().OfType<CastExpressionSyntax>().Single();
Symbols\CovariantReturnTests.cs (2)
379
foreach (var declaration in tree.
GetRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>())
2622
foreach (var localDeclaration in vbTree.
GetRoot
().DescendantNodes().OfType<VisualBasic.Syntax.LocalDeclarationStatementSyntax>())
Symbols\EnumTests.cs (1)
353
var expr = tree.
GetRoot
().DescendantNodes().Single(n => n.Kind() == SyntaxKind.BitwiseNotExpression);
Symbols\ExtensionMethodTests.cs (5)
3784
var member = (MemberAccessExpressionSyntax)syntaxTree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression;
3872
var instance = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Instance").First();
3919
var instance = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Instance").First();
3964
var instance = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Instance").First();
4014
var instance = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Instance").First();
Symbols\FunctionPointerTypeSymbolTests.cs (16)
51
var paramType = syntaxTree.
GetRoot
()
124
var parameterDecls = syntaxTree.
GetRoot
().DescendantNodes()
204
var parameterDecls = syntaxTree.
GetRoot
().DescendantNodes()
285
syntaxTree.
GetRoot
().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(),
339
var functionPointers = syntaxTree.
GetRoot
().DescendantNodes().OfType<FunctionPointerTypeSyntax>().ToArray();
405
var parameterDecls = syntaxTree.
GetRoot
().DescendantNodes()
485
var parameterDecls = syntaxTree.
GetRoot
().DescendantNodes()
602
var parameterDecls = syntaxTree.
GetRoot
().DescendantNodes()
684
var paramType = syntaxTree.
GetRoot
()
1148
var functionPointerTypeSyntax = syntaxTree.
GetRoot
()
1259
var functionPointerTypeSyntax = syntaxTree.
GetRoot
()
1316
var baseNameSyntax = syntaxTree.
GetRoot
()
1430
var anonymousObjectCreations = syntaxTree.
GetRoot
()
1691
var mDeclSyntax = syntaxTree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Skip(2).Single();
1802
var methodDecls = syntaxTree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray();
1929
var decls = syntaxTree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
Symbols\Metadata\MetadataTypeTests.cs (2)
371
var id = newTree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(s => s.ToString() == "StaticModClass").First();
386
id = newTree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(s => s.ToString() == "StaticModClass").First();
Symbols\RelaxedShiftOperatorTests.cs (6)
102
var shift = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
146
var shift = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
190
var shift = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
234
var shift = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
278
var shift = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
322
var shift = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
Symbols\Source\BaseClassTests.cs (1)
2031
var baseY = tree.
GetRoot
().DescendantNodes().Where(n => n.ToString() == "y").OfType<ExpressionSyntax>().First();
Symbols\Source\DeclaringSyntaxNodeTests.cs (1)
140
var node = tree.
GetRoot
().FindToken(position).Parent.FirstAncestorOrSelf<TNode>();
Symbols\Source\DelegateTests.cs (2)
735
var root = syntaxTree.
GetRoot
();
763
var root = syntaxTree.
GetRoot
();
Symbols\Source\EventTests.cs (2)
435
var lambdaSyntax = tree.
GetRoot
().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().First();
481
var lambdaSyntax = tree.
GetRoot
().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().First();
Symbols\Source\ExternAliasTests.cs (1)
478
var root = tree.
GetRoot
();
Symbols\Source\FileModifierTests.cs (19)
952
var cReference = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last().Expression;
1086
var cReference = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last().Expression;
1152
var cReference = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last().Expression;
1210
var cReference = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last().Expression;
1524
var cReference = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last();
1599
var cReference = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last();
2223
var node = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Last();
2262
var node = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Last();
2952
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
3001
var invocation = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
3054
var invoked = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression;
3083
var body = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!;
3153
var body = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!;
3215
var body = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!;
3256
var body = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!;
3554
var voidTypeSyntax = tree.
GetRoot
().DescendantNodes().OfType<ParameterSyntax>().Single().Type!;
3770
var node = tree.
GetRoot
().DescendantNodes().OfType<ParameterSyntax>().Single();
3814
var node = tree.
GetRoot
().DescendantNodes().OfType<ParameterSyntax>().Single();
3837
var node = tree.
GetRoot
().DescendantNodes().OfType<ParameterSyntax>().Single();
Symbols\Source\LocalTests.cs (1)
59
var expressionSyntax = tree.
GetRoot
().DescendantNodes().
Symbols\Source\MethodTests.cs (5)
236
var node = tree.
GetRoot
().DescendantNodes().OfType<PredefinedTypeSyntax>().Where(n => n.Keyword.Kind() == SyntaxKind.VoidKeyword).First();
264
var node = tree.
GetRoot
().DescendantNodes().OfType<PredefinedTypeSyntax>().Where(n => n.Keyword.Kind() == SyntaxKind.VoidKeyword).Last();
288
var tree = comp.SyntaxTrees.Single().
GetRoot
();
309
var tree = comp.SyntaxTrees.Single().
GetRoot
();
2540
var methods = syntax.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray();
Symbols\Source\NullablePublicAPITests.cs (96)
50
var root = syntaxTree.
GetRoot
();
84
var root = syntaxTree.
GetRoot
();
568
return syntaxTree.
GetRoot
().DescendantNodes().OfType<CSharp.Syntax.LocalFunctionStatementSyntax>().Select(func => semanticModel.GetDeclaredSymbol(func)).Cast<IMethodSymbol>().ToArray();
943
var invocations = syntaxTree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>();
1000
var variables = syntaxTree.
GetRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>();
1091
var root = syntaxTree.
GetRoot
();
1118
var root = syntaxTree.
GetRoot
();
1206
var root = syntaxTree.
GetRoot
();
1258
var root = syntaxTree.
GetRoot
();
1356
var root = syntaxTree.
GetRoot
();
1436
var root = syntaxTree.
GetRoot
();
1508
var root = syntaxTree.
GetRoot
();
1564
var root = syntaxTree.
GetRoot
();
1621
var root = syntaxTree.
GetRoot
();
1667
var root = syntaxTree.
GetRoot
();
1710
var root = syntaxTree.
GetRoot
();
1849
var root = syntaxTree.
GetRoot
();
1892
var root = syntaxTree.
GetRoot
();
1937
var root = syntaxTree.
GetRoot
();
1984
var root = syntaxTree.
GetRoot
();
2045
var root = syntaxTree.
GetRoot
();
2088
var root = syntaxTree.
GetRoot
();
2131
var root = syntaxTree.
GetRoot
();
2174
var root = syntaxTree.
GetRoot
();
2216
var root = syntaxTree.
GetRoot
();
2246
var root = syntaxTree.
GetRoot
();
2281
var root = syntaxTree.
GetRoot
();
2325
var root = syntaxTree.
GetRoot
();
2366
var root = syntaxTree.
GetRoot
();
2411
var root = syntaxTree.
GetRoot
();
2451
var root = syntaxTree.
GetRoot
();
2499
var root = syntaxTree.
GetRoot
();
2544
var root = syntaxTree.
GetRoot
();
2593
var root = syntaxTree.
GetRoot
();
2627
var root = syntaxTree.
GetRoot
();
2661
var root = syntaxTree.
GetRoot
();
2699
var root = syntaxTree.
GetRoot
();
2735
var root = syntaxTree.
GetRoot
();
2781
var root = syntaxTree.
GetRoot
();
2824
var root = syntaxTree.
GetRoot
();
2873
var root = syntaxTree.
GetRoot
();
2914
var root = syntaxTree.
GetRoot
();
2955
var root = syntaxTree.
GetRoot
();
2997
var root = syntaxTree.
GetRoot
();
3039
var root = syntaxTree.
GetRoot
();
3099
var root = syntaxTree.
GetRoot
();
3146
var root = syntaxTree.
GetRoot
();
3191
var root = syntaxTree.
GetRoot
();
3256
var root = syntaxTree.
GetRoot
();
3308
var root = syntaxTree.
GetRoot
();
3357
var root = syntaxTree.
GetRoot
();
3404
var root = syntaxTree.
GetRoot
();
3449
var root = syntaxTree.
GetRoot
();
3486
var root = syntaxTree.
GetRoot
();
3535
var root = syntaxTree.
GetRoot
();
3596
var root = syntaxTree.
GetRoot
();
3659
var root = syntaxTree.
GetRoot
();
3698
var localFunctionBody = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
3733
var localFunctionBody = tree.
GetRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
3767
var root = syntaxTree.
GetRoot
();
3806
var root = syntaxTree.
GetRoot
();
3852
var root = syntaxTree.
GetRoot
();
3911
var root = syntaxTree.
GetRoot
();
3976
var root = syntaxTree.
GetRoot
();
4045
var root = syntaxTree.
GetRoot
();
4112
var root = syntaxTree.
GetRoot
();
4175
var root = syntaxTree.
GetRoot
();
4209
var root = syntaxTree.
GetRoot
();
4243
var typeOf = syntaxTree.
GetRoot
().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single();
4270
var root = syntaxTree.
GetRoot
();
4304
var root = syntaxTree.
GetRoot
();
4336
var exprs = tree.
GetRoot
().DescendantNodes().OfType<DefaultExpressionSyntax>().ToArray();
4366
var type = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type;
4394
var type = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type;
4422
var type = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type;
4452
var type = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type;
4482
var type = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type;
4512
var type = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type;
4544
var type = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type;
4577
var type = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type;
4605
var type = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type;
4638
var initializer = tree.
GetRoot
().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single();
4669
var initializer = tree.
GetRoot
().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single();
4700
var initializer = tree.
GetRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single();
4731
var suppressions = tree.
GetRoot
().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Where(p => p.IsKind(SyntaxKind.SuppressNullableWarningExpression)).ToList();
4781
var invocations = syntaxTree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>();
4817
var memberAccesses = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToArray();
4903
var ctorDecl = tree.
GetRoot
()
4934
var localFunction = tree.
GetRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
4967
var ternary = tree.
GetRoot
().DescendantNodes().OfType<ConditionalExpressionSyntax>().Single();
5011
var tupleLiteral = tree.
GetRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
5057
var constructor = tree.
GetRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
5073
var switchExpressionInput = tree.
GetRoot
().DescendantNodes().OfType<SwitchExpressionSyntax>().Single().GoverningExpression;
5110
var binaryRight = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single().Right;
5142
var binaryRight = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single().Right;
5170
var binaryRightArgument = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single().Right.DescendantNodes().OfType<ArgumentSyntax>().Single().Expression;
Symbols\Source\UpdatedContainingSymbolAndNullableAnntotationTests.cs (1)
34
var root = syntaxTree.
GetRoot
();
Symbols\Source\UsingAliasTests.cs (2)
696
var node = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Short").Skip(1).Single();
739
var node = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Short").Skip(1).Single();
Symbols\StaticAbstractMembersInInterfacesTests.cs (28)
8453
var node = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First();
9041
var node = postfixOp != "" ? (ExpressionSyntax)tree.
GetRoot
().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First() : tree.
GetRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().First();
9356
var node = tree.
GetRoot
().DescendantNodes().OfType<ConditionalExpressionSyntax>().First();
9755
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().First();
10752
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + " 1").Single();
10945
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + " 1").Single();
11135
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + " y").Single();
11329
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + op + " y").First();
11583
var node1 = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + op + " y").First();
11960
var node = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(n => n.ToString() == "x " + op + "= 1").Single();
12139
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().First();
13192
var node = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Right;
13278
var node = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Left;
13400
var node = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Left;
14113
var node = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Left;
14122
node = tree.
GetRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().First().ArgumentList.Arguments[0].Expression;
14738
var node = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First();
15144
var node = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First();
15412
var node = tree.
GetRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First();
19584
var node = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First();
19667
var node = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First();
19759
var node = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First();
19848
var node = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First();
28797
var node = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First();
30304
var node = tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().First();
30495
var node = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().First();
30961
var node = tree.
GetRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().First();
Symbols\SymbolEqualityTests.cs (18)
40
var root = tree.
GetRoot
();
83
var root = tree.
GetRoot
();
123
var root = tree.
GetRoot
();
164
var root = tree.
GetRoot
();
410
var root = syntaxTree.
GetRoot
();
448
var root = syntaxTree.
GetRoot
();
479
var root = syntaxTree.
GetRoot
();
522
var root = syntaxTree.
GetRoot
();
553
var root = syntaxTree.
GetRoot
();
589
var root = syntaxTree.
GetRoot
();
623
var root = syntaxTree.
GetRoot
();
672
var root = syntaxTree.
GetRoot
();
724
var root = syntaxTree.
GetRoot
();
774
var root = syntaxTree.
GetRoot
();
825
var root = syntaxTree.
GetRoot
();
886
var root = syntaxTree.
GetRoot
();
933
var root = syntaxTree.
GetRoot
();
961
var syntaxNode = syntaxTree.
GetRoot
().DescendantNodes().
Symbols\SymbolExtensionTests.cs (5)
101
var identifier = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var");
119
var identifier = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var");
137
var identifier = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var");
156
var identifier = tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Last(id => id.Identifier.Text == "var");
252
var method = model.GetSymbolInfo(tree.
GetRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Method").Single()).Symbol.GetSymbol<MethodSymbol>();
Symbols\UnsignedRightShiftTests.cs (13)
123
var unsignedShift = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First();
124
var shift = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.RightShiftExpression).First();
626
var unsignedShift = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftAssignmentExpression).First();
627
var shift = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.RightShiftAssignmentExpression).First();
1176
var unsignedShift = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First();
1177
var shift = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.RightShiftExpression).First();
1584
var unsignedShift = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftAssignmentExpression).First();
1585
var shift = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.RightShiftAssignmentExpression).First();
1983
var unsignedShift = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First();
2235
var unsignedShift = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First();
2377
var unsignedShift = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftAssignmentExpression).First();
2511
var unsignedShift = tree.
GetRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First();
2608
var unsignedShift = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftAssignmentExpression).First();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (87)
Diagnostics\DiagnosticTest.cs (1)
1949
var nodes = ParseWithRoundTripCheck(text).
GetRoot
().DescendantNodes(descendIntoTrivia: true);
Diagnostics\LineSpanDirectiveTests.cs (2)
446
foreach (var syntax in tree.
GetRoot
().DescendantNodesAndSelf())
466
var directives = tree.
GetRoot
().DescendantNodesAndSelf(descendIntoTrivia: true).OfType<DirectiveTriviaSyntax>();
Diagnostics\LocationsTests.cs (2)
561
var treeSpan = tree.
GetRoot
().FullSpan;
589
var treeSpan = tree.
GetRoot
().FullSpan;
IncrementalParsing\IncrementalParsingTests.cs (3)
2679
var tempRoot = tempTree.
GetRoot
();
2735
WalkTreeAndVerify(incrTree.
GetRoot
(), fullTree.
GetRoot
());
LexicalAndXml\LexicalTests.cs (1)
3409
Assert.False(tree.
GetRoot
().DescendantTokens().Any(
Parsing\ExpressionParsingTests.cs (1)
3135
var root = SyntaxFactory.ParseSyntaxTree(text).
GetRoot
();
Parsing\FileModifierParsingTests.cs (1)
35
Validate(text, (CSharpSyntaxNode)tree.
GetRoot
(), expectedParsingDiagnostics);
Parsing\ParserErrorMessageTests.cs (7)
3846
var methodDeclaration = (MethodDeclarationSyntax)tree.
GetRoot
().DescendantNodes().Single(node => node is MethodDeclarationSyntax);
3849
var delegateDeclaration = (DelegateDeclarationSyntax)tree.
GetRoot
().DescendantNodes().Single(node => node is DelegateDeclarationSyntax);
3852
var localFunctionStatement = (LocalFunctionStatementSyntax)tree.
GetRoot
().DescendantNodes().Single(node => node is LocalFunctionStatementSyntax);
3855
var lambdaExpression = (ParenthesizedLambdaExpressionSyntax)tree.
GetRoot
().DescendantNodes().Single(node => node is ParenthesizedLambdaExpressionSyntax);
3858
var anonymousMethodExpression = (AnonymousMethodExpressionSyntax)tree.
GetRoot
().DescendantNodes().Single(node => node is AnonymousMethodExpressionSyntax);
3861
var indexerDeclaration = (IndexerDeclarationSyntax)tree.
GetRoot
().DescendantNodes().Single(node => node is IndexerDeclarationSyntax);
3864
var operatorDeclaration = (OperatorDeclarationSyntax)tree.
GetRoot
().DescendantNodes().Single(node => node is OperatorDeclarationSyntax);
Parsing\ParsingErrorRecoveryTests.cs (13)
6971
var toString = tree.
GetRoot
().ToFullString();
6986
var toString = tree.
GetRoot
().ToFullString();
7017
var toString = tree.
GetRoot
().ToFullString();
7051
var toString = tree.
GetRoot
().ToFullString();
7076
var toString = tree.
GetRoot
().ToFullString();
7103
var toString = tree.
GetRoot
().ToFullString();
7117
var toString = tree.
GetRoot
().ToFullString();
7129
var eofToken = ((CompilationUnitSyntax)tree.
GetRoot
()).EndOfFileToken;
7143
var root = SyntaxFactory.ParseSyntaxTree(source).
GetRoot
();
7164
var root = SyntaxFactory.ParseSyntaxTree(source).
GetRoot
();
7185
var root = SyntaxFactory.ParseSyntaxTree(source).
GetRoot
();
7208
var root = SyntaxFactory.ParseSyntaxTree(source).
GetRoot
();
7232
var root = SyntaxFactory.ParseSyntaxTree(source).
GetRoot
();
Parsing\RecordParsing.cs (2)
278
UsingNode((CSharpSyntaxNode)tree.
GetRoot
());
311
UsingNode((CSharpSyntaxNode)tree.
GetRoot
());
Parsing\StatementParsingTests.cs (4)
3408
var root = tree.
GetRoot
();
3435
var root = tree.
GetRoot
();
3458
var root = tree.
GetRoot
();
3529
tree.GetDiagnostics(tree.
GetRoot
()).Verify(
Syntax\LambdaUtilitiesTests.cs (2)
51
var node = tree.
GetRoot
().FindNode(span.Value);
57
var methodDef = tree.
GetRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(d => d.Identifier.ValueText == "M").Single();
Syntax\SyntaxDiffingTests.cs (2)
284
var root = oldTree.
GetRoot
();
344
var root = oldTree.
GetRoot
();
Syntax\SyntaxEquivalenceTests.cs (5)
39
Assert.True(SyntaxFactory.AreEquivalent(node1, tree3.
GetRoot
(), ignoreChildNode));
491
VerifyEquivalent(tree1.
GetRoot
(), tree2.
GetRoot
(), ignoreChildNode: k => k == SyntaxKind.NullableDirectiveTrivia);
512
VerifyEquivalent(tree3.
GetRoot
(), tree4.
GetRoot
(), ignoreChildNode: k => k == SyntaxKind.NullableDirectiveTrivia);
Syntax\SyntaxListTests.cs (3)
324
var node = tree.
GetRoot
().DescendantNodes().OfType<InitializerExpressionSyntax>().First();
348
var node = tree.
GetRoot
().DescendantNodes().OfType<InitializerExpressionSyntax>().First();
394
return tree.
GetRoot
().DescendantNodes().OfType<InitializerExpressionSyntax>().First();
Syntax\SyntaxNodeTests.cs (15)
46
var directives = tree.
GetRoot
().GetDirectives();
703
var root = tree.
GetRoot
();
1057
List<SyntaxToken> tokens = syntaxTree.
GetRoot
().DescendantTokens().ToList();
1060
SyntaxToken token = syntaxTree.
GetRoot
().GetFirstToken();
1162
List<SyntaxToken> tokens = syntaxTree.
GetRoot
().DescendantTokens().ToList();
1165
var token = syntaxTree.
GetRoot
().GetLastToken(includeZeroWidth: false); // skip EOF
1207
List<SyntaxToken> tokens = syntaxTree.
GetRoot
().DescendantTokens().ToList();
1210
SyntaxToken token = syntaxTree.
GetRoot
().GetFirstToken(includeZeroWidth: true);
1252
List<SyntaxToken> tokens = syntaxTree.
GetRoot
().DescendantTokens().ToList();
1798
var nodeOrToken = (SyntaxNodeOrToken)syntaxTree.
GetRoot
();
2021
var actualTokens = syntaxTree.
GetRoot
().DescendantTokens(syntaxTree.
GetRoot
().FullSpan);
3577
var root = (CompilationUnitSyntax)tree.
GetRoot
();
3627
var root = (CompilationUnitSyntax)tree.
GetRoot
();
3660
var root = (CompilationUnitSyntax)tree.
GetRoot
();
Syntax\SyntaxRewriterTests.cs (19)
317
Assert.Same(node, node.SyntaxTree.
GetRoot
());
326
Assert.Same(node1, node1.SyntaxTree.
GetRoot
());
330
Assert.Same(node2, node2.SyntaxTree.
GetRoot
());
342
Assert.Same(newRoot, newRoot.SyntaxTree.
GetRoot
());
354
Assert.Same(newRoot, newRoot.SyntaxTree.
GetRoot
());
362
var root = tree.
GetRoot
();
381
var root = tree.
GetRoot
();
400
var root = tree.
GetRoot
();
425
var root = tree.
GetRoot
();
443
var root = tree.
GetRoot
();
466
var root = tree.
GetRoot
();
493
var root = tree.
GetRoot
();
515
var root = tree.
GetRoot
();
528
var root = tree.
GetRoot
();
545
Assert.Same(rewrittenRoot, rewrittenRoot.SyntaxTree.
GetRoot
());
560
Assert.Same(ifStmt1, expr1.SyntaxTree.
GetRoot
());
578
Assert.Same(ifStmt2, expr2.SyntaxTree.
GetRoot
());
624
Assert.Same(ifStmt2, expr2.SyntaxTree.
GetRoot
());
650
var oldRoot = oldTree.
GetRoot
();
Syntax\SyntaxTreeTests.cs (4)
249
Assert.Equal(newRoot.ToString(), newTree.
GetRoot
().ToString());
267
Assert.Equal(newRoot.ToString(), newTree.
GetRoot
().ToString());
280
Assert.Equal(newRoot.ToString(), newTree.
GetRoot
().ToString());
332
Assert.Equal(string.Empty, CSharpSyntaxTree.Create((CSharpSyntaxNode)oldTree.
GetRoot
()).FilePath);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (10)
CompilationTestUtils.cs (1)
456
var root = tree.
GetRoot
();
CSharpTestBase.cs (6)
1023
var parsedText = tree.
GetRoot
();
1255
bool hasTopLevelStatements = syntaxTrees.Any(s => s.
GetRoot
().ChildNodes().OfType<GlobalStatementSyntax>().Any());
1480
return GetSyntaxNodeList(syntaxTree.
GetRoot
(), null);
1613
string text = tree.
GetRoot
().ToFullString();
1657
string text = tree.
GetRoot
().ToFullString();
1672
var node = tree.
GetRoot
().FindToken(start).Parent;
CSharpTestSource.cs (1)
49
var root = tree.
GetRoot
();
SemanticModelTestBase.cs (2)
35
return GetExprSyntaxList(syntaxTree.
GetRoot
(), null);
141
var nameSyntaxToBind = tree.
GetRoot
().FindToken(position, findInsideTrivia: true).Parent as IdentifierNameSyntax;
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (2)
CodeGen\WinMdEventTests.cs (1)
670
var syntax = tree.
GetRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
CodeGen\WinRTCollectionTests.cs (1)
7423
var add = tree.
GetRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.IdentifierName) && ((IdentifierNameSyntax)n).Identifier.ValueText == "Add").Single();
Microsoft.CodeAnalysis.CSharp.Workspaces (24)
CSharpCodeGenerationHelpers.cs (2)
82
return (TypeDeclarationSyntax)tree.
GetRoot
(cancellationToken);
203
return contextTree?.
GetRoot
(cancellationToken).FindToken(contextLocation!.SourceSpan.Start).Parent;
CSharpSyntaxFacts.cs (1)
1096
var trivia = syntaxTree.
GetRoot
(cancellationToken).FindTrivia(position, findInsideTrivia: false);
CSharpTypeInferenceService.TypeInferrer.cs (1)
2104
var tokenInOriginalTree = originalSemanticModel.SyntaxTree.
GetRoot
(CancellationToken).FindToken(currentSemanticModel.OriginalPositionForSpeculation);
CSharpUnnecessaryImportsProvider.cs (1)
28
var root = model.SyntaxTree.
GetRoot
(cancellationToken);
CSharpUseImplicitTypeHelper.cs (2)
191
var root = tree.
GetRoot
(cancellationToken);
204
var newDeclarationTypeNode = newTree.
GetRoot
(cancellationToken).GetAnnotatedNodes(annotation).Single();
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (1)
37
directive.FullSpan.End == syntaxTree.
GetRoot
(cancellationToken).FullSpan.End;
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (5)
221
var root = (CompilationUnitSyntax)syntaxTree.
GetRoot
(cancellationToken);
265
var trivia = syntaxTree.
GetRoot
(cancellationToken).FindTrivia(position);
418
var token = syntaxTree.
GetRoot
(cancellationToken).FindToken(position, findInsideTrivia: true);
461
var root = (CompilationUnitSyntax)syntaxTree.
GetRoot
(cancellationToken);
513
var trivia = syntaxTree.
GetRoot
(cancellationToken).FindTrivia(position, findInsideTrivia: false);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs\CompilationUnitSyntaxExtensions.cs (1)
31
var root = (CompilationUnitSyntax)contextNode.SyntaxTree.
GetRoot
(cancellationToken);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (2)
430
if (syntaxTree.
GetRoot
(cancellationToken) is CompilationUnitSyntax compilationUnit &&
1978
if (syntaxTree.
GetRoot
(cancellationToken) is CompilationUnitSyntax compilationUnit &&
Recommendations\CSharpRecommendationServiceRunner.cs (1)
195
var compUnit = (CompilationUnitSyntax)syntaxTree.
GetRoot
(_cancellationToken);
Rename\CSharpRenameRewriterLanguageService.cs (2)
294
var speculativeTree = originalNode.SyntaxTree.
GetRoot
(_cancellationToken).ReplaceNode(originalNode, newNode);
309
speculativeTree = originalNode.SyntaxTree.
GetRoot
(_cancellationToken).ReplaceNode(originalNode, newNode);
Simplification\CSharpSimplificationService.cs (1)
189
var root = model.SyntaxTree.
GetRoot
(cancellationToken);
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (2)
222
var root = (CompilationUnitSyntax)model.SyntaxTree.
GetRoot
(cancellationToken);
372
token = originalSemanticMode.SyntaxTree.
GetRoot
(cancellationToken).FindToken(semanticModel.OriginalPositionForSpeculation);
SuppressFormattingRule.cs (1)
331
? ((CompilationUnitSyntax)structure.SyntaxTree.
GetRoot
(CancellationToken.None)).EndOfFileToken
SyntaxTriviaExtensions.cs (1)
162
return syntaxTree.
GetRoot
(cancellationToken).FindTrivia(span.Start - 1, findInsideTrivia);
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (3)
CodeGeneration\SyntaxGeneratorTests.cs (1)
4702
var root = tree.
GetRoot
();
CSharpSyntaxFactsServiceTests.cs (1)
19
var token = tree.
GetRoot
().FindToken(position);
EmbeddedLanguages\VirtualChars\CSharpVirtualCharServiceTests.cs (1)
122
var compilationUnit = (CompilationUnitSyntax)tree.
GetRoot
();
Microsoft.CodeAnalysis.EditorFeatures (3)
CommentSelection\AbstractCommentSelectionBase.cs (1)
153
var newRoot = oldSyntaxTree.WithChangedText(newText).
GetRoot
(cancellationToken);
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCommitter.cs (1)
190
var documentWithOriginalName = document.WithSyntaxRoot(syntaxTreeWithOriginalName.
GetRoot
(cancellationToken));
TextStructureNavigation\AbstractTextStructureNavigatorProvider.TextStructureNavigator.cs (1)
331
token = syntaxTree.
GetRoot
(cancellationToken).FindToken(point, true);
Microsoft.CodeAnalysis.EditorFeatures.Cocoa (2)
Snippets\CSharpSnippets\SnippetCommandHandler.cs (2)
112
var token = syntaxTree.
GetRoot
(cancellationToken).FindToken(startPosition);
113
var trivia = syntaxTree.
GetRoot
(cancellationToken).FindTrivia(startPosition);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (5)
EditAndContinue\EditAndContinueTestHelpers.cs (3)
61
var oldRoot = oldTree.
GetRoot
();
142
var oldRoot = oldTree.
GetRoot
();
143
var newRoot = newTree.
GetRoot
();
Semantics\SpeculationAnalyzerTestsBase.cs (2)
36
var initialNode = initialTree.
GetRoot
().DescendantNodes().First(n => IsExpressionNode(n) && n.ToString() == (expressionToAnalyze ?? initialExpression));
39
var replacementNode = replacementTree.
GetRoot
().DescendantNodes().First(n => IsExpressionNode(n) && n.ToString() == (expressionToAnalyze ?? replacementExpression));
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (15)
CodeGeneration\CodeGenerationTests.cs (6)
556
testContext.Result = testContext.Document.WithSyntaxRoot(testContext.SemanticModel.SyntaxTree.
GetRoot
().ReplaceNode(oldNode, newNode));
575
testContext.Result = testContext.Document.WithSyntaxRoot(testContext.SemanticModel.SyntaxTree.
GetRoot
().ReplaceNode(declarationNode, newNode));
627
testContext.Result = testContext.Document.WithSyntaxRoot(testContext.SemanticModel.SyntaxTree.
GetRoot
().ReplaceNode(declarationNode, updatedDeclarationNode));
900
return SemanticModel.SyntaxTree.
GetRoot
().FindNode(destSpan, getInnermostNodeForTie: true);
921
var token = semanticModel.SyntaxTree.
GetRoot
().FindToken(selection.Start);
933
var token = SemanticModel.SyntaxTree.
GetRoot
().FindToken(destSpan.Start);
Diagnostics\DiagnosticAnalyzerServiceTests.cs (7)
1253
context.RegisterSyntaxTreeAction(c => c.ReportDiagnostic(Diagnostic.Create(s_syntaxRule, c.Tree.
GetRoot
().GetLocation())));
1254
context.RegisterSemanticModelAction(c => c.ReportDiagnostic(Diagnostic.Create(s_semanticRule, c.SemanticModel.SyntaxTree.
GetRoot
().GetLocation())));
1255
context.RegisterCompilationAction(c => c.ReportDiagnostic(Diagnostic.Create(s_compilationRule, c.Compilation.SyntaxTrees.First().
GetRoot
().GetLocation())));
1269
context.RegisterSyntaxTreeAction(c => c.ReportDiagnostic(Diagnostic.Create(s_syntaxRule, c.Tree.
GetRoot
().GetLocation())));
1270
context.RegisterSemanticModelAction(c => c.ReportDiagnostic(Diagnostic.Create(s_semanticRule, c.SemanticModel.SyntaxTree.
GetRoot
().GetLocation())));
1271
context.RegisterCompilationAction(c => c.ReportDiagnostic(Diagnostic.Create(s_compilationRule, c.Compilation.SyntaxTrees.First().
GetRoot
().GetLocation())));
1282
=> context.RegisterSyntaxTreeAction(c => c.ReportDiagnostic(Diagnostic.Create(s_syntaxRule, c.Tree.
GetRoot
().GetLocation())));
EditAndContinue\RudeEditDiagnosticTests.cs (1)
23
var syntaxNode = tree.
GetRoot
();
SymbolKey\SymbolKeyCrossLanguageTests.cs (1)
45
var root = tree.
GetRoot
();
Microsoft.CodeAnalysis.EditorFeatures.Wpf (1)
Peek\PeekHelpers.cs (1)
50
var root = identifierLocation.SourceTree.
GetRoot
(cancellationToken);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (5)
Diagnostics\DiagnosticServiceTests.vb (1)
1784
context.ReportDiagnostic(Diagnostic.Create(Descriptor, context.Compilation.SyntaxTrees(0).
GetRoot
().GetLocation))
Rename\RenameEngineResult.vb (1)
223
Dim newToken = newTree.
GetRoot
.FindToken(newLocation.Start, findInsideTrivia:=True)
Rename\RenameViewModelTests.vb (3)
566
Dim token = document.GetSyntaxTreeAsync().Result.
GetRoot
().FindToken(cursorPosition)
576
document, document.GetSyntaxTreeAsync().Result.
GetRoot
().FindToken(cursorPosition).Span, CancellationToken.None)
707
document, document.GetSyntaxTreeAsync().Result.
GetRoot
().FindToken(cursorPosition).Span, CancellationToken.None)
Microsoft.CodeAnalysis.Features (32)
AbstractAddAccessibilityModifiersDiagnosticAnalyzer.cs (1)
39
ProcessCompilationUnit(context, option, (TCompilationUnitSyntax)context.Tree.
GetRoot
(context.CancellationToken));
AbstractConsecutiveStatementPlacementDiagnosticAnalyzer.cs (1)
46
var root = context.Tree.
GetRoot
(cancellationToken);
AbstractFileHeaderDiagnosticAnalyzer.cs (1)
44
var root = tree.
GetRoot
(context.CancellationToken);
AbstractMatchFolderAndNamespaceDiagnosticAnalyzer.cs (1)
93
var root = namespaceDeclaration.SyntaxTree.
GetRoot
(cancellationToken);
AbstractMultipleBlankLinesDiagnosticAnalyzer.cs (1)
42
var root = context.Tree.
GetRoot
(cancellationToken);
AbstractOrderModifiersDiagnosticAnalyzer.cs (1)
49
var root = context.Tree.
GetRoot
(context.CancellationToken);
AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
125
var root = tree.
GetRoot
(cancellationToken);
AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
539
foreach (var root in namedTypeSymbol.Locations.Select(l => l.SourceTree.
GetRoot
(cancellationToken)))
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.AddConstructorParametersCodeAction.cs (1)
68
var newRoot = syntaxTree.
GetRoot
(cancellationToken).ReplaceNode(constructor, newConstructor);
AddImport\References\Reference.cs (1)
94
var root = contextNode.SyntaxTree.
GetRoot
(cancellationToken);
ChangeSignature\AbstractChangeSignatureService.cs (1)
455
var root = tree.
GetRoot
();
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaHelpers.cs (1)
222
var root = nodeWithTokens.SyntaxTree.
GetRoot
();
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (1)
88
var annotatedRoot = tree.
GetRoot
(cancellationToken).ReplaceToken(token, token.WithAdditionalAnnotations(_otherAnnotation));
Completion\Providers\AbstractOverrideCompletionProvider.ItemGetter.cs (1)
147
var root = _syntaxTree.
GetRoot
(_cancellationToken);
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (1)
420
var editor = new SyntaxEditor(model.SyntaxTree.
GetRoot
(cancellationToken), services);
ConvertLinq\ConvertForEachToLinqQuery\AbstractConvertForEachToLinqQueryProvider.cs (1)
151
var editor = new SyntaxEditor(converter.ForEachInfo.SemanticModel.SyntaxTree.
GetRoot
(cancellationToken), document.Project.Solution.Services);
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (2)
56
var token = syntaxTree.
GetRoot
(cancellationToken).FindToken(position, findInsideTrivia: true);
227
var trivia = syntaxTree.
GetRoot
(cancellationToken).FindTrivia(position, findInsideTrivia: false);
DocumentHighlighting\AbstractDocumentHighlightsService.cs (1)
95
var root = semanticModel.SyntaxTree.
GetRoot
(cancellationToken);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (2)
3569
var oldRoot = oldModel.SyntaxTree.
GetRoot
(cancellationToken);
3602
var newRoot = newModel.SyntaxTree.
GetRoot
(cancellationToken);
EmbeddedLanguages\Classification\AbstractEmbeddedLanguageClassificationService.cs (1)
50
var root = semanticModel.SyntaxTree.
GetRoot
(cancellationToken);
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDetectionAnalyzer.cs (1)
57
var root = syntaxTree.
GetRoot
(cancellationToken);
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDiagnosticAnalyzer.cs (1)
52
var root = syntaxTree.
GetRoot
(cancellationToken);
EmbeddedLanguages\RegularExpressions\LanguageServices\AbstractRegexDiagnosticAnalyzer.cs (1)
53
var root = syntaxTree.
GetRoot
(cancellationToken);
EncapsulateField\AbstractEncapsulateFieldService.cs (1)
177
document = document.WithSyntaxRoot(fieldDeclaration.SyntaxTree.
GetRoot
(cancellationToken).ReplaceNode(fieldDeclaration.GetSyntax(cancellationToken),
ExtractMethod\MethodExtractor.VariableSymbol.cs (1)
241
var token = tree.
GetRoot
(cancellationToken).FindToken(span.Start);
ExtractMethod\SelectionValidator.cs (1)
98
return IsFinalSpanSemanticallyValidSpan(semanticModel.SyntaxTree.
GetRoot
(cancellationToken), textSpan, returnStatements, cancellationToken);
FormattingAnalyzerHelper.cs (1)
25
var formattingChanges = Formatter.GetFormattedTextChanges(tree.
GetRoot
(cancellationToken), formattingProvider, options, cancellationToken);
QuickInfo\CommonSemanticQuickInfoProvider.cs (1)
140
var root = linkedModel.SyntaxTree.
GetRoot
(cancellationToken);
ReplaceDocCommentTextWithTag\AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (1)
129
var root = semanticModel.SyntaxTree.
GetRoot
(cancellationToken);
Structure\Syntax\AbstractBlockStructureProvider.cs (1)
37
var syntaxRoot = context.SyntaxTree.
GetRoot
(context.CancellationToken);
Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator (1)
Generator.cs (1)
295
foreach (var syntaxToken in syntaxTree.
GetRoot
(cancellationToken).DescendantTokens(descendIntoTrivia: true))
Microsoft.CodeAnalysis.Test.Utilities (23)
CommonTestBase.cs (2)
564
var root = model.SyntaxTree.
GetRoot
();
613
foreach (var node in model.SyntaxTree.
GetRoot
().DescendantNodes())
Compilation\CompilationExtensions.cs (3)
202
SyntaxNode root = tree.
GetRoot
();
293
var root = tree.
GetRoot
();
389
var nodes = tree.
GetRoot
().DescendantNodesAndSelf();
Diagnostics\CommonDiagnosticAnalyzers.cs (12)
70
var location = context.Tree.
GetRoot
().GetLocation();
105
var root = tree.
GetRoot
();
179
var root = tree.
GetRoot
();
256
var root = tree.
GetRoot
();
305
var root = tree.
GetRoot
();
857
_invalidLocation = treeInAnotherCompilation.
GetRoot
().GetLocation();
995
context.ReportDiagnostic(Diagnostic.Create(Descriptor, tree.
GetRoot
().GetLocation()));
1555
ReportDiagnosticsCore(addDiagnostic, tree.
GetRoot
().GetLastToken().GetLocation(), tree.FilePath);
2429
var fields = context.Tree.
GetRoot
().DescendantNodes().OfType<CSharp.Syntax.FieldDeclarationSyntax>();
2526
context.ReportDiagnostic(Diagnostic.Create(s_descriptor, context.Tree.
GetRoot
().GetLocation()));
2608
context.RegisterSyntaxTreeAction(syntaxContext => HandleCallback(syntaxContext.Tree.
GetRoot
().GetLocation(), context.Compilation, syntaxContext.ReportDiagnostic, syntaxContext.CancellationToken));
2620
context.RegisterSemanticModelAction(context => HandleCallback(context.SemanticModel.SyntaxTree.
GetRoot
().GetLocation(), context.SemanticModel.Compilation, context.ReportDiagnostic, context.CancellationToken));
Diagnostics\DiagnosticDescription.cs (2)
284
if (!_syntaxPredicate(d._location.SourceTree.
GetRoot
().FindToken(_location.SourceSpan.Start, true).Parent))
297
if (!d._syntaxPredicate(_location.SourceTree.
GetRoot
().FindToken(_location.SourceSpan.Start, true).Parent))
Diagnostics\SuppressMessageAttributeTests.DiagnosticAnalyzers.cs (2)
205
var comments = context.Tree.
GetRoot
().DescendantTrivia()
244
foreach (var nodeOrToken in context.Tree.
GetRoot
().DescendantNodesAndTokens())
MarkedSource\SourceWithMarkedNodes.cs (2)
109
var root = Tree.
GetRoot
();
135
var root = Tree.
GetRoot
();
Microsoft.CodeAnalysis.UnitTests (3)
Diagnostics\OperationTests.cs (2)
310
var literal = tree.
GetRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Single();
323
var classDecl = tree.
GetRoot
().DescendantNodes().OfType<ClassDeclarationSyntax>().Single();
Diagnostics\SuppressMessageTargetSymbolResolverTests.cs (1)
1397
var token = model.SyntaxTree.
GetRoot
().FindToken(pos);
Microsoft.CodeAnalysis.VisualBasic (23)
CommandLine\VisualBasicCompiler.vb (1)
272
For Each directive As ExternalSourceDirectiveTriviaSyntax In tree.
GetRoot
().GetDirectives(
Compilation\DocumentationComments\UnprocessedDocumentationCommentFinder.vb (1)
46
finder.Visit(tree.
GetRoot
(cancellationToken))
Compilation\SemanticModel.vb (4)
566
Dim atEOF As Boolean = (position = fullEnd AndAlso position = SyntaxTree.
GetRoot
().FullSpan.End)
610
Dim atEOF As Boolean = (position = fullEnd AndAlso position = SyntaxTree.
GetRoot
().FullSpan.End)
616
token = SyntaxTree.
GetRoot
().FindToken(position, True)
624
token = SyntaxTree.
GetRoot
().FindToken(position)
Compilation\SyntaxTreeSemanticModel.vb (1)
58
Return DirectCast(_syntaxTree.
GetRoot
(), VisualBasicSyntaxNode)
Compilation\VisualBasicCompilation.vb (2)
2302
If Not filterSpanWithinTree.HasValue OrElse filterSpanWithinTree.Value = tree.
GetRoot
(cancellationToken).FullSpan Then
2599
Dim checksumDirectives = tree.
GetRoot
().GetDirectives(Function(d) d.Kind = SyntaxKind.ExternalChecksumDirectiveTrivia AndAlso
Declarations\DeclarationTreeBuilder.vb (1)
29
Dim decl = DirectCast(builder.ForDeclaration(tree.
GetRoot
()), RootSingleNamespaceDeclaration)
SymbolDisplay\SymbolDisplayVisitor_Minimal.vb (2)
12
Dim token = semanticModelOpt.SyntaxTree.
GetRoot
().FindToken(positionOpt)
153
Dim token = semanticModelOpt.SyntaxTree.
GetRoot
().FindToken(positionOpt)
Symbols\Source\SourceAssemblySymbol.vb (1)
478
Dim compilationUnitSyntax = DirectCast(rootNs.Location.SourceTree.
GetRoot
(), CompilationUnitSyntax)
Symbols\Symbol.vb (1)
314
Dim token = CType(location.SourceTree.
GetRoot
().FindToken(location.SourceSpan.Start), SyntaxToken)
Syntax\SyntaxEquivalence.vb (2)
19
Return AreEquivalent(before.
GetRoot
(), after.
GetRoot
(), ignoreChildNode, topLevel)
Syntax\SyntaxFactory.vb (1)
1078
Dim compilationUnit As CompilationUnitSyntax = DirectCast(tree.
GetRoot
(), CompilationUnitSyntax)
Syntax\VisualBasicSyntaxTree.LazySyntaxTree.vb (1)
76
Dim root = CloneNodeAsRoot(CType(tree.
GetRoot
(cancellationToken), VisualBasicSyntaxNode))
Syntax\VisualBasicSyntaxTree.vb (1)
524
Return SyntaxDiffer.GetPossiblyDifferentTextSpans(oldTree.
GetRoot
(), Me.GetRoot())
Syntax\VisualBasicWarningStateMap.vb (1)
28
For Each d As DirectiveTriviaSyntax In syntaxTree.
GetRoot
().GetDirectives()
VisualBasicDeclarationComputer.vb (1)
20
ComputeDeclarationsCore(model, model.SyntaxTree.
GetRoot
(cancellationToken),
VisualBasicExtensions.vb (2)
260
Return DirectCast(syntaxTree.
GetRoot
(cancellationToken), VisualBasicSyntaxNode)
505
Return DirectCast(tree.
GetRoot
(), CompilationUnitSyntax)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (8)
DirectiveSyntaxExtensions.vb (1)
90
Return GetDirectiveInfo(syntaxTree.
GetRoot
(cancellationToken), cancellationToken).StartEndMap.Keys.Where(
SyntaxNodeExtensions.vb (1)
779
Return tree.
GetRoot
().ReplaceNode(oldBlock, newBlock)
SyntaxTreeExtensions.vb (4)
122
Return FindTriviaToLeft(syntaxTree.
GetRoot
(cancellationToken), position)
305
Dim compilationUnit = TryCast(syntaxTree.
GetRoot
(cancellationToken), CompilationUnitSyntax)
353
directive.FullSpan.End = syntaxTree.
GetRoot
(cancellationToken).FullSpan.End
359
Dim token = syntaxTree.
GetRoot
(cancellationToken).FindToken(line.Start)
VisualBasicUnnecessaryImportsProvider.vb (2)
30
Dim root = model.SyntaxTree.
GetRoot
(cancellationToken)
73
Dim root = DirectCast(model.SyntaxTree.
GetRoot
(cancellationToken), CompilationUnitSyntax)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (3)
SyntaxTreeExtensions.vb (1)
107
Dim token = syntaxTree.
GetRoot
(cancellationToken).FindToken(position)
VisualBasicIndentationService.Indenter.vb (1)
73
Dim firstTrivia As SyntaxTrivia = indenter.Tree.
GetRoot
(indenter.CancellationToken).FindTrivia(tokenOpt.Value.Span.End + 1)
VisualBasicTypeInferenceService.TypeInferrer.vb (1)
788
Dim tokenInOriginalTree = originalSemanticModel.SyntaxTree.
GetRoot
(CancellationToken).FindToken(currentSemanticModel.OriginalPositionForSpeculation)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests (3)
Utils.vb (3)
86
Return syntaxTree.
GetRoot
().DigToFirstNodeOfType(Of T)()
98
Return syntaxTree.
GetRoot
().ChildNodesAndTokens().Where(Function(n) n.IsNode).
105
Return syntaxTree.
GetRoot
().ChildNodesAndTokens().Where(Function(n) n.IsNode).
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (4)
LineCommit\CommitFormatter.vb (2)
235
Dim token = syntaxTree.
GetRoot
(cancellationToken).FindToken(Math.Min(endPosition, syntaxTree.
GetRoot
(cancellationToken).FullSpan.End))
LineCommit\ContainingStatementInfo.vb (2)
60
Dim trivia = syntaxTree.
GetRoot
(cancellationToken).FindTrivia(point)
98
Dim token = syntaxTree.
GetRoot
(cancellationToken).FindToken(point, findInsideTrivia:=True)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests (18)
CodeActions\Preview\PreviewTests.vb (1)
62
solution = solution.WithDocumentSyntaxRoot(_oldDocument.Id, VisualBasicSyntaxTree.ParseText(s_changedDocumentText).
GetRoot
())
EditAndContinue\BreakpointSpansTests.vb (1)
74
Dim root = tree.
GetRoot
()
EditAndContinue\Helpers\EditingTestBase.vb (4)
124
Dim match = SyntaxComparer.TopLevel.ComputeMatch(tree1.
GetRoot
(), tree2.
GetRoot
())
178
Dim root = tree.
GetRoot
()
182
Return SyntaxFactory.SyntaxTree(declaration).
GetRoot
()
EditAndContinue\SyntaxUtilitiesTests.vb (6)
14
Dim oldRoot = SyntaxFactory.ParseSyntaxTree(oldSource).
GetRoot
()
15
Dim newRoot = SyntaxFactory.ParseSyntaxTree(newSource).
GetRoot
()
66
").
GetRoot
()
80
").
GetRoot
()
106
").
GetRoot
()
124
").
GetRoot
()
EditAndContinue\VisualBasicEditAndContinueAnalyzerTests.vb (1)
45
Dim node = tree.
GetRoot
().FindToken(expected.Key).Parent
Extensions\StatementSyntaxExtensionTests.vb (1)
219
Dim token = tree.
GetRoot
() _
SymbolId\SymbolKeyTestBase.vb (1)
187
Dim aliases = tree.
GetRoot
().DescendantNodes().OfType(Of ImportAliasClauseSyntax)()
Utils.vb (3)
86
Return syntaxTree.
GetRoot
().DigToFirstNodeOfType(Of T)()
98
Return syntaxTree.
GetRoot
().ChildNodesAndTokens().Where(Function(n) n.IsNode).
105
Return syntaxTree.
GetRoot
().ChildNodesAndTokens().Where(Function(n) n.IsNode).
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (59)
Attributes\AttributeTests.vb (6)
2102
Dim expr = tree.
GetRoot
().DescendantNodes().OfType(Of BinaryExpressionSyntax).First()
2240
Dim root = tree.
GetRoot
()
2286
Dim root = tree.
GetRoot
()
2330
Dim root = tree.
GetRoot
()
2373
Dim root = tree.
GetRoot
()
2417
Dim root = tree.
GetRoot
()
CodeGen\CodeGenEvents.vb (6)
439
Dim add = tree.
GetRoot
().DescendantNodes().OfType(Of AddRemoveHandlerStatementSyntax)().First()
461
Dim remove = tree.
GetRoot
().DescendantNodes().OfType(Of AddRemoveHandlerStatementSyntax)().Last()
483
Dim raise = tree.
GetRoot
().DescendantNodes().OfType(Of RaiseEventStatementSyntax)().Single()
569
Dim add = tree.
GetRoot
().DescendantNodes().OfType(Of AddRemoveHandlerStatementSyntax)().First()
591
Dim remove = tree.
GetRoot
().DescendantNodes().OfType(Of AddRemoveHandlerStatementSyntax)().Last()
613
Dim raise = tree.
GetRoot
().DescendantNodes().OfType(Of RaiseEventStatementSyntax)().Single()
CodeGen\CodeGenNullable.vb (4)
6657
Dim placeholders = tree1.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(id) id.Identifier.ValueText = "placeholder").ToArray()
6660
Dim nameInInvocation = tree1.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(id) id.Identifier.ValueText = "Test").Single()
6662
Dim testMethod = tree1.
GetRoot
().DescendantNodes().OfType(Of MethodBlockSyntax)().Where(Function(block) block.SubOrFunctionStatement.Identifier.ValueText = "Test").Single()
6681
Dim newRoot = tree1.
GetRoot
().ReplaceNode(invocation, Enumerable.Range(1, newBlocks.Count).
CodeGen\CodeGenRefReturnTests.vb (1)
44
Dim syntax = tree.
GetRoot
().DescendantNodes().OfType(Of Syntax.VariableDeclaratorSyntax).Single().Names(0)
CodeGen\CodeGenSelectCase.vb (1)
4362
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of RangeCaseClauseSyntax)().First()
CodeGen\CodeGenTuples.vb (38)
1619
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of CTypeExpressionSyntax)().Single()
1767
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of DirectCastExpressionSyntax)().Single()
1834
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of TryCastExpressionSyntax)().Single()
3336
Dim nodes = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().ToArray()
6399
Dim result = tree.
GetRoot
().DescendantNodes().OfType(Of VariableDeclaratorSyntax)().ElementAt(2).Names(0)
8289
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().Single()
8298
Dim [ctype] = tree.
GetRoot
().DescendantNodes().OfType(Of CTypeExpressionSyntax)().Single()
8342
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().Single()
8377
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().Single()
8414
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().Single()
8445
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().Single()
8479
Dim firstTuple = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().ElementAt(0)
8485
Dim secondTuple = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().ElementAt(1)
8522
Dim firstTuple = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().ElementAt(0)
8528
Dim secondTuple = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().ElementAt(1)
8565
Dim firstTuple = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().ElementAt(0)
8571
Dim secondTuple = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().ElementAt(1)
8605
Dim firstTuple = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().ElementAt(0)
8611
Dim secondTuple = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().ElementAt(1)
13270
Dim nodes = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().ToArray()
13318
Dim nodes = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().ToArray()
13372
Dim nodes = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().ToArray()
13418
Dim nodes = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(id) id.Identifier.ValueText = "t").ToArray()
13456
Dim nodes = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(id) id.Identifier.ValueText = "t").ToArray()
13494
Dim nodes = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(id) id.Identifier.ValueText = "t").ToArray()
13532
Dim nodes = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(id) id.Identifier.ValueText = "t").ToArray()
14138
Dim test3 = tree.
GetRoot
().DescendantNodes().OfType(Of InvocationExpressionSyntax)().First()
16259
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of TupleExpressionSyntax)().First()
20797
Dim nodes = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(id) id.Identifier.ValueText = "elem2").ToArray()
20813
Dim type = tree.
GetRoot
().DescendantNodes().OfType(Of TupleTypeSyntax)().Single()
20857
Dim derived = tree.
GetRoot
().DescendantNodes().OfType(Of ClassStatementSyntax)().ElementAt(1)
20894
Dim derived = tree.
GetRoot
().DescendantNodes().OfType(Of ClassStatementSyntax)().ElementAt(1)
20936
Dim derived = tree.
GetRoot
().DescendantNodes().OfType(Of ClassStatementSyntax)().ElementAt(1)
20943
Dim instance1 = tree.
GetRoot
().DescendantNodes().OfType(Of VariableDeclaratorSyntax)().ElementAt(0).Names(0)
20950
Dim instance2 = tree.
GetRoot
().DescendantNodes().OfType(Of VariableDeclaratorSyntax)().ElementAt(1).Names(0)
20994
Dim derived = tree.
GetRoot
().DescendantNodes().OfType(Of ClassStatementSyntax)().ElementAt(1)
21001
Dim instance1 = tree.
GetRoot
().DescendantNodes().OfType(Of VariableDeclaratorSyntax)().ElementAt(0).Names(0)
21010
Dim instance2 = tree.
GetRoot
().DescendantNodes().OfType(Of VariableDeclaratorSyntax)().ElementAt(1).Names(0)
CodeGen\CodeGenWinMdDelegates.vb (1)
89
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of ModifiedIdentifierSyntax).First()
CodeGen\WinRTCollectionTests.vb (1)
6362
Dim add = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.IdentifierName AndAlso DirectCast(n, IdentifierNameSyntax).Identifier.ValueText = "Add").Single()
Emit\EditAndContinue\EditAndContinueTestBase.vb (1)
117
Return method.DeclaringSyntaxReferences.Single().SyntaxTree.
GetRoot
().DescendantNodes().Single(Function(n) n.IsKind(k))
Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator.ExpressionCompiler (1)
SyntaxHelpers.vb (1)
202
Return DirectCast(DirectCast(syntaxTree.
GetRoot
(), CompilationUnitSyntax).Members.Single(), StatementSyntax)
Microsoft.CodeAnalysis.VisualBasic.Features (18)
ChangeSignature\VisualBasicChangeSignatureService.vb (1)
101
Dim token = tree.
GetRoot
(cancellationToken).FindToken(If(position <> tree.Length, position, Math.Max(0, position - 1)))
Completion\KeywordRecommenders\Declarations\ImportsKeywordRecommender.vb (1)
31
Dim compilationUnit = DirectCast(context.SyntaxTree.
GetRoot
(cancellationToken), CompilationUnitSyntax)
Completion\KeywordRecommenders\PreprocessorDirectives\PreprocessorHelpers.vb (1)
30
Visit(syntaxTree.
GetRoot
(cancellationToken))
Debugging\BreakpointResolver.vb (1)
32
Dim token = tree.
GetRoot
(cancellationToken).FindToken(location.SourceSpan.Start)
Debugging\ProximityExpressionsGetter.Worker.vb (1)
27
Dim token = _syntaxTree.
GetRoot
(cancellationToken).FindToken(_position)
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.vb (1)
79
Dim root = semanticModel.SyntaxTree.
GetRoot
(cancellationToken)
Diagnostics\Analyzers\VisualBasicSimplifyTypeNamesDiagnosticAnalyzer.vb (1)
56
Dim root = syntaxTree.
GetRoot
(cancellationToken)
DocumentationComments\VisualBasicDocumentationCommentSnippetService.vb (3)
27
Return syntaxTree.
GetRoot
(cancellationToken).FindToken(position).GetContainingMember()
234
Return syntaxTree.
GetRoot
(cancellationToken).FindTokenOnRightOfPosition(
243
Return syntaxTree.
GetRoot
(cancellationToken).FindTokenOnLeftOfPosition(
EditAndContinue\BreakpointSpans.vb (1)
30
Dim root = tree.
GetRoot
(cancellationToken)
ExtractMethod\VisualBasicSelectionValidator.vb (3)
102
Dim root = semanticModel.SyntaxTree.
GetRoot
(cancellationToken)
199
semanticModel.SyntaxTree.
GetRoot
(cancellationToken), GetControlFlowSpan(selectionInfo), cancellationToken)
295
Dim root = semanticModel.SyntaxTree.
GetRoot
(cancellationToken)
GenerateMember\GenerateParameterizedMember\VisualBasicCommonGenerationServiceMethods.vb (1)
14
Dim root = semanticModel.SyntaxTree.
GetRoot
IntroduceVariable\VisualBasicIntroduceVariableService_IntroduceField.vb (1)
93
Dim oldRoot = syntaxTree.
GetRoot
(cancellationToken)
NavigationBar\VisualBasicNavigationBarItemService.vb (1)
66
nodesToVisit.Push(DirectCast(semanticModel.SyntaxTree.
GetRoot
(cancellationToken), SyntaxNode))
VisualBasicDeclarationComputer.vb (1)
20
ComputeDeclarationsCore(model, model.SyntaxTree.
GetRoot
(cancellationToken),
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (203)
Binding\Binder_Expressions_Tests.vb (18)
2806
Dim node1 = tree.
GetRoot
().DescendantNodes.OfType(Of MemberAccessExpressionSyntax)().Single()
2816
Dim node2 = tree.
GetRoot
().DescendantNodes.OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "e").Single()
2852
Dim node1 = tree.
GetRoot
().DescendantNodes.OfType(Of MemberAccessExpressionSyntax)().Single()
2862
Dim node2 = tree.
GetRoot
().DescendantNodes.OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "e").Single()
2898
Dim node1 = tree.
GetRoot
().DescendantNodes.OfType(Of MemberAccessExpressionSyntax)().Single()
2907
Dim node2 = tree.
GetRoot
().DescendantNodes.OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "e").Single()
2949
Dim node1 = tree.
GetRoot
().DescendantNodes.OfType(Of MemberAccessExpressionSyntax)().Single()
2958
Dim node2 = tree.
GetRoot
().DescendantNodes.OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "e").Single()
3008
Dim node = tree.
GetRoot
().DescendantNodes.OfType(Of MemberAccessExpressionSyntax)().Select(Function(e) e.Expression).Where(Function(e) e.ToString() = "Color").Single()
3054
Dim node = tree.
GetRoot
().DescendantNodes.OfType(Of MemberAccessExpressionSyntax)().Select(Function(e) e.Expression).Where(Function(e) e.ToString() = "Color").Single()
3100
Dim node = tree.
GetRoot
().DescendantNodes.OfType(Of MemberAccessExpressionSyntax)().Select(Function(e) e.Expression).Where(Function(e) e.ToString() = "Color").Single()
3149
Dim node = tree.
GetRoot
().DescendantNodes.OfType(Of MemberAccessExpressionSyntax)().Select(Function(e) e.Expression).Where(Function(e) e.ToString() = "Color").Single()
3203
Dim node = tree.
GetRoot
().DescendantNodes.OfType(Of MemberAccessExpressionSyntax)().Select(Function(e) e.Expression).Where(Function(e) e.ToString() = "Color").Single()
3251
Dim node = tree.
GetRoot
().DescendantNodes.OfType(Of MemberAccessExpressionSyntax)().Select(Function(e) e.Expression).Where(Function(e) e.ToString() = "Color").Single()
3295
Dim node = tree.
GetRoot
().DescendantNodes.OfType(Of MemberAccessExpressionSyntax)().Select(Function(e) e.Expression).Where(Function(e) e.ToString() = "Color").Single()
3348
Dim node = tree.
GetRoot
().DescendantNodes.OfType(Of MemberAccessExpressionSyntax)().Select(Function(e) e.Expression).Where(Function(e) e.ToString() = "Color").Single()
3394
Dim node = tree.
GetRoot
().DescendantNodes.OfType(Of MemberAccessExpressionSyntax)().Select(Function(e) e.Expression).Where(Function(e) e.ToString() = "Color").Single()
3438
Dim node = tree.
GetRoot
().DescendantNodes.OfType(Of MemberAccessExpressionSyntax)().Select(Function(e) e.Expression).Where(Function(e) e.ToString() = "Color").Single()
Binding\BindingCollectionInitializerTests.vb (1)
2002
Dim nodes = tree.
GetRoot
().DescendantNodes().OfType(Of GenericNameSyntax)().ToArray()
Binding\BindingErrorTests.vb (3)
18829
Dim add = tree.
GetRoot
().DescendantNodes().OfType(Of AddRemoveHandlerStatementSyntax)().First()
18852
Dim remove = tree.
GetRoot
().DescendantNodes().OfType(Of AddRemoveHandlerStatementSyntax)().Last()
18875
Dim raise = tree.
GetRoot
().DescendantNodes().OfType(Of RaiseEventStatementSyntax)().Single()
Binding\ForEachTests.vb (5)
4528
Dim foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of ForEachStatementSyntax)().Single()
4530
Dim invocationSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single()
4597
Dim foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of ForEachStatementSyntax)().Single()
4655
Dim foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of ForEachStatementSyntax)().Single()
4718
Dim foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of ForEachStatementSyntax)().Single()
Binding\ImplicitVariableTests.vb (4)
1013
Dim main1 = tree.
GetRoot
().DescendantNodes().OfType(Of MethodBlockBaseSyntax)().Single()
1017
Dim main2 = compilation2.SyntaxTrees.Single().
GetRoot
().DescendantNodes().OfType(Of MethodBlockBaseSyntax)().Single()
1055
Dim main1 = tree.
GetRoot
().DescendantNodes().OfType(Of MethodBlockBaseSyntax)().Single()
1059
Dim main2 = compilation2.SyntaxTrees.Single().
GetRoot
().DescendantNodes().OfType(Of MethodBlockBaseSyntax)().Single()
Compilation\SemanticModelAPITests.vb (9)
1039
Dim root = tree.
GetRoot
()
1078
Dim root = tree.
GetRoot
()
1387
Dim localDecl = tree.
GetRoot
().DescendantNodes().OfType(Of LocalDeclarationStatementSyntax)().Single()
2943
Dim root = tree.
GetRoot
()
2984
Dim root = tree.
GetRoot
()
3168
For Each name In From x In NameSyntaxFinder.FindNames(tree.
GetRoot
()) Where x.ToString() = "sv" Select x
3635
For Each name In From x In ExpressionSyntaxFinder.FindExpression(tree.
GetRoot
())
3824
For Each name In SyntaxNodeFinder.FindNodes(tree.
GetRoot
(), SyntaxKind.DeclareSubStatement)
4122
Dim statement = tree.
GetRoot
().DescendantNodes().OfType(Of LocalDeclarationStatementSyntax).Single()
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (1)
1927
Dim root As Object = tree.
GetRoot
(Nothing)
Compilation\SuppressAccessibilityChecksTests.vb (6)
55
Dim invocation = semanticModel.SyntaxTree.
GetRoot
().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single()
68
Dim invocation = semanticModel.SyntaxTree.
GetRoot
().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single()
81
Dim invocation = syntaxTree.
GetRoot
().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single()
188
Dim invocation = syntaxTree.
GetRoot
().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single()
234
]]>.Value).
GetRoot
()
256
speculativeModel.SyntaxTree.
GetRoot
() _
Diagnostics\GetDiagnosticsTests.vb (2)
156
Dim root = tree.
GetRoot
()
211
Dim root = tree.
GetRoot
()
Diagnostics\OperationAnalyzerTests.vb (1)
1849
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of ObjectCreationExpressionSyntax)().Single()
ExtensionMethods\SemanticModelTests.vb (2)
1470
Dim node1 = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "alias1").Single()
1475
Dim node2 = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "alias2").Single()
FlowAnalysis\IterationJumpYieldStatementTests.vb (2)
1345
Dim foreachBlock = tree.
GetRoot
.DescendantNodes.OfType(Of ForEachBlockSyntax).Single
1369
Dim stmtNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("Next", StringComparison.Ordinal)).Parent, NextStatementSyntax)
FlowAnalysis\RegionAnalysisTests.vb (21)
4829
Dim exprSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("{4, 5}", StringComparison.Ordinal)).Parent, CollectionInitializerSyntax)
4852
Dim exprSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("{4, 5}", StringComparison.Ordinal)).Parent, CollectionInitializerSyntax)
4875
Dim exprSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("{4, 5}", StringComparison.Ordinal)).Parent, CollectionInitializerSyntax)
4900
Dim stmtSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("If False", StringComparison.Ordinal)).Parent, IfStatementSyntax)
4926
Dim stmtSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("Else", StringComparison.Ordinal)).Parent, ElseStatementSyntax)
4948
Dim stmtSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("With New Object()", StringComparison.Ordinal)).Parent, WithStatementSyntax)
4975
Dim withStatement = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("With tableauEmission(t)", StringComparison.Ordinal)).Parent, WithStatementSyntax)
5000
Dim stmtSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("Try", StringComparison.Ordinal)).Parent, TryStatementSyntax)
5024
Dim stmtSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("Catch e As Exception", StringComparison.Ordinal)).Parent, CatchStatementSyntax)
5048
Dim stmtSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("Finally", StringComparison.Ordinal)).Parent, FinallyStatementSyntax)
5071
Dim stmtSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("SyncLock New With {.x = 0}", StringComparison.Ordinal)).Parent, SyncLockStatementSyntax)
5094
Dim stmtSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("While True", StringComparison.Ordinal)).Parent, WhileStatementSyntax)
5117
Dim stmtSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("Using mem = New MemoryStream()", StringComparison.Ordinal)).Parent, UsingStatementSyntax)
5145
Dim stmtSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("Loop While Me.backwardBranchChanged", StringComparison.Ordinal)).Parent, LoopStatementSyntax)
5169
Dim stmtSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("Select Case 1 + 2 + 3", StringComparison.Ordinal)).Parent, SelectStatementSyntax)
5193
Dim selectSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("Select Case 1 + 2 + 3", StringComparison.Ordinal)).Parent, SelectStatementSyntax)
5217
Dim stmtSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("Do", StringComparison.Ordinal)).Parent, DoStatementSyntax)
5239
Dim stmtSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("For i = 0 To 1", StringComparison.Ordinal)).Parent, ForStatementSyntax)
5261
Dim stmtSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("For Each c In """"", StringComparison.Ordinal)).Parent, ForEachStatementSyntax)
9864
Dim stmtNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("End Select", StringComparison.Ordinal)).Parent, StatementSyntax)
9887
Dim stmtNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("Select Case", StringComparison.Ordinal)).Parent, StatementSyntax)
FlowAnalysis\RegionAnalysisTestsWithStaticLocals.vb (5)
2732
Dim exprSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("{4, 5}", StringComparison.Ordinal)).Parent, CollectionInitializerSyntax)
2755
Dim exprSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("{4, 5}", StringComparison.Ordinal)).Parent, CollectionInitializerSyntax)
2778
Dim exprSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("{4, 5}", StringComparison.Ordinal)).Parent, CollectionInitializerSyntax)
2803
Dim stmtSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("If False", StringComparison.Ordinal)).Parent, IfStatementSyntax)
2830
Dim stmtSyntaxNode = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.
GetRoot
.ToFullString().IndexOf("Else", StringComparison.Ordinal)).Parent, ElseStatementSyntax)
Semantics\ArrayLiteralTests.vb (1)
148
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of LocalDeclarationStatementSyntax)().ElementAt(7)
Semantics\BinaryOperators.vb (6)
851
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of LocalDeclarationStatementSyntax)().First()
987
Dim nodes = (From node In tree.
GetRoot
().DescendantNodes()
1327
Dim nodes = (From node In tree.
GetRoot
().DescendantNodes()
1422
Dim nodes = (From node In tree.
GetRoot
().DescendantNodes()
1505
Dim fieldInitializerOperations = tree.
GetRoot
().DescendantNodes().OfType(Of VariableDeclaratorSyntax)().
1551
Dim initializer = tree.
GetRoot
().DescendantNodes().OfType(Of VariableDeclaratorSyntax).Single().Initializer.Value
Semantics\ConditionalAccessTests.vb (4)
9801
Dim access = tree.
GetRoot
().DescendantNodes().OfType(Of ConditionalAccessExpressionSyntax)().Single()
9853
Assert.False(tree.
GetRoot
().DescendantNodes().OfType(Of ConditionalAccessExpressionSyntax)().Any())
9887
Dim access = tree.
GetRoot
().DescendantNodes().OfType(Of ConditionalAccessExpressionSyntax)().Single()
9937
Dim access = tree.
GetRoot
().DescendantNodes().OfType(Of ConditionalAccessExpressionSyntax)().Single()
Semantics\Conversions.vb (11)
102
Dim [nothing] = New BoundLiteral(DirectCast(DirectCast(dummyTree.
GetRoot
(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), ConstantValue.Nothing, Nothing)
103
Dim intZero = New BoundLiteral(DirectCast(DirectCast(dummyTree.
GetRoot
(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), ConstantValue.Create(0I), m13p(c))
104
Dim longZero = New BoundLiteral(DirectCast(DirectCast(dummyTree.
GetRoot
(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), ConstantValue.Create(0L), m13p(d))
271
Dim _nothing = New BoundLiteral(DirectCast(DirectCast(dummyTree.
GetRoot
(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), ConstantValue.Nothing, Nothing)
311
literal = New BoundLiteral(DirectCast(DirectCast(dummyTree.
GetRoot
(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), zero, integralType)
338
literal = New BoundConversion(dummyTree.GetVisualBasicRoot(Nothing), New BoundLiteral(DirectCast(DirectCast(dummyTree.
GetRoot
(Nothing), VisualBasicSyntaxNode), VisualBasicSyntaxNode), ConstantValue.Null, Nothing), ConversionKind.WideningNothingLiteral, False, True, zero, convertibleType, Nothing)
369
literal = New BoundConversion(dummyTree.GetVisualBasicRoot(Nothing), New BoundLiteral(DirectCast(dummyTree.
GetRoot
(Nothing), VisualBasicSyntaxNode), ConstantValue.Null, Nothing), ConversionKind.WideningNothingLiteral, False, True, zero, type1, Nothing)
626
New BoundLiteral(DirectCast(dummyTree.
GetRoot
(Nothing), VisualBasicSyntaxNode), ConstantValue.Null, Nothing),
750
Dim 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)
1120
Dim _nothing = New BoundLiteral(DirectCast(dummyTree.
GetRoot
(Nothing), VisualBasicSyntaxNode), ConstantValue.Nothing, Nothing)
1186
New BoundLiteral(DirectCast(dummyTree.
GetRoot
(Nothing), VisualBasicSyntaxNode), ConstantValue.Null, Nothing),
Semantics\EraseStatementTests.vb (1)
48
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of EraseStatementSyntax)().Last()
Semantics\ForeachTest.vb (3)
1158
Dim loopSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of ForEachStatementSyntax)().Single()
1198
Dim loopSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of ForEachStatementSyntax)().Single()
1252
Dim loopSyntaxes = tree.
GetRoot
().DescendantNodes().OfType(Of ForEachStatementSyntax)().ToArray()
Semantics\GetExtendedSemanticInfoTests.vb (1)
10334
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(id) id.Identifier.ValueText = "ShortName").Single()
Semantics\GetSemanticInfoTests.vb (18)
5074
Dim asClauseSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of SimpleAsClauseSyntax)().Single()
5123
Dim memberAccessSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single()
5164
Dim callSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single()
5209
Dim callSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single()
5720
Dim lambdaSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of LambdaExpressionSyntax)().Single()
5735
Dim lambdaSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of LambdaExpressionSyntax)().Single()
5787
Dim nullSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of LiteralExpressionSyntax)().Single()
5826
Dim lambdaSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of LambdaExpressionSyntax)().Single()
5878
Dim lambdaSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of LambdaExpressionSyntax)().Single()
5937
Dim methodGroupSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of SimpleArgumentSyntax)().Single().Expression
5978
Dim node = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.MeExpression).Cast(Of MeExpressionSyntax)().Single()
5999
Dim node = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.MeExpression).Cast(Of MeExpressionSyntax)().Single()
6049
Dim node = tree.
GetRoot
().DescendantNodes.OfType(Of MemberAccessExpressionSyntax)().Single().Expression
6105
Dim nodes = tree.
GetRoot
().DescendantNodes.OfType(Of LiteralExpressionSyntax)().ToArray()
6443
Dim node = tree.
GetRoot
().DescendantNodes.OfType(Of IdentifierNameSyntax)().ElementAt(5)
6502
Dim node = tree.
GetRoot
().DescendantNodes.OfType(Of IdentifierNameSyntax)().ElementAt(5)
6563
Dim node = tree.
GetRoot
().DescendantNodes.OfType(Of IdentifierNameSyntax)().ElementAt(5)
6625
Dim node = tree.
GetRoot
().DescendantNodes.OfType(Of IdentifierNameSyntax)().ElementAt(5)
Semantics\InitOnlyMemberTests.vb (2)
5244
Dim lambda = tree.
GetRoot
.DescendantNodes().OfType(Of LambdaExpressionSyntax)().Single()
5248
Dim invocation = tree.
GetRoot
.DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single()
Semantics\InterpolatedStringTests.vb (9)
373
Dim root = mainTree.
GetRoot
()
424
Dim root = mainTree.
GetRoot
()
766
Dim root = mainTree.
GetRoot
()
817
Dim root = mainTree.
GetRoot
()
873
Dim root = mainTree.
GetRoot
()
930
Dim root = mainTree.
GetRoot
()
988
Dim root = mainTree.
GetRoot
()
1221
Dim root = mainTree.
GetRoot
()
1270
Dim root = mainTree.
GetRoot
()
Semantics\LambdaSemanticInfoTests.vb (4)
842
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(id) id.Identifier.ValueText = "a").Single()
881
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(id) id.Identifier.ValueText = "a").Single()
917
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(id) id.Identifier.ValueText = "a").Single()
953
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(id) id.Identifier.ValueText = "a").Single()
Semantics\MultiDimensionalTest.vb (1)
1188
Dim foreachSyntax = tree.
GetRoot
().DescendantNodes().OfType(Of ForEachStatementSyntax)().Single()
Semantics\NameOfTests.vb (39)
50
Dim nodes = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().ToArray()
449
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
521
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
605
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
657
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
707
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
760
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
810
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
860
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
937
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
1050
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
1118
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
1183
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
1265
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
1347
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
1428
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
1508
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
1639
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
1732
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
1789
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
1846
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
1903
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
2045
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
2144
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
2245
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
2351
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
2455
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
2788
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
2863
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
2928
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
2991
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
3052
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
3113
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
3173
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
3236
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
3297
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
3354
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
3413
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
3469
Dim node1 = tree.
GetRoot
().DescendantNodes().Where(Function(n) n.Kind() = SyntaxKind.NameOfExpression).Cast(Of NameOfExpressionSyntax)().First()
Semantics\NewOnInterfaceTests.vb (1)
1727
Dim nodes = tree.
GetRoot
().DescendantNodes().OfType(Of AddRemoveHandlerStatementSyntax)().ToArray()
Semantics\OptionalArgumentTests.vb (1)
857
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of InvocationExpressionSyntax)().ElementAt(6)
Semantics\OptionApis.vb (9)
68
Dim root = tree.
GetRoot
()
100
Dim root = tree.
GetRoot
()
132
Dim root = tree.
GetRoot
()
159
Dim root = tree.
GetRoot
()
186
Dim root = tree.
GetRoot
()
213
Dim root = tree.
GetRoot
()
245
Dim root = tree.
GetRoot
()
277
Dim root = tree.
GetRoot
()
310
Dim root = tree.
GetRoot
()
Semantics\QueryExpressions.vb (1)
2625
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of WhereClauseSyntax)().Single()
Semantics\QueryExpressions_LookupSymbols.vb (1)
764
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of QueryExpressionSyntax)().First()
Semantics\QueryExpressions_SemanticModel.vb (1)
2963
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of QueryExpressionSyntax)().First()
Semantics\ScriptSemanticsTests.vb (1)
171
Dim node1 = DirectCast(syntaxTree.
GetRoot
(), CompilationUnitSyntax)
Semantics\SyntaxTreeRootTests.vb (2)
30
Assert.Equal(GetType(CompilationUnitSyntax), tree.
GetRoot
().GetType())
79
Assert.Equal(tree, tree.
GetRoot
().DescendantNodes().OfType(Of ClassStatementSyntax)().Single().SyntaxTree)
Semantics\UnaryOperators.vb (2)
666
Dim nodes = (From node In tree.
GetRoot
().DescendantNodes()
818
Dim node1 = (From node In tree.
GetRoot
().DescendantNodes()
Semantics\WithBlockErrorTests.vb (2)
1075
For Each node In tree.
GetRoot
().DescendantNodes()
1132
For Each node In tree.
GetRoot
().DescendantNodes()
Semantics\XmlLiteralSemanticModelTests.vb (1)
187
Dim syntax = tree.
GetRoot
().DescendantNodes().OfType(Of XmlNameSyntax).Last
SourceGeneration\GeneratorDriverTests.vb (1)
178
Dim rootFromGetRoot = tree.
GetRoot
()
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (76)
DocumentationComments\DocCommentTests.vb (13)
11495
Dim crefSyntax = tree.
GetRoot
().DescendantNodes(descendIntoTrivia:=True).OfType(Of CrefReferenceSyntax).Single()
11534
Dim crefSyntax = tree.
GetRoot
().DescendantNodes(descendIntoTrivia:=True).OfType(Of CrefReferenceSyntax).First()
11569
Dim crefSyntax = tree.
GetRoot
().DescendantNodes(descendIntoTrivia:=True).OfType(Of CrefReferenceSyntax).First()
11644
Dim crefSyntaxes = tree.
GetRoot
().DescendantNodes(descendIntoTrivia:=True).OfType(Of CrefReferenceSyntax).ToArray()
11699
Dim crefSyntaxes = tree.
GetRoot
().DescendantNodes(descendIntoTrivia:=True).OfType(Of CrefReferenceSyntax).ToArray()
11732
Dim crefSyntax = tree.
GetRoot
().DescendantNodes(descendIntoTrivia:=True).OfType(Of CrefReferenceSyntax).Single()
11911
Dim crefs = SyntaxNodeFinder.FindNodes(Of CrefReferenceSyntax)(tree.
GetRoot
(), SyntaxKind.CrefReference)
11916
Return SyntaxNodeFinder.FindNodes(Of CrefReferenceSyntax)(tree.
GetRoot
(), SyntaxKind.CrefReference)
12089
Dim token As SyntaxToken = tree.
GetRoot
().FindToken(position, True)
12248
Dim node1 = tree.
GetRoot
().DescendantNodes(descendIntoTrivia:=True).OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "f").Single()
12254
Dim node = tree.
GetRoot
().DescendantNodes(descendIntoTrivia:=True).OfType(Of TypeSyntax)().Where(Function(n) n.ToString() = "Integer").Single()
12308
Dim node1 = tree.
GetRoot
().DescendantNodes(descendIntoTrivia:=True).OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "f").Single()
12314
Dim node = tree.
GetRoot
().DescendantNodes(descendIntoTrivia:=True).OfType(Of TypeSyntax)().Where(Function(n) n.ToString() = "System.Int32").Single()
SymbolDisplay\SymbolDisplayTests.vb (6)
5260
Dim invocation = tree.
GetRoot
().DescendantNodes().OfType(Of InvocationExpressionSyntax)().Single()
5662
Dim decls = tree.
GetRoot
().DescendantNodes().OfType(Of Microsoft.CodeAnalysis.CSharp.Syntax.VariableDeclaratorSyntax)().ToArray()
5701
Dim binaryExpression = tree.
GetRoot
().DescendantNodes().OfType(Of BinaryExpressionSyntax)().Single()
5808
binaryExpression = tree.
GetRoot
().DescendantNodes().OfType(Of BinaryExpressionSyntax)().Single()
6000
Dim tokenPosition = tree.
GetRoot
().FindToken(position).SpanStart
6004
Dim token = newTree.
GetRoot
().FindToken(position)
SymbolsTests\AnonymousDelegates\AnonymousDelegates_CreationAndEmit.vb (1)
490
Dim x = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "x").Single()
SymbolsTests\AnonymousTypes\AnonymousTypesSemanticsTests.vb (36)
109
Dim declaratorQ = tree.
GetRoot
().FindToken(posQ).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
116
Dim declaratorX = tree.
GetRoot
().FindToken(posX).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
123
Dim declaratorZ = tree.
GetRoot
().FindToken(posZ).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
245
Dim declaratorW = tree.
GetRoot
().FindToken(posW).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
250
Dim declaratorZF = tree.
GetRoot
().FindToken(posZF).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
252
tree.
GetRoot
().FindToken(select1).GetLocation,
255
tree.
GetRoot
().FindToken(x2 - 2).GetLocation(),
256
tree.
GetRoot
().FindToken(y4 - 2).GetLocation())
260
Dim declaratorZL = tree.
GetRoot
().FindToken(posZL).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
262
tree.
GetRoot
().FindToken(select2).GetLocation,
265
tree.
GetRoot
().FindToken(x5 - 2).GetLocation(),
266
tree.
GetRoot
().FindToken(y5 - 2).GetLocation())
316
Dim declaratorT = tree.
GetRoot
().FindToken(posT).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
321
Dim declaratorA = tree.
GetRoot
().FindToken(posA).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
323
tree.
GetRoot
().FindToken(sub2).Parent.Parent.GetLocation,
326
tree.
GetRoot
().FindToken(x1 - 2).GetLocation(),
327
tree.
GetRoot
().FindToken(y1 - 2).GetLocation())
331
Dim declaratorB = tree.
GetRoot
().FindToken(posB).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
333
tree.
GetRoot
().FindToken(sub4).Parent.Parent.GetLocation,
336
tree.
GetRoot
().FindToken(x2 - 2).GetLocation(),
337
tree.
GetRoot
().FindToken(y2 - 2).GetLocation())
383
Dim declaratorT = tree.
GetRoot
().FindToken(posT).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
388
Dim declaratorA = tree.
GetRoot
().FindToken(posA).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
390
tree.
GetRoot
().FindToken(sub1).Parent.Parent.GetLocation,
393
tree.
GetRoot
().FindToken(x1 - 2).GetLocation(),
394
tree.
GetRoot
().FindToken(y1 - 2).GetLocation())
398
Dim declaratorB = tree.
GetRoot
().FindToken(posB).Parent.FirstAncestorOrSelf(Of VariableDeclaratorSyntax)()
401
tree.
GetRoot
().FindToken(sub2).Parent.Parent.GetLocation,
404
tree.
GetRoot
().FindToken(x2 - 2).GetLocation(),
405
tree.
GetRoot
().FindToken(y2 - 2).GetLocation())
1699
Dim anonProps = tree.
GetRoot
().DescendantNodes().OfType(Of FieldInitializerSyntax)()
1726
Dim anonProps = tree.
GetRoot
().DescendantNodes().OfType(Of FieldInitializerSyntax)()
1777
Dim anonProps = tree.
GetRoot
().DescendantNodes().OfType(Of FieldInitializerSyntax)()
1821
Dim anonProps = tree.
GetRoot
().DescendantNodes().OfType(Of FieldInitializerSyntax)()
1982
stack.Push(tree.
GetRoot
())
2058
Dim x = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "x").Single()
SymbolsTests\ExtensionMethods\ExtensionMethodTests.vb (1)
2399
Dim nodes = tree.
GetRoot
().DescendantNodes().OfType(Of InvocationExpressionSyntax)()
SymbolsTests\Metadata\PE\HasUnsupportedMetadata.vb (3)
477
Dim decl = tree.
GetRoot
().DescendantNodes.OfType(Of ObjectCreationExpressionSyntax).Single()
490
decl = tree.
GetRoot
().DescendantNodes.OfType(Of ObjectCreationExpressionSyntax).Single()
503
decl = tree.
GetRoot
().DescendantNodes.OfType(Of ObjectCreationExpressionSyntax).Single()
SymbolsTests\Metadata\WinMdEventTest.vb (3)
1464
Dim syntax = tree.
GetRoot
().DescendantNodes().OfType(Of AssignmentStatementSyntax).Single().Left
1557
Dim references = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax).Where(Function(id) id.Identifier.ValueText = "QQQ").ToArray()
1698
Dim syntax = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Single(Function(id) id.Identifier.ValueText = "FieldLikeEventEvent")
SymbolsTests\MyBaseMyClassSemanticsTests.vb (1)
131
stack.Push(tree.
GetRoot
())
SymbolsTests\Source\EnumTests.vb (1)
1450
Dim expr = tree.
GetRoot
().DescendantNodes().Single(Function(n) n.Kind() = SyntaxKind.NotExpression)
SymbolsTests\Source\EventTests.vb (7)
2301
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "E").Single()
2333
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "E").Single()
2377
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "E").Single()
2424
Dim x = tree.
GetRoot
().DescendantNodes().OfType(Of ParameterSyntax)().Single().Identifier
2464
Dim x = tree.
GetRoot
().DescendantNodes().OfType(Of ParameterSyntax)().ElementAt(1).Identifier
2504
Dim x = tree.
GetRoot
().DescendantNodes().OfType(Of ParameterSyntax)().Single().Identifier
2558
Dim x = tree.
GetRoot
().DescendantNodes().OfType(Of ParameterSyntax)().Single().Identifier
SymbolsTests\Source\PropertyTests.vb (1)
3421
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of InvocationExpressionSyntax)().ElementAt(2)
SymbolsTests\Source\SourceSymbolTests.vb (2)
37
Dim nsArray = tree.
GetRoot
().DescendantNodes().Where(Function(node) (node.Kind = SyntaxKind.NamespaceStatement)).ToArray()
510
Dim list = tree.
GetRoot
().DescendantNodes().Where(Function(n) (n.Kind = SyntaxKind.ForStatement)).ToArray()
SymbolsTests\WithStatementSymbolsTests.vb (1)
284
stack.Push(tree.
GetRoot
())
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (239)
IncrementalParser\IncrementalParser.vb (24)
85
root = tree.
GetRoot
()
96
root = tree.
GetRoot
()
108
Assert.Equal(False, tree.
GetRoot
().ContainsDiagnostics)
710
Dim exp1 = newTree.
GetRoot
().ChildNodesAndTokens()(0).ChildNodesAndTokens()(1)
711
Dim inc1 = incTree.
GetRoot
().ChildNodesAndTokens()(0).ChildNodesAndTokens()(1)
748
Assert.Equal(False, oldTree.
GetRoot
().ContainsDiagnostics)
749
Assert.Equal(False, newTree.
GetRoot
().ContainsDiagnostics)
750
Assert.Equal(False, incTree.
GetRoot
().ContainsDiagnostics)
774
Assert.Equal(False, expectedTree.
GetRoot
().ContainsDiagnostics)
775
Assert.Equal(False, incrementalTree.
GetRoot
().ContainsDiagnostics)
799
Assert.Equal(True, expectedTree.
GetRoot
().ContainsDiagnostics)
800
Assert.Equal(True, incrementalTree.
GetRoot
().ContainsDiagnostics)
1129
Dim children1 = newTree.
GetRoot
().ChildNodesAndTokens()
1130
Dim children2 = fulltree.
GetRoot
().ChildNodesAndTokens()
1146
Assert.Equal(fullTree.
GetRoot
().ToFullString(), newTree.
GetRoot
().ToFullString())
1173
Assert.Equal(fulltree.
GetRoot
().ToFullString(), newTree.
GetRoot
().ToFullString())
1189
Assert.Equal(fullTree.
GetRoot
().ToFullString(), newTree.
GetRoot
().ToFullString())
1696
Function(tree) DirectCast(tree.
GetRoot
().DescendantNodes().First(Function(n) n.IsKind(SyntaxKind.ClassStatement)), VisualBasicSyntaxNode).VbGreen
1711
Dim tempRoot2 = tempTree2.
GetRoot
()
2577
Dim rootA = treeA.
GetRoot
()
2578
Dim rootB = treeB.
GetRoot
()
IncrementalParser\SyntaxDifferences.vb (2)
17
GatherNodes(oldTree.
GetRoot
(), hashSet)
20
GetRebuiltNodes(newTree.
GetRoot
(), hashSet, nodes)
Parser\DeclarationTests.vb (1)
16
Assert.False(tree.
GetRoot
().ContainsDiagnostics)
Parser\ParseAsyncTests.vb (19)
46
Assert.Equal(2, Aggregate t In tree.
GetRoot
().DescendantTokens Where t.Kind = SyntaxKind.AsyncKeyword Into Count())
48
Dim fields = tree.
GetRoot
().DescendantNodes.OfType(Of FieldDeclarationSyntax)().ToArray()
102
Dim awaitExpressions = tree.
GetRoot
().DescendantNodes.OfType(Of AwaitExpressionSyntax)()
106
Dim firstStatementOfM = tree.
GetRoot
().DescendantNodes.OfType(Of MethodBlockBaseSyntax).First.Statements.First
111
Dim firstStatementOfM2 = tree.
GetRoot
().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(1).Statements.First
116
Dim firstStatementOfN = tree.
GetRoot
().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(2).Statements.First
121
Dim firstStatementOfN2 = tree.
GetRoot
().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(3).Statements.First
139
Dim returnStatement = tree.
GetRoot
().DescendantNodes.OfType(Of ReturnStatementSyntax).Single()
213
Dim awaitExpressions = tree.
GetRoot
().DescendantNodes.OfType(Of AwaitExpressionSyntax)().ToArray()
217
Dim firstStatementOfM = tree.
GetRoot
().DescendantNodes.OfType(Of MethodBlockBaseSyntax).First.Statements.First
222
Dim firstStatementOfM2 = tree.
GetRoot
().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(1).Statements.First
227
Dim firstStatementOfN = tree.
GetRoot
().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(2).Statements.First
232
Dim firstStatementOfN2 = tree.
GetRoot
().DescendantNodes.OfType(Of MethodBlockBaseSyntax)()(3).Statements.First
279
Dim lambdas = tree.
GetRoot
().DescendantNodes.OfType(Of LambdaExpressionSyntax)().ToArray()
371
Dim asyncExpressions = tree.
GetRoot
().DescendantNodes.OfType(Of AwaitExpressionSyntax).ToArray()
375
Dim invocationExpression = tree.
GetRoot
().DescendantNodes.OfType(Of InvocationExpressionSyntax).ToArray()
379
Dim allParsedExpressions = tree.
GetRoot
().DescendantNodes.OfType(Of ExpressionSyntax)()
436
Dim awaitExpressions = tree.
GetRoot
().DescendantNodes.OfType(Of AwaitExpressionSyntax).ToArray()
440
Dim awaitParsedAsIdentifier = tree.
GetRoot
().DescendantNodes.OfType(Of IdentifierNameSyntax).Where(Function(id) id.Identifier.ValueText.Equals("Await")).ToArray()
Parser\ParseAttributes.vb (1)
43
Dim root = tree.
GetRoot
Parser\ParseDirectives.vb (44)
1262
Dim tk = tree.
GetRoot
().FindToken(text.IndexOf("class c2", StringComparison.Ordinal))
1265
tk = tree.
GetRoot
().FindToken(text.IndexOf("class c1", StringComparison.Ordinal))
1615
Dim root = tree.
GetRoot
()
1645
Dim root = tree.
GetRoot
()
1684
Dim root = tree.
GetRoot
()
1729
Dim root = tree.
GetRoot
()
1748
Dim root = tree.
GetRoot
()
1768
Dim root = tree.
GetRoot
()
1794
Dim root = tree.
GetRoot
()
1814
Dim root = tree.
GetRoot
()
1840
Dim root = tree.
GetRoot
()
1865
Dim root = tree.
GetRoot
()
1885
Dim root = tree.
GetRoot
()
1907
Dim root = tree.
GetRoot
()
1932
Dim root = tree.
GetRoot
()
1955
Dim root = tree.
GetRoot
()
1981
Dim root = tree.
GetRoot
()
2003
Dim root = tree.
GetRoot
()
2029
Dim root = tree.
GetRoot
()
2058
Dim root = tree.
GetRoot
()
2085
Dim root = tree.
GetRoot
()
2110
Dim root = tree.
GetRoot
()
2136
Dim root = tree.
GetRoot
()
2158
Dim root = tree.
GetRoot
()
2190
Dim root = tree.
GetRoot
()
2229
Dim root = tree.
GetRoot
()
2257
Dim root = tree.
GetRoot
()
2292
Dim root = tree.
GetRoot
()
2320
Dim root = tree.
GetRoot
()
2345
Dim root = tree.
GetRoot
()
2366
Dim root = tree.
GetRoot
()
2388
Dim root = tree.
GetRoot
()
2405
Dim root = tree.
GetRoot
()
2430
Dim root = tree.
GetRoot
()
2452
Dim root = tree.
GetRoot
()
2476
Dim root = tree.
GetRoot
()
2496
Dim root = tree.
GetRoot
()
2525
Dim root = tree.
GetRoot
()
2546
Dim root = tree.
GetRoot
()
2575
Dim root = tree.
GetRoot
()
2596
Dim root = tree.
GetRoot
()
2613
Dim root = tree.
GetRoot
()
2633
Dim root = tree.
GetRoot
()
2669
Dim root = tree.
GetRoot
()
Parser\ParseErrorTests.vb (4)
4736
Assert.Equal(code, tree.
GetRoot
().ToString())
4744
Assert.Equal(code, tree.
GetRoot
().ToString())
4754
Assert.Equal(code, tree.
GetRoot
().ToString())
4763
Dim emptyStatement = tree.
GetRoot
().DescendantNodes().OfType(Of EmptyStatementSyntax).Single()
Parser\ParseExpression.vb (8)
1109
Dim root = tree.
GetRoot
()
1132
Dim root = tree.
GetRoot
()
1156
Dim root = tree.
GetRoot
()
2155
VerifySyntaxKinds(tree.
GetRoot
().DescendantNodes.OfType(Of XmlBracketedNameSyntax).First,
2249
Dim nodes = tree.
GetRoot
().DescendantNodes().ToArray()
2266
Dim nodes = tree.
GetRoot
().DescendantNodes().ToArray()
2283
Dim nodes = tree.
GetRoot
().DescendantNodes().ToArray()
2301
Dim nodes = tree.
GetRoot
().DescendantNodes().ToArray()
Parser\ParseImports.vb (2)
122
VerifySyntaxKinds(tree.
GetRoot
().DescendantNodes.OfType(Of ImportsStatementSyntax).First,
143
VerifySyntaxKinds(tree.
GetRoot
().DescendantNodes.OfType(Of ImportsStatementSyntax).First,
Parser\ParseIteratorTests.vb (7)
78
Assert.Equal(6, Aggregate t In tree.
GetRoot
().DescendantTokens Where t.Kind = SyntaxKind.IteratorKeyword Into Count())
152
Dim yieldStatements = tree.
GetRoot
().DescendantNodes.OfType(Of YieldStatementSyntax)().ToArray()
156
Dim methodSyntaxList = tree.
GetRoot
().DescendantNodes.OfType(Of MethodBlockBaseSyntax)().ToArray()
224
Dim yieldStatements = tree.
GetRoot
().DescendantNodes.OfType(Of YieldStatementSyntax)().ToArray()
257
Dim lambdas = tree.
GetRoot
().DescendantNodes.OfType(Of LambdaExpressionSyntax)().ToArray()
362
Dim actual = From expression In tree.
GetRoot
().DescendantNodes()
409
Dim yieldStatements = tree.
GetRoot
().DescendantNodes.OfType(Of YieldStatementSyntax).ToArray()
Parser\ParseStatements.vb (21)
361
Dim compUnit = tree.
GetRoot
()
576
Dim compUnit = tree.
GetRoot
()
1697
Dim root = tree.
GetRoot
()
2103
Dim moduleBlock = t.
GetRoot
().ChildNodesAndTokens()(1)
2150
Dim moduleBlock = t.
GetRoot
().ChildNodesAndTokens()(1)
4171
Dim NodeFound = From lambdaItem In compilation.SyntaxTrees(0).
GetRoot
.DescendantNodes.OfType(Of MultiLineLambdaExpressionSyntax)()
4201
Dim NodeFound1 = From lambdaItem In Compilation.SyntaxTrees(0).
GetRoot
.DescendantNodes.OfType(Of SingleLineLambdaExpressionSyntax)()
4231
Dim NodeFound1 = From lambdaItem In Compilation.SyntaxTrees(0).
GetRoot
.DescendantNodes.OfType(Of SingleLineLambdaExpressionSyntax)()
4359
Dim tokens = tree.
GetRoot
().DescendantTokens().ToArray()
4628
Dim tokens = tree.
GetRoot
().DescendantTokens().Select(Function(t) t.Node.ToFullString().NormalizeLineEndings()).ToArray()
4655
Dim tokens = tree.
GetRoot
().DescendantTokens().Select(Function(t) t.Node.ToFullString()).ToArray()
4681
Dim tokens = tree.
GetRoot
().DescendantTokens().Select(Function(t) t.Node).ToArray()
6501
Dim tokens = tree.
GetRoot
().DescendantTokens().Select(Function(t) t.Node).ToArray()
6502
Dim allTrivia = tree.
GetRoot
().DescendantTrivia().ToArray()
6518
Dim tokens = tree.
GetRoot
().DescendantTokens().Select(Function(t) t.Node).ToArray()
6519
Dim allTrivia = tree.
GetRoot
().DescendantTrivia().ToArray()
6553
Dim tokens = tree.
GetRoot
().DescendantTokens().Select(Function(t) t.Node).ToArray()
6554
Dim allTrivia = tree.
GetRoot
().DescendantTrivia().ToArray()
7302
Dim actualStatementsAndTrivia = tree.
GetRoot
().
7875
Dim root = tree.
GetRoot
()
7902
Dim root = tree.
GetRoot
()
Parser\ParseXml.vb (4)
1892
Dim main = tree.
GetRoot
().ChildNodesAndTokens()(0).ChildNodesAndTokens()(1)
1916
Assert.Equal(code, tree.
GetRoot
().ToString())
3545
Dim kinds1 = tree1.
GetRoot
().DescendantNodes().OfType(Of XmlNameSyntax).Select(getPossibleKeywordKind)
3549
Dim kinds2 = tree2.
GetRoot
().DescendantNodes().OfType(Of XmlNameSyntax).Select(getPossibleKeywordKind)
Parser\XmlDocComments.vb (3)
67
]]>).
GetRoot
()
88
Dim tk = node.
GetRoot
().FindToken(25)
105
Dim tk = node.
GetRoot
().FindToken(25)
Scanner\XmlScannerTests.vb (1)
375
Dim eof = tree.
GetRoot
().ChildTokens.Single()
Syntax\ManualTests.vb (2)
115
Dim node = VisualBasicSyntaxTree.ParseText(" ").
GetRoot
()
227
Dim token = tree.
GetRoot
().FindToken(text.Lines.Item(3).Start)
Syntax\SerializationTests.vb (12)
20
Dim root = tree.
GetRoot
()
30
Assert.True(droot.IsEquivalentTo(tree.
GetRoot
()))
61
Assert.True(droot.IsEquivalentTo(tree.
GetRoot
()))
72
Dim root = tree.
GetRoot
().WithAdditionalAnnotations(annotation)
87
Assert.True(droot.IsEquivalentTo(tree.
GetRoot
()))
98
Dim root = tree.
GetRoot
().WithAdditionalAnnotations(annotation, annotation)
113
Assert.True(droot.IsEquivalentTo(tree.
GetRoot
()))
124
Dim root = tree.
GetRoot
().WithAdditionalAnnotations(annotation1)
172
Dim root = tree.
GetRoot
().WithAdditionalAnnotations(annotation1, annotation1)
198
Dim root = tree.
GetRoot
().WithAdditionalAnnotations(annotation)
213
Assert.True(droot.IsEquivalentTo(tree.
GetRoot
()))
451
Dim root = tree.
GetRoot
()
Syntax\StatementSyntaxWalkerTests.vb (1)
57
myWalker.Visit(tree.
GetRoot
())
Syntax\SyntaxAnnotationTests.vb (33)
46
Dim fromNode = VisualBasicSyntaxTree.ParseText(_helloWorldCode).
GetRoot
()
54
Dim fromNode = VisualBasicSyntaxTree.ParseText(_helloWorldCode).
GetRoot
()
55
Dim toNode = VisualBasicSyntaxTree.ParseText(_helloWorldCode).
GetRoot
()
64
Dim toToken = VisualBasicSyntaxTree.ParseText(_helloWorldCode).
GetRoot
().DescendantTokens().First()
71
Dim fromToken = VisualBasicSyntaxTree.ParseText(_helloWorldCode).
GetRoot
().DescendantTokens().First()
79
Dim fromToken = VisualBasicSyntaxTree.ParseText(_helloWorldCode).
GetRoot
().DescendantTokens().First()
80
Dim toToken = VisualBasicSyntaxTree.ParseText(_helloWorldCode).
GetRoot
().DescendantTokens().First()
90
Dim toTrivia = GetAllTrivia(tree.
GetRoot
()).FirstOrDefault()
99
Dim fromTrivia = GetAllTrivia(tree.
GetRoot
()).FirstOrDefault()
107
Dim fromTrivia = GetAllTrivia(tree.
GetRoot
()).FirstOrDefault()
108
Dim toTrivia = GetAllTrivia(tree.
GetRoot
()).FirstOrDefault()
123
Dim matchingNodesOrTokens = tree.
GetRoot
().GetAnnotatedNodesAndTokens(annotation)
132
Dim matchingTrivia = tree.
GetRoot
().GetAnnotatedTrivia(annotation)
147
Dim node = GetAllNodesAndTokens(tree.
GetRoot
()).First(Function(t) t.IsNode).AsNode()
151
Dim newRoot = tree.
GetRoot
().ReplaceNode(node, annotatedNode)
178
Dim token = GetAllNodesAndTokens(tree.
GetRoot
()).First(Function(t) t.IsToken).AsToken()
182
Dim newRoot = tree.
GetRoot
().ReplaceToken(token, annotatedToken)
209
Dim trivia = GetAllTrivia(tree.
GetRoot
()).First()
213
Dim newRoot = tree.
GetRoot
().ReplaceTrivia(trivia, annotatedTrivia)
236
Dim newRoot = tree.
GetRoot
()
249
TestMultipleAnnotationsInTree(tree.
GetRoot
(), newRoot, annotations)
266
Dim firstNode = GetAllNodesAndTokens(tree.
GetRoot
()).First(Function(t) t.IsNode).AsNode()
271
Dim newRoot = tree.
GetRoot
().ReplaceNode(lastChildOfFirstNode, annotatedNode)
361
Dim sourceTreeRoot = DirectCast(rewriter.Visit(tree1.
GetRoot
()), VisualBasicSyntaxNode)
363
Dim destTreeRoot = CopyAnnotationsTo(sourceTreeRoot, tree2.
GetRoot
())
438
Dim currentRoot = tree.
GetRoot
()
467
Dim candidatePool = GetAllNodesAndTokens(tree.
GetRoot
())
477
Dim newRoot = Replace(tree.
GetRoot
(), firstItem, firstAnnotated)
519
For Each trivia In GetAllTrivia(tree.
GetRoot
())
522
Dim newRoot = tree.
GetRoot
().ReplaceTrivia(trivia, newTrivia)
531
For Each nodeOrToken In GetAllNodesAndTokens(tree.
GetRoot
())
537
newRoot = tree.
GetRoot
().ReplaceToken(nodeOrToken.AsToken(), newToken)
540
newRoot = tree.
GetRoot
().ReplaceNode(nodeOrToken.AsNode(), newNode)
Syntax\SyntaxFactsTest.vb (2)
1185
Dim tokens = tree.
GetRoot
().DescendantTokens().ToArray()
1213
Dim memberAccess = tree.
GetRoot
().DescendantNodes().OfType(Of MemberAccessExpressionSyntax).Single()
Syntax\SyntaxListTests.vb (2)
261
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of CollectionInitializerSyntax)().First()
287
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of CollectionInitializerSyntax)().First()
Syntax\SyntaxNormalizerTests.vb (2)
871
Dim root = Parse(text).
GetRoot
()
892
Dim root = Parse(text).
GetRoot
()
Syntax\SyntaxRewriterTests.vb (11)
479
Assert.Same(expression, tree.
GetRoot
())
498
Dim oldRoot = oldTree.
GetRoot
()
531
Dim root = tree.
GetRoot
()
550
Dim root = tree.
GetRoot
()
569
Dim root = tree.
GetRoot
()
594
Dim root = tree.
GetRoot
()
612
Dim root = tree.
GetRoot
()
636
Dim field = tree.
GetRoot
().DescendantNodes().OfType(Of FieldDeclarationSyntax).Single()
663
Dim field = tree.
GetRoot
().DescendantNodes().OfType(Of FieldDeclarationSyntax).Single()
685
Dim root = tree.
GetRoot
()
698
Dim root = tree.
GetRoot
()
Syntax\SyntaxSubmissionsTests.vb (1)
15
Dim compilation = DirectCast(tree.
GetRoot
(), CompilationUnitSyntax)
Syntax\SyntaxTreeTests.vb (4)
116
Assert.Equal(newRoot.ToString(), newTree.
GetRoot
().ToString())
133
Assert.Equal(newRoot.ToString(), newTree.
GetRoot
().ToString())
146
Assert.Equal(newRoot.ToString(), newTree.
GetRoot
().ToString())
193
Assert.Equal(String.Empty, VisualBasicSyntaxTree.Create(CType(oldTree.
GetRoot
, VisualBasicSyntaxNode), path:=Nothing).FilePath)
TestSyntaxNodes.vb (28)
1734
Dim node As SyntaxNode = tree.
GetRoot
()
1736
Assert.Equal(0, tree.
GetRoot
().FindToken(node.FullSpan.Length - 1).TrailingTrivia.Count)
1737
Assert.Equal(1, tree.
GetRoot
().FindToken(0).LeadingTrivia.Count)
1764
Dim node As SyntaxNode = tree.
GetRoot
()
1924
Dim tk0 = prog.
GetRoot
().FindToken(25)
1954
Dim tk0 = prog.
GetRoot
().FindToken(32)
1985
Dim openParenToken = CType(tree.
GetRoot
().FindToken(location + "List".Length), SyntaxToken)
2001
Dim trivia = prog.
GetRoot
().FindToken(28).TrailingTrivia
2019
Dim tk0 As SyntaxNodeOrToken = prog.
GetRoot
().FindToken(31)
2044
Dim tk0 As SyntaxNodeOrToken = prog.
GetRoot
().FindToken(35)
2075
Dim tk0 As SyntaxNodeOrToken = prog.
GetRoot
().FindToken(35)
2176
Dim sN As SyntaxNodeOrToken = prog.
GetRoot
()
2214
Dim tokens As List(Of SyntaxToken) = tree.
GetRoot
().DescendantTokens().ToList()
2216
Dim token As SyntaxToken = tree.
GetRoot
().GetFirstToken()
2231
token = tree.
GetRoot
().GetFirstToken()
2238
Dim lastToken = tree.
GetRoot
().DescendantTokens().Last
2255
Dim root = tree.
GetRoot
()
2352
Dim trivia = tree.
GetRoot
().FindTrivia(position)
2839
Dim Root As CompilationUnitSyntax = CType(tree.
GetRoot
(), CompilationUnitSyntax)
2885
Dim Root As CompilationUnitSyntax = CType(tree.
GetRoot
(), CompilationUnitSyntax)
2930
For Each node In tree.
GetRoot
.ChildNodes
3265
Dim Root As CompilationUnitSyntax = CType(tree.
GetRoot
(), CompilationUnitSyntax)
3339
Dim Root As CompilationUnitSyntax = CType(tree.
GetRoot
(), CompilationUnitSyntax)
3365
Dim Root As CompilationUnitSyntax = CType(tree.
GetRoot
(), CompilationUnitSyntax)
3389
Dim Root As CompilationUnitSyntax = CType(tree.
GetRoot
(), CompilationUnitSyntax)
3410
Dim trivia = tree.
GetRoot
().FindTrivia(4000)
3433
Dim Root As CompilationUnitSyntax = CType(tree.
GetRoot
(), CompilationUnitSyntax)
3452
Dim Root As CompilationUnitSyntax = CType(tree.
GetRoot
(), CompilationUnitSyntax)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (28)
BasicTestSource.vb (1)
32
Dim root = tree.
GetRoot
()
CompilationTestUtils.vb (5)
417
Dim token = tree.
GetRoot
().FindToken(bindPoint, True)
457
Dim text As String = tree.
GetRoot
().ToFullString()
496
Dim token As SyntaxToken = tree.
GetRoot
().FindToken(bindPoint)
648
Dim node = tree.
GetRoot
().FindToken(position)
1126
node = tree.
GetRoot
().FindToken(pos).Parent
ParserTestUtilities.vb (18)
80
Dim root = tree.
GetRoot
()
114
Dim root = tree.
GetRoot
()
225
Dim incTreeRoot = oldTree.
GetRoot
()
227
Dim newTreeRoot = newTree.
GetRoot
()
229
incTreeRoot = incTree.
GetRoot
()
246
VerifyParents(oldTree.
GetRoot
())
247
VerifyParents(newTree.
GetRoot
())
248
VerifyParents(incTree.
GetRoot
())
295
VerifySyntaxKinds(tree.
GetRoot
(), expected)
319
GetOccurrenceCount(kind, tree.
GetRoot
(), actualCount)
326
InternalTraverseAllNodes(tree.
GetRoot
())
336
If TryFindNodeOrToken(tree.
GetRoot
(), kind, occurrence, foundNode) Then
371
InternalVerifyNoWhitespaceInKeywords(tree.
GetRoot
())
377
Dim node = tree.
GetRoot
()
387
Dim node = tree.
GetRoot
()
397
Dim node = tree.
GetRoot
()
439
For Each child In tree.
GetRoot
().ChildNodesAndTokens()
447
Dim node = tree.
GetRoot
()
SemanticModelTestBase.vb (3)
33
Dim token As SyntaxToken = tree.
GetRoot
().FindToken(bindPoint)
57
Dim text As String = tree.
GetRoot
().ToFullString()
74
Dim token As SyntaxToken = tree.
GetRoot
().FindToken(bindPoint)
SyntaxTreeExtensions.vb (1)
69
Return node.
GetRoot
().Dump()
Microsoft.CodeAnalysis.VisualBasic.Workspaces (18)
DirectiveSyntaxExtensions.vb (1)
90
Return GetDirectiveInfo(syntaxTree.
GetRoot
(cancellationToken), cancellationToken).StartEndMap.Keys.Where(
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxTreeExtensions.vb\SyntaxTreeExtensions.vb (4)
122
Return FindTriviaToLeft(syntaxTree.
GetRoot
(cancellationToken), position)
305
Dim compilationUnit = TryCast(syntaxTree.
GetRoot
(cancellationToken), CompilationUnitSyntax)
353
directive.FullSpan.End = syntaxTree.
GetRoot
(cancellationToken).FullSpan.End
359
Dim token = syntaxTree.
GetRoot
(cancellationToken).FindToken(line.Start)
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ContextQuery\SyntaxTreeExtensions.vb\SyntaxTreeExtensions.vb (1)
107
Dim token = syntaxTree.
GetRoot
(cancellationToken).FindToken(position)
Rename\VisualBasicRenameRewriterLanguageService.vb (5)
190
Dim speculativeTree = originalNode.SyntaxTree.
GetRoot
(_cancellationToken).ReplaceNode(originalNode, newNode)
198
newNode = Me._speculativeModel.SyntaxTree.
GetRoot
(_cancellationToken).GetAnnotatedNodes(Of SyntaxNode)(annotation).First()
212
speculativeTree = originalNode.SyntaxTree.
GetRoot
(_cancellationToken).ReplaceNode(originalNode, expandedNewNode)
222
probableRenameNode = Me._speculativeModel.SyntaxTree.
GetRoot
(_cancellationToken).GetAnnotatedNodes(Of SyntaxNode)(annotation).First()
223
speculativeNewNode = Me._speculativeModel.SyntaxTree.
GetRoot
(_cancellationToken).GetAnnotatedNodes(Of SyntaxNode)(annotationForSpeculativeNode).First()
Simplification\VisualBasicSimplificationService.vb (2)
128
nodeToSpeculate = speculativeModel.SyntaxTree.
GetRoot
()
165
Dim root = model.SyntaxTree.
GetRoot
(cancellationToken)
SyntaxNodeExtensions.vb (1)
779
Return tree.
GetRoot
().ReplaceNode(oldBlock, newBlock)
VisualBasicIndentationService.Indenter.vb (1)
73
Dim firstTrivia As SyntaxTrivia = indenter.Tree.
GetRoot
(indenter.CancellationToken).FindTrivia(tokenOpt.Value.Span.End + 1)
VisualBasicTypeInferenceService.TypeInferrer.vb (1)
788
Dim tokenInOriginalTree = originalSemanticModel.SyntaxTree.
GetRoot
(CancellationToken).FindToken(currentSemanticModel.OriginalPositionForSpeculation)
VisualBasicUnnecessaryImportsProvider.vb (2)
30
Dim root = model.SyntaxTree.
GetRoot
(cancellationToken)
73
Dim root = DirectCast(model.SyntaxTree.
GetRoot
(cancellationToken), CompilationUnitSyntax)
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (9)
CodeGeneration\SyntaxGeneratorTests.vb (3)
816
Dim declarations = syntaxTree.
GetRoot
().DescendantNodes().OfType(Of MethodBlockBaseSyntax)
1091
Dim node = tree.
GetRoot
().DescendantNodes().First()
3815
Dim declCU = comp.SyntaxTrees.First().
GetRoot
()
Formatting\VisualBasicFormattingTestBase.vb (3)
65
spans.Add(syntaxTree.
GetRoot
().FullSpan)
74
spans.Add(syntaxTree.
GetRoot
().FullSpan)
80
AssertFormatWithTransformation(workspace.Services.SolutionServices, expected, syntaxTree.
GetRoot
(), spans, options, False)
VisualBasicSyntaxFactsServiceTests.vb (3)
510
Dim node = tree.
GetRoot
().FindNode(span)
528
Dim token = tree.
GetRoot
().FindToken(position)
544
Dim node = tree.
GetRoot
().FindToken(position).Parent
Microsoft.CodeAnalysis.Workspaces (33)
AbstractCodeGenerationService.cs (1)
527
var root = attributeToRemove.SyntaxTree.
GetRoot
();
AbstractIndentation.Indenter.cs (1)
55
Root = (TSyntaxRoot)tree.
GetRoot
(cancellationToken);
BottomUpBaseIndentationFinder.cs (3)
51
var operation = GetIndentationDataFor(tree.
GetRoot
(cancellationToken), token, position);
102
tree.
GetRoot
(cancellationToken),
167
baseToken = baseToken.SyntaxTree.
GetRoot
(cancellationToken).FindToken(textLine.Start);
Classification\Classifier.cs (1)
74
var root = semanticModel.SyntaxTree.
GetRoot
(cancellationToken);
Classification\SyntaxClassification\AbstractSyntaxClassificationService.Worker.cs (1)
66
worker._pendingNodes.Push(worker._syntaxTree.
GetRoot
(cancellationToken));
Editing\DocumentEditor.cs (1)
39
var root = model.SyntaxTree.
GetRoot
(cancellationToken);
Editing\SymbolEditor.cs (2)
296
var newDeclaration = model.SyntaxTree.
GetRoot
(cancellationToken).GetCurrentNode(declaration);
487
var newDeclaration = model.SyntaxTree.
GetRoot
(cancellationToken).GetCurrentNode(decl);
FindSymbols\TopLevelSyntaxTree\DeclaredSymbolInfo.cs (1)
240
var root = semanticModel.SyntaxTree.
GetRoot
(cancellationToken);
GeneratedCodeUtilities.cs (1)
120
var root = tree.
GetRoot
(cancellationToken);
J\s\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (1)
22
var root = tree.
GetRoot
();
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (5)
122
var root = syntaxTree.
GetRoot
(cancellationToken);
133
var root = syntaxTree.
GetRoot
(cancellationToken);
170
var root = syntaxTree.
GetRoot
(cancellationToken);
208
return syntaxTree.
GetRoot
(cancellationToken).FindTokenOnRightOfPosition(
223
return syntaxTree.
GetRoot
(cancellationToken).FindTokenOnLeftOfPosition(
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);
ParsedDocument.cs (1)
52
var root = SyntaxTree.WithChangedText(text).
GetRoot
(cancellationToken);
Rename\RenameUtilities.cs (1)
47
var bindableToken = semanticModel.SyntaxTree.
GetRoot
(cancellationToken).FindToken(position, findInsideTrivia: true);
SymbolKey.AliasSymbolKey.cs (1)
44
var result = Resolve(semanticModel, syntaxTree.
GetRoot
(reader.CancellationToken), name, target, reader.CancellationToken);
SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
54
var root = syntaxTree.
GetRoot
(reader.CancellationToken);
SyntaxPath.cs (1)
139
return TryResolve(syntaxTree.
GetRoot
(cancellationToken), out node);
SyntaxTokenExtensions.cs (1)
95
? ((ICompilationUnitSyntax)token.Parent!.SyntaxTree!.
GetRoot
(CancellationToken.None)).EndOfFileToken
Workspace\Solution\Document.cs (2)
161
/// to <see cref="SyntaxTree.
GetRoot
"/> or <see cref="SyntaxTree.GetRootAsync"/> may end up causing computation
251
return tree.
GetRoot
(cancellationToken);
Workspace\Solution\DocumentState.cs (2)
698
var newTreeContent = newTree.
GetRoot
().ToFullString();
701
var oldTreeContent = oldTree?.
GetRoot
().ToFullString();
Workspace\Solution\DocumentState_LinkedFileReuse.cs (1)
210
var siblingRoot = siblingTree.
GetRoot
(cancellationToken);
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (3)
VisualStudioMSBuildWorkspaceTests.cs (3)
61
var type = tree.
GetRoot
().DescendantTokens().First(t => t.ToString() == "class").Parent;
425
var type = tree.
GetRoot
().DescendantTokens().First(t => t.ToString() == "class").Parent;
2813
var type = tree.
GetRoot
().DescendantTokens().First(t => t.ToString() == "class").Parent;
Microsoft.CodeAnalysis.Workspaces.UnitTests (52)
FindReferencesTests.cs (4)
166
SyntaxNode declareMethod = tree.
GetRoot
().DescendantNodes().OfType<Microsoft.CodeAnalysis.VisualBasic.Syntax.DeclareStatementSyntax>().FirstOrDefault();
167
SyntaxNode normalMethod = tree.
GetRoot
().DescendantNodes().OfType<Microsoft.CodeAnalysis.VisualBasic.Syntax.MethodStatementSyntax>().ToList()[1];
205
var propertyStatement = tree.
GetRoot
().DescendantNodes().OfType<Microsoft.CodeAnalysis.VisualBasic.Syntax.PropertyStatementSyntax>().FirstOrDefault();
269
var methodlist = tree.
GetRoot
().DescendantNodes().OfType<Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax>().ToList();
FormattingTests.cs (1)
87
var formattedRoot = Formatter.Format(tree.
GetRoot
(), workspace.Services.SolutionServices, options, CancellationToken.None);
SerializationTests.cs (1)
71
var root = (CS.Syntax.CompilationUnitSyntax)model.SyntaxTree.
GetRoot
();
SolutionTests\SolutionTests.cs (18)
283
var root = tree.
GetRoot
();
1296
Assert.False(oldTree.
GetRoot
().IsIncrementallyIdenticalTo(newTree.
GetRoot
()));
1325
var oldRoot = oldTree.
GetRoot
();
1339
Assert.Equal(expectReuse, oldRoot.IsIncrementallyIdenticalTo(newTree.
GetRoot
()));
1836
var root = CSharp.SyntaxFactory.ParseSyntaxTree(SourceText.From("class C {}", encoding: null, SourceHashAlgorithm.Sha1)).
GetRoot
();
2540
var root = tree.
GetRoot
();
2548
var root2 = tree2.
GetRoot
();
2764
Assert.Equal(text, docTree.
GetRoot
().ToString());
2785
Assert.Equal(text, docTree.
GetRoot
().ToString());
2794
var tree = CSharp.SyntaxFactory.ParseSyntaxTree("public class C {}").
GetRoot
(CancellationToken.None);
3049
var root = tree.
GetRoot
();
3066
var root2 = tree2.
GetRoot
();
3145
Assert.Same(tree2, tree2.
GetRoot
().SyntaxTree);
3173
Assert.Same(tree3, tree3.
GetRoot
().SyntaxTree);
3180
var tree4 = tree.WithRootAndOptions(tree.
GetRoot
(), newOptions);
3184
Assert.Same(tree4, tree4.
GetRoot
().SyntaxTree);
3191
Assert.Same(tree, tree.WithRootAndOptions(tree.
GetRoot
(), tree.Options));
SymbolKeyTests.cs (5)
549
var symbols = tree.
GetRoot
().DescendantNodes().OfType<CSharp.Syntax.InvocationExpressionSyntax>().Select(s => model.GetSymbolInfo(s).Symbol).ToList();
585
var symbols = tree.
GetRoot
().DescendantNodes().OfType<CSharp.Syntax.InvocationExpressionSyntax>().Select(s => model.GetSymbolInfo(s).GetAnySymbol()).ToList();
608
var symbols = tree.
GetRoot
().DescendantNodes().OfType<CSharp.Syntax.UsingDirectiveSyntax>().Select(s => model.GetDeclaredSymbol(s)).ToList();
1203
var root = tree.
GetRoot
();
1419
GetAllSymbols(model, model.SyntaxTree.
GetRoot
(), list, predicate);
SyntaxNodeTests.cs (2)
30
var root = tree.
GetRoot
();
51
var root = tree.
GetRoot
();
SyntaxPathTests.cs (12)
81
var root = tree.
GetRoot
();
106
var root = tree.
GetRoot
();
120
var root = tree.
GetRoot
();
147
var namespaceDecl = (NamespaceDeclarationSyntax)(tree.
GetRoot
() as CompilationUnitSyntax).Members[0];
185
var namespaceDecl = (NamespaceDeclarationSyntax)(tree.
GetRoot
() as CompilationUnitSyntax).Members[0];
218
var namespaceDecl = (NamespaceDeclarationSyntax)((CompilationUnitSyntax)tree.
GetRoot
()).Members[0];
250
var namespaceDecl = (NamespaceDeclarationSyntax)((CompilationUnitSyntax)tree.
GetRoot
()).Members[0];
278
var namespaceDecl = (NamespaceDeclarationSyntax)((CompilationUnitSyntax)tree.
GetRoot
()).Members[0];
309
var namespaceDecl = (NamespaceDeclarationSyntax)((CompilationUnitSyntax)tree.
GetRoot
()).Members[0];
338
var namespaceDecl = (NamespaceDeclarationSyntax)((CompilationUnitSyntax)tree.
GetRoot
()).Members[0];
377
var namespaceDecl = (NamespaceDeclarationSyntax)((CompilationUnitSyntax)tree.
GetRoot
()).Members[0];
399
var root = (CompilationUnitSyntax)tree.
GetRoot
();
SyntaxReferenceTests.cs (6)
67
var node = tree.
GetRoot
().DescendantNodes().OfType<CS.Syntax.TypeParameterSyntax>().Single();
89
var node = tree.
GetRoot
().DescendantNodes().OfType<VB.Syntax.TypeParameterSyntax>().Single();
113
var node = tree.
GetRoot
().DescendantNodes(descendIntoTrivia: true).OfType<CS.Syntax.BinaryExpressionSyntax>().First();
136
var node = tree.
GetRoot
().DescendantNodes(descendIntoTrivia: true).OfType<VB.Syntax.BinaryExpressionSyntax>().First();
160
var binary = tree.
GetRoot
().DescendantNodes(descendIntoTrivia: true).OfType<CS.Syntax.BinaryExpressionSyntax>().First();
187
var binary = tree.
GetRoot
().DescendantNodes(descendIntoTrivia: true).OfType<VB.Syntax.BinaryExpressionSyntax>().First();
UtilityTest\FormattingRangeHelperTests.cs (3)
19
var root = SyntaxFactory.ParseSyntaxTree("{Foo();}").
GetRoot
();
29
var root = SyntaxFactory.ParseSyntaxTree("{Fizz();\nBuzz();}").
GetRoot
();
39
var token = SyntaxFactory.ParseSyntaxTree("else\nFoo();").
GetRoot
().GetFirstToken();
Microsoft.VisualStudio.LanguageServices (2)
Venus\ContainedLanguageCodeSupport.cs (2)
212
var destinationType = syntaxFacts.GetContainingTypeDeclaration(targetSyntaxTree.
GetRoot
(cancellationToken), position);
226
var newRoot = targetSyntaxTree.
GetRoot
(cancellationToken).ReplaceNode(destinationType, newType);
Microsoft.VisualStudio.LanguageServices.Implementation (4)
CodeModel\AbstractCodeModelService.AbstractCodeModelEventCollector.cs (2)
38
CollectCore(oldTree.
GetRoot
(CancellationToken.None), newTree.
GetRoot
(CancellationToken.None), eventQueue);
CodeModel\AbstractCodeModelService.cs (1)
181
=> GetMemberNodes(syntaxTree.
GetRoot
(), includeSelf: true, recursive: true, logicalFields: true, onlySupportedNodes: true);
RoslynVisualStudioWorkspace.cs (1)
172
var syntaxNode = tree.
GetRoot
().FindNode(sourceLocation.SourceSpan);
Microsoft.VisualStudio.LanguageServices.UnitTests (1)
CodeModel\CSharp\SyntaxNodeKeyTests.vb (1)
241
Dim node = tree.
GetRoot
().FindToken(cursorPosition).Parent
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)
Help\VisualBasicHelpContextService.vb (2)
41
Dim token = tree.
GetRoot
(cancellationToken).FindToken(span.Start, findInsideTrivia:=True)
53
Dim trivia = tree.
GetRoot
(cancellationToken).FindTrivia(span.Start, findInsideTrivia:=True)
Roslyn.Compilers.VisualBasic.IOperation.UnitTests (40)
IOperation\IOperationTests.vb (3)
54
Dim nodes = tree.
GetRoot
().DescendantNodes().OfType(Of AssignmentStatementSyntax).ToArray()
179
Dim nodes = tree.
GetRoot
().DescendantNodes().OfType(Of AssignmentStatementSyntax).ToArray()
374
Dim nodes = tree.
GetRoot
().DescendantNodes().OfType(Of InvocationExpressionSyntax)().ToArray()
IOperation\IOperationTests_ICoalesceOperation.vb (11)
35
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of BinaryConditionalExpressionSyntax)().Single()
151
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of BinaryConditionalExpressionSyntax)().Single()
271
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of BinaryConditionalExpressionSyntax)().Single()
391
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of BinaryConditionalExpressionSyntax)().Single()
508
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of BinaryConditionalExpressionSyntax)().Single()
635
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of BinaryConditionalExpressionSyntax)().Single()
755
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of BinaryConditionalExpressionSyntax)().Single()
872
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of BinaryConditionalExpressionSyntax)().Single()
989
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of BinaryConditionalExpressionSyntax)().Single()
1106
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of BinaryConditionalExpressionSyntax)().Single()
1226
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of BinaryConditionalExpressionSyntax)().Single()
IOperation\IOperationTests_IOmittedArgumentOperation.vb (1)
33
Dim method = syntaxTree.
GetRoot
().DescendantNodes().OfType(Of MethodBlockSyntax).First()
IOperation\IOperationTests_ISwitchOperation.vb (21)
1067
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of SimpleCaseClauseSyntax)().Single()
1161
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of SimpleCaseClauseSyntax)().Single()
1263
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of SimpleCaseClauseSyntax)().Single()
1360
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of SimpleCaseClauseSyntax)().Single()
1463
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of SimpleCaseClauseSyntax)().Single()
3472
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of RelationalCaseClauseSyntax)().Single()
3566
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of RelationalCaseClauseSyntax)().Single()
3668
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of RelationalCaseClauseSyntax)().Single()
3765
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of RelationalCaseClauseSyntax)().Single()
3868
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of RelationalCaseClauseSyntax)().Single()
5518
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of RelationalCaseClauseSyntax)().Single()
5612
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of RelationalCaseClauseSyntax)().Single()
5714
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of RelationalCaseClauseSyntax)().Single()
5810
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of RelationalCaseClauseSyntax)().Single()
5913
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of RelationalCaseClauseSyntax)().Single()
7634
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of RangeCaseClauseSyntax)().Single()
7807
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of RangeCaseClauseSyntax)().Single()
7969
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of RangeCaseClauseSyntax)().Single()
8086
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of RangeCaseClauseSyntax)().Single()
8203
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of RangeCaseClauseSyntax)().Single()
8367
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of RangeCaseClauseSyntax)().Single()
IOperation\IOperationTests_ISymbolInitializer.vb (1)
33
Dim nodes = tree.
GetRoot
().DescendantNodes().Where(Function(n) TryCast(n, VariableDeclaratorSyntax) IsNot Nothing OrElse TryCast(n, PropertyStatementSyntax) IsNot Nothing).ToArray()
IOperation\IOperationTests_IUsingStatement.vb (3)
42
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of UsingBlockSyntax).Single()
82
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of UsingBlockSyntax).Single()
898
Dim node = tree.
GetRoot
().DescendantNodes().OfType(Of UsingBlockSyntax).Single().UsingStatement