1495 references to GetCompilationUnitRoot
IdeCoreBenchmarks (1)
SyntacticChangeRangeBenchmark.cs (1)
45
_root = _tree.
GetCompilationUnitRoot
();
Microsoft.CodeAnalysis.CSharp (5)
Binder\Binder_Initializers.cs (1)
198
var syntaxRoot = syntaxTree.
GetCompilationUnitRoot
();
Compilation\CSharpCompilation.cs (1)
3881
var unit = syntaxTree.
GetCompilationUnitRoot
();
Compilation\SyntaxAndDeclarationManager.cs (3)
204
foreach (var directive in tree.
GetCompilationUnitRoot
().GetLoadDirectives())
475
var newLoadDirectivesSyntax = newTree.
GetCompilationUnitRoot
().GetLoadDirectives();
476
var loadDirectivesHaveChanged = !oldTree.
GetCompilationUnitRoot
().GetLoadDirectives().SequenceEqual(newLoadDirectivesSyntax);
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
91
var root = context.SemanticModel.SyntaxTree.
GetCompilationUnitRoot
(context.CancellationToken);
189
var root = tree.
GetCompilationUnitRoot
(cancellationToken);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (118)
BreakingChanges.cs (2)
199
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
218
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
CodeGen\CodeGenDeconstructTests.cs (8)
1366
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
1423
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
1467
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
1508
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
1561
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
1668
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
5000
var nodes = comp.SyntaxTrees[0].
GetCompilationUnitRoot
().DescendantNodesAndSelf();
5123
var nodes = comp.SyntaxTrees[0].
GetCompilationUnitRoot
().DescendantNodesAndSelf();
CodeGen\CodeGenTupleEqualityTests.cs (46)
362
var tupleX = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().First();
381
var tupleY = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Last();
682
var tuple1 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0);
688
var tuple2 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
713
var equals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
769
var tuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
793
var tuple1 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0);
806
var tuple2 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
854
var equals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
902
var equals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
951
var equals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
1001
var tuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
1008
var lastEquals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Last();
1055
var defaultLiterals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>()
1089
var defaultLiterals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>()
1121
var defaultLiterals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>()
1152
var defaultLiterals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>()
1211
var defaults = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>()
1311
var lastTuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Last();
1397
var literals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>();
1408
var defaultLiterals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>()
1463
var defaultLiterals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>()
1497
var tuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(3);
1557
var nulls = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>();
1566
var tuples = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>();
1594
var lastLiteral = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Last();
1619
var rightTuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(2);
1675
var tuple1 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0);
1683
var tuple2 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
1707
var addition = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Last();
1776
var tuple1 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0);
1782
var tuple2 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
1918
var tuple1 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0);
1924
var tuple2 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
2574
var firstEquals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().First();
2582
var secondEquals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Last();
2642
var equals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Last();
3278
var comparison = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
3684
var comparison = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
3808
var comparison = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
3911
var comparison = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
4036
var comparison = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
4083
var comparison = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().First();
4184
var lastNull = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Last();
5122
var equals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().First();
5158
var equals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().First();
CodeGen\CodeGenTupleTest.cs (62)
1609
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
3218
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
3251
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
3464
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
3635
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
3686
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
3932
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
3989
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
4022
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
4154
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
5473
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8291
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8322
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8377
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8406
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8435
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8483
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8517
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8550
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8579
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8626
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8661
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8690
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8719
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8749
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8804
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8834
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8893
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8940
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
9013
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
9070
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
9142
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
9223
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
9306
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
16539
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
16566
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
16603
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
17210
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
17271
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
17330
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
17368
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
17401
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
17434
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19229
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19291
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19394
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19425
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19479
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19537
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19660
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19704
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19735
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
20357
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
21350
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
22614
var finalString = startTree.
GetCompilationUnitRoot
().ToFullString();
22619
var finalText = newTree.
GetCompilationUnitRoot
().ToFullString();
22855
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
26223
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
26295
var doSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
26328
var doSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
26361
var doSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
26394
var doSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (5)
Emit\NumericIntPtrTests.cs (5)
11172
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
11195
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
11223
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
11248
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
11293
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (29)
Attributes\AttributeTests.cs (3)
5718
var m = (ExpressionSyntax)cm.SyntaxTrees[0].
GetCompilationUnitRoot
().FindToken(index).Parent.Parent;
7537
var attrArgSyntaxes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AttributeArgumentSyntax>();
7578
var attrArgSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AttributeArgumentSyntax>().Single();
FlowAnalysis\IterationJumpYieldStatementTests.cs (1)
914
var foreachNode = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
FlowAnalysis\RegionAnalysisTests.cs (14)
3102
var statement = compilation.SyntaxTrees[0].
GetCompilationUnitRoot
().DescendantNodesAndSelf().OfType<StatementSyntax>().First();
4426
var index = tree.
GetCompilationUnitRoot
().ToFullString().IndexOf(".Class)", StringComparison.Ordinal);
4427
var tok = tree.
GetCompilationUnitRoot
().FindToken(index);
4526
var stmt1 = tree.
GetCompilationUnitRoot
().DescendantNodesAndSelf().OfType<StatementSyntax>().Where(n => n.ToString() == "IntPtr p;").Single();
4527
var stmt2 = tree.
GetCompilationUnitRoot
().DescendantNodesAndSelf().OfType<StatementSyntax>().Where(n => n.ToString().StartsWith(keyword)).First();
5487
var methodBlock = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BlockSyntax>().First();
6217
var invocation = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
6228
var lambda = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single();
6314
var root = tree.
GetCompilationUnitRoot
();
6353
var root = tree.
GetCompilationUnitRoot
();
6380
var root = tree.
GetCompilationUnitRoot
();
6418
var statement = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BlockSyntax>().FirstOrDefault();
6446
var root = tree.
GetCompilationUnitRoot
();
7909
var stmt = tree.
GetCompilationUnitRoot
().DescendantNodesAndSelf().OfType<ForEachStatementSyntax>().Single().Statement;
RefReadonlyParameterTests.cs (2)
7102
var docComment = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>().Single();
7130
var docComment = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>().Single();
Semantics\OutVarTests.cs (4)
34281
var method = syntaxTree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().ElementAt(i + 2);
34291
syntaxTree = syntaxTree.
GetCompilationUnitRoot
().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree;
34495
var method = syntaxTree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().ElementAt(i + 2);
34505
syntaxTree = syntaxTree.
GetCompilationUnitRoot
().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree;
Semantics\PatternSwitchTests.cs (4)
1515
var sRef = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "s").Single();
1517
var iRef = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "i").Single();
1519
var s2Ref = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "s2").Single();
1521
var i2Ref = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "i2").Single();
Semantics\RecordTests.cs (1)
28343
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
Microsoft.CodeAnalysis.CSharp.Features (2)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
91
var root = context.SemanticModel.SyntaxTree.
GetCompilationUnitRoot
(context.CancellationToken);
189
var root = tree.
GetCompilationUnitRoot
(cancellationToken);
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (11)
IOperation\IOperationTests.cs (2)
587
var root = tree.
GetCompilationUnitRoot
();
615
var root = tree.
GetCompilationUnitRoot
();
IOperation\IOperationTests_IVariableDeclaration.cs (9)
925
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
1215
var rankSpecifierOld = syntaxTree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First();
1218
syntaxTree = syntaxTree.
GetCompilationUnitRoot
().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree;
2301
var rankSpecifierOld = syntaxTree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First();
2304
syntaxTree = syntaxTree.
GetCompilationUnitRoot
().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree;
2362
var rankSpecifierOld = syntaxTree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First();
2365
syntaxTree = syntaxTree.
GetCompilationUnitRoot
().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree;
2830
var rankSpecifierOld = syntaxTree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First();
2833
syntaxTree = syntaxTree.
GetCompilationUnitRoot
().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (277)
Semantics\AccessibilityTests.cs (1)
53
s_testModel.IsAccessible(s_testModel.SyntaxTree.
GetCompilationUnitRoot
().FullSpan.End + 1, s_testSymbol));
Semantics\ArglistTests.cs (1)
959
var root = tree.
GetCompilationUnitRoot
();
Semantics\BindingAsyncTests.cs (3)
58
var simple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single();
61
var parens = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>();
87
var del = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single();
Semantics\ConditionalOperatorTests.cs (1)
1288
var compUnit = tree.
GetCompilationUnitRoot
();
Semantics\ConstantTests.cs (1)
2923
var expr = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().First();
Semantics\DeconstructionTests.cs (40)
1839
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
3765
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
3943
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
4169
var designations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
4171
var refs = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>();
4237
var designations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
4256
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
4314
var tuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
4372
var designations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
4391
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
4445
var tuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
4507
foreach (var designation in tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DiscardDesignationSyntax>())
4515
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
4579
var tuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
4665
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
4722
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
4759
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
4837
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
4942
var declaration = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single();
4988
var declaration = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single();
5046
var declaration = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single();
5130
Assert.False(tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any());
5186
var designations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
5205
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
5259
var tuples = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ToArray();
5330
var designations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
5349
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
5403
var tuples = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ToArray();
5478
foreach (var designation in tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DiscardDesignationSyntax>())
5486
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
5546
var tuples = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ToArray();
5654
var designations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
5673
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
5709
var tuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
5764
var designations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
5783
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
5819
var tuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
5878
foreach (var designation in tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DiscardDesignationSyntax>())
5886
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
5925
var tuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
Semantics\ImplicitObjectCreationTests.cs (21)
56
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray();
131
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray();
178
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray();
228
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray();
842
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray();
883
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray();
1706
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
1866
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
1896
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
1926
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
1978
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
2036
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
2071
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
2125
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray();
2217
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
2514
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
2565
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
2922
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray();
3215
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
4157
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Single();
4184
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ExpressionStatementSyntax>().Single();
Semantics\InitOnlyMemberTests.cs (2)
2518
var root = tree.
GetCompilationUnitRoot
();
3137
var root = tree.
GetCompilationUnitRoot
();
Semantics\InteractiveSemanticModelTests.cs (2)
40
var root = tree.
GetCompilationUnitRoot
();
275
return GetExprSyntaxList(syntaxTree.
GetCompilationUnitRoot
(), null);
Semantics\LambdaTests.cs (22)
841
ExpressionSyntax expr = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().
849
var exprs = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>();
941
var invocation = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
1034
.
GetCompilationUnitRoot
()
1088
.
GetCompilationUnitRoot
()
1123
.
GetCompilationUnitRoot
()
1178
var expr = (ExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single().Body;
1206
var expr = (ExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer.Value;
1238
var expr = (ExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single().Body;
2120
var lambda = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
2166
var lambda = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
2212
var lambda = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
2258
var lambda = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
2304
var lambda = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
2334
var lambda = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
2361
var lambda = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
2997
ExpressionSyntax contentType = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ContentType").Single();
3004
ExpressionSyntax b = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b").Single();
3013
ParameterSyntax parameterSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().Single();
3039
ExpressionSyntax contentType = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ContentType").Single();
3046
ExpressionSyntax b = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b").Single();
3054
ParameterSyntax parameterSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().Single();
Semantics\LocalFunctionTests.cs (1)
10384
var root = tree.
GetCompilationUnitRoot
();
Semantics\LockTests.cs (9)
45
var localDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single();
50
var lockStatement = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LockStatementSyntax>().Single();
55
var memberAccessExpression = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
489
var lockStatements = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LockStatementSyntax>().ToList();
550
var localDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TypeParameterSyntax>().Single();
575
var lockStatements = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LockStatementSyntax>().ToList();
604
var localDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single();
628
var localDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single();
699
var lockStatements = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LockStatementSyntax>().ToList();
Semantics\LookupPositionTests.cs (1)
3129
SyntaxToken token = model.SyntaxTree.
GetCompilationUnitRoot
().FindToken(position, findInsideTrivia: true);
Semantics\LookupTests.cs (1)
1369
var eof = tree.
GetCompilationUnitRoot
().FullSpan.End;
Semantics\NativeIntegerTests.cs (6)
15316
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
15337
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
15360
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
15388
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
15411
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
15441
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
Semantics\NonTrailingNamedArgumentsTests.cs (15)
45
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
367
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
393
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
423
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
455
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
484
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
534
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
569
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
598
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
652
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
679
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
710
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
744
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
776
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
983
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
Semantics\OperatorTests.cs (1)
8812
var methodDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Semantics\OverloadResolutionPerfTests.cs (1)
982
var expr = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<Syntax.InvocationExpressionSyntax>().Last();
Semantics\QueryTests.cs (30)
1453
var classC = tree.
GetCompilationUnitRoot
().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single();
1662
var classC = tree.
GetCompilationUnitRoot
().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single();
1722
var classC = tree.
GetCompilationUnitRoot
().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single();
1760
var classC = tree.
GetCompilationUnitRoot
().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single();
2177
SelectClauseSyntax selectClause = (SelectClauseSyntax)tree.
GetCompilationUnitRoot
().FindToken(sourceCode.IndexOf("select", StringComparison.Ordinal)).Parent;
2207
SelectClauseSyntax selectClause = (SelectClauseSyntax)tree.
GetCompilationUnitRoot
().FindToken(sourceCode.IndexOf("select w", StringComparison.Ordinal)).Parent;
2234
var e = (IdentifierNameSyntax)tree.
GetCompilationUnitRoot
().FindToken(sourceCode.IndexOf("x+1", StringComparison.Ordinal)).Parent;
2240
e = (IdentifierNameSyntax)tree.
GetCompilationUnitRoot
().FindToken(sourceCode.IndexOf("w+1", StringComparison.Ordinal)).Parent;
2299
var selectExpression = tree.
GetCompilationUnitRoot
().FindToken(sourceCode.IndexOf('5'));
2357
var unknownAccessorDecls = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AccessorDeclarationSyntax>();
2384
var selectClause = tree.
GetCompilationUnitRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SelectClause)).Single() as SelectClauseSyntax;
2385
var fromClause1 = tree.
GetCompilationUnitRoot
().DescendantNodes().Where(n => (n.IsKind(SyntaxKind.FromClause)) && (n.ToString().Contains("num1"))).Single() as FromClauseSyntax;
2386
var fromClause2 = tree.
GetCompilationUnitRoot
().DescendantNodes().Where(n => (n.IsKind(SyntaxKind.FromClause)) && (n.ToString().Contains("num2"))).Single() as FromClauseSyntax;
2429
foreach (var ordering in tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<OrderingSyntax>())
2484
var selectClause = tree.
GetCompilationUnitRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SelectClause)).Single() as SelectClauseSyntax;
2548
var selectClause = tree.
GetCompilationUnitRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SelectClause)).Single() as SelectClauseSyntax;
2583
var orderingClause = tree.
GetCompilationUnitRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.AscendingOrdering)).Single() as OrderingSyntax;
2716
var queryExpr = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<QueryExpressionSyntax>().Where(x => x.ToFullString() == "from i in expr1 let ").Single();
2742
var queryExpr = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<QueryExpressionSyntax>().Single();
2897
var classC = tree.
GetCompilationUnitRoot
().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "C").Single();
2930
var classC = tree.
GetCompilationUnitRoot
().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "C").Single();
3134
var selectNode = tree.
GetCompilationUnitRoot
().FindToken(index).Parent as SelectClauseSyntax;
3162
var joinNode = tree.
GetCompilationUnitRoot
().FindToken(index).Parent as JoinClauseSyntax;
3377
tree.
GetCompilationUnitRoot
().DescendantNodes(n => n.ToString().Contains("assem2"))
3386
tree.
GetCompilationUnitRoot
().DescendantNodes(n => n.ToString().Contains("assem1"))
3420
var classC = tree.
GetCompilationUnitRoot
().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single();
3464
var classC = tree.
GetCompilationUnitRoot
().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single();
3511
var classC = tree.
GetCompilationUnitRoot
().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Test").Single();
3550
var classC = tree.
GetCompilationUnitRoot
().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Test2").Single();
3598
var classC = tree.
GetCompilationUnitRoot
().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "QueryExpressionTest").Single();
Semantics\RecordStructTests.cs (3)
3284
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
3332
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
3383
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
Semantics\RefEscapingTests.cs (8)
5717
var tuple2 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(3);
5723
var tuple3 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(5);
5729
var tuple6 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(11);
5735
var tuple7 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(13);
5817
var tuple2 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(3);
5823
var tuple3 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(5);
5829
var tuple6 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(11);
5835
var tuple7 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(13);
Semantics\ScriptSemanticsTests.cs (5)
244
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ExpressionSyntax>().First();
492
GetCompilationUnitRoot
() as CompilationUnitSyntax).
521
var root = tree.
GetCompilationUnitRoot
();
537
var root = tree.
GetCompilationUnitRoot
();
561
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ExpressionSyntax>().First();
Semantics\SemanticErrorTests.cs (1)
3326
var compilationUnit = tree.
GetCompilationUnitRoot
();
Semantics\StackAllocInitializerTests.cs (8)
367
var expressions = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().ToArray();
443
var expressions = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().ToArray();
1045
var variables = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>();
1147
var variables = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>();
2359
var expressions = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<StackAllocArrayCreationExpressionSyntax>().ToArray();
2465
var expressions = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().ToArray();
2565
var expressions = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<StackAllocArrayCreationExpressionSyntax>().ToArray();
2649
var expressions = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().ToArray();
Semantics\StackAllocSpanExpressionsTests.cs (2)
53
var variables = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>();
127
var variables = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>();
Semantics\SuppressAccessibilityChecksTests.cs (2)
123
var expr = (ExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single().Body;
212
var root = tree.
GetCompilationUnitRoot
();
Semantics\SyntaxTreeRootTests.cs (1)
113
Assert.Throws<InvalidCastException>(() => { var _ = (CSharpSyntaxTree)(Object)tree.
GetCompilationUnitRoot
(); });
Semantics\TargetTypedConditionalOperatorTests.cs (1)
336
var compUnit = tree.
GetCompilationUnitRoot
();
Semantics\TargetTypedDefaultTests.cs (36)
42
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
142
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
194
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
242
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
279
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
324
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
518
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
564
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
607
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
665
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
746
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
835
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
864
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
1140
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
1255
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
1629
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
1734
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
1800
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
1871
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
1909
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
2089
var def = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().ElementAt(0);
2331
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
2412
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
2455
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
2481
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
2483
var digit = tree.
GetCompilationUnitRoot
().FindToken(source.IndexOf('2'));
3055
var def = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Single();
3342
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
3381
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
3512
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
3575
var default1 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Single();
3583
var default2 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DefaultExpressionSyntax>().ElementAt(0);
3590
var default3 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DefaultExpressionSyntax>().ElementAt(1);
3597
var default4 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DefaultExpressionSyntax>().ElementAt(2);
3671
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
3711
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
Semantics\TryCatchTests.cs (1)
45
var catchClause = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<CatchClauseSyntax>().Single();
Semantics\UnsafeTests.cs (28)
5197
var methodDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
5383
Assert.True(tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AnonymousObjectCreationExpressionSyntax>().
7257
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single();
7294
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<FieldDeclarationSyntax>().Single();
7323
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single();
7361
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single();
7404
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single();
7535
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Last();
7845
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
7912
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
8158
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single();
8225
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single();
8283
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single();
8345
foreach (var nullSyntax in tree.
GetCompilationUnitRoot
().DescendantTokens().Where(token => token.IsKind(SyntaxKind.NullKeyword)))
8381
foreach (var declarationSyntax in tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclarationSyntax>().Where(syntax => syntax.GetFirstToken().IsKind(SyntaxKind.VoidKeyword)))
8861
foreach (var binOpSyntax in tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>())
8911
foreach (var binOpSyntax in tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>())
9323
foreach (var binOpSyntax in tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>())
10177
var declarators = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(3).Reverse().ToArray();
10223
var declarators = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(numSymbols).Reverse().ToArray();
10224
var dereferences = tree.
GetCompilationUnitRoot
().DescendantNodes().Where(syntax => syntax.IsKind(SyntaxKind.PointerIndirectionExpression)).ToArray();
10297
var declarators = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(numSymbols).Reverse().ToArray();
10626
var syntaxes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SizeOfExpressionSyntax>();
10688
var syntaxes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SizeOfExpressionSyntax>();
10748
var syntaxes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SizeOfExpressionSyntax>();
11305
var stackAllocSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<StackAllocArrayCreationExpressionSyntax>().Single();
11837
var parameterSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().Single();
11877
var foreachSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
Semantics\UsingStatementTests.cs (8)
60
var usingStatement = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<UsingStatementSyntax>().Single();
69
var memberAccessExpression = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
1341
var usingStatement = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<UsingStatementSyntax>().Single();
1376
var usingStatement = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<UsingStatementSyntax>().Single();
1853
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
1865
var usingStatements = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<UsingStatementSyntax>().ToList();
1881
var usingStatements = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<UsingStatementSyntax>().ToList();
1894
var usingStatements = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<UsingStatementSyntax>().ToList();
Semantics\Utf8StringsLiteralsTests.cs (14)
2970
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
2998
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3026
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3054
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3082
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3110
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3138
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3166
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3194
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3222
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3250
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3278
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3306
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
4081
foreach (var node in tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(b => b.IsKind(SyntaxKind.AddExpression)))
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (375)
Compilation\GetSemanticInfoBrokenCodeTests.cs (14)
31
VisitAllExpressions(model, tree.
GetCompilationUnitRoot
());
109
foreach (var expr in GetAllExpressions(tree.
GetCompilationUnitRoot
()))
134
VisitAllExpressions(model, tree.
GetCompilationUnitRoot
());
161
foreach (var stmt in GetAllStatements(tree.
GetCompilationUnitRoot
()))
200
Assert.Empty(tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>());
202
foreach (var identifierSyntax in tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>())
224
var usingSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<UsingStatementSyntax>().Single();
245
var typeOfSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single();
267
var literalSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Single();
300
var identifierSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Single(n => n.Identifier.ValueText == "CompletionItem");
317
VisitAllExpressions(model, tree.
GetCompilationUnitRoot
());
332
VisitAllExpressions(model, tree.
GetCompilationUnitRoot
());
347
VisitAllExpressions(model, tree.
GetCompilationUnitRoot
());
362
foreach (var expr in GetAllExpressions(tree.
GetCompilationUnitRoot
()))
Compilation\GetSemanticInfoTests.cs (24)
242
var testClass = tree.
GetCompilationUnitRoot
().Members[1] as TypeDeclarationSyntax;
296
var c = (TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0];
374
var testClass = tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
477
var testClass = tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
530
var testClass = tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
973
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
997
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
1133
var root = tree.
GetCompilationUnitRoot
();
1674
var varIdentifier = (IdentifierNameSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().First(n => n.ToString() == "var");
2356
var lambdaSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single();
3607
var literal = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Single();
3632
var literal = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Single();
3665
var literal = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Single();
3701
var literal = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Single();
4106
var localDecls = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclarationSyntax>();
4161
var localDecls = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclarationSyntax>();
4212
var syntax = tree.
GetCompilationUnitRoot
().FindToken(position).Parent.DescendantNodesAndSelf().OfType<OmittedTypeArgumentSyntax>().Single();
4242
var syntax = tree.
GetCompilationUnitRoot
().FindToken(position).Parent.DescendantNodesAndSelf().OfType<OmittedTypeArgumentSyntax>().Single();
4272
var syntax = tree.
GetCompilationUnitRoot
().FindToken(position).Parent.DescendantNodesAndSelf().OfType<GenericNameSyntax>().Single();
4292
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<OmittedTypeArgumentSyntax>().Single();
4355
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Last(id => id.Identifier.ValueText == "b");
4400
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().Last();
5402
var root = tree.
GetCompilationUnitRoot
();
5913
var tokens = tree.
GetCompilationUnitRoot
().DescendantTokens();
Compilation\ReferenceManagerTests.cs (3)
894
var rd1 = t1.
GetCompilationUnitRoot
().GetReferenceDirectives().Single();
895
var rd2 = t2.
GetCompilationUnitRoot
().GetReferenceDirectives().Single();
896
var rd3 = t3.
GetCompilationUnitRoot
().GetReferenceDirectives().Single();
Compilation\SemanticModelAPITests.cs (95)
136
var root = tree.
GetCompilationUnitRoot
();
174
var root = tree.
GetCompilationUnitRoot
();
201
var root = tree.
GetCompilationUnitRoot
();
233
var root = tree.
GetCompilationUnitRoot
();
256
var vardecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().First();
276
var vardecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().First();
295
var vardecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<QueryClauseSyntax>().First();
315
var vardecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<QueryClauseSyntax>().First();
334
var statement = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<GotoStatementSyntax>().First();
353
var paramdecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().First();
375
var paramdecl1 = tree1.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().First();
377
var paramdecl2 = tree2.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().First();
404
var nsArray = tree.
GetCompilationUnitRoot
().DescendantNodes().Where(node => node.IsKind(SyntaxKind.NamespaceDeclaration)).ToArray();
425
var nsArray = tree.
GetCompilationUnitRoot
().DescendantNodes().Where(node => node.IsKind(SyntaxKind.FileScopedNamespaceDeclaration)).ToArray();
533
var bdecl = tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
559
var cdecl = tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
585
var cdecl = tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
608
var bdecl = tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
642
var classProgram = tree2.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
673
var decl = tree1.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
701
var decl = tree1.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
724
var bdecl = tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
750
var adecl = tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
782
var root = tree.
GetCompilationUnitRoot
();
817
var root = tree.
GetCompilationUnitRoot
();
871
var pType01 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ClassDeclarationSyntax>().First();
872
var pType02 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ClassDeclarationSyntax>().Last();
880
var pMethod01 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
881
var pMethod02 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Last();
898
var pParam01 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().First();
899
var pParam02 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().Last();
924
var root = tree.
GetCompilationUnitRoot
();
964
var root1 = tree1.
GetCompilationUnitRoot
();
965
var root2 = tree1.
GetCompilationUnitRoot
();
966
var para1 = tree1.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().First();
967
var para2 = tree2.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().First();
1005
var root1 = tree1.
GetCompilationUnitRoot
();
1006
var root2 = tree1.
GetCompilationUnitRoot
();
1007
var para1 = tree1.
GetCompilationUnitRoot
().DescendantNodes().OfType<TypeParameterSyntax>().First();
1008
var para2 = tree2.
GetCompilationUnitRoot
().DescendantNodes().OfType<TypeParameterSyntax>().First();
1041
var anonProps = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>();
1072
var anonProps = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>();
1113
var anonProps = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>();
1157
var anonProps = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>();
1193
var descendants = tree.
GetCompilationUnitRoot
().DescendantNodes();
1232
var aliasSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().Single();
1265
var aliasSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single();
1278
var aliasQualifiedSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AliasQualifiedNameSyntax>().Single();
1306
var aliasSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single();
1311
var aliasQualifiedSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AliasQualifiedNameSyntax>().Single();
1338
var aliasSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<NameEqualsSyntax>().Single().Name;
1341
var usingSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().Single();
1361
var oldSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single();
1390
var oldSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
1408
var root = tree.
GetCompilationUnitRoot
();
1452
var root = tree.
GetCompilationUnitRoot
();
1498
var root = tree.
GetCompilationUnitRoot
();
1547
var root = tree.
GetCompilationUnitRoot
();
1586
var root = tree.
GetCompilationUnitRoot
();
1626
var root = tree.
GetCompilationUnitRoot
();
1644
var root = tree.
GetCompilationUnitRoot
();
1662
var root = tree.
GetCompilationUnitRoot
();
1775
var root = tree.
GetCompilationUnitRoot
();
1826
var root = tree.
GetCompilationUnitRoot
();
1876
var root = tree.
GetCompilationUnitRoot
();
1915
var root = tree.
GetCompilationUnitRoot
();
1952
var root = tree.
GetCompilationUnitRoot
();
1989
var root = tree.
GetCompilationUnitRoot
();
2025
var root = tree.
GetCompilationUnitRoot
();
2072
var oldSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single();
2141
var oldSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
2168
var root = tree.
GetCompilationUnitRoot
();
2213
var root = tree.
GetCompilationUnitRoot
();
2255
var root = tree.
GetCompilationUnitRoot
();
2347
var root = tree.
GetCompilationUnitRoot
();
2442
var root = tree.
GetCompilationUnitRoot
();
2484
var root = tree.
GetCompilationUnitRoot
();
2529
var root = tree.
GetCompilationUnitRoot
();
2560
var root = tree.
GetCompilationUnitRoot
();
2632
var root = tree.
GetCompilationUnitRoot
();
2669
var root = tree.
GetCompilationUnitRoot
();
2760
var root = tree.
GetCompilationUnitRoot
();
2796
var root = tree.
GetCompilationUnitRoot
();
2811
var root = tree.
GetCompilationUnitRoot
();
2830
var root = tree.
GetCompilationUnitRoot
();
2860
var root = tree.
GetCompilationUnitRoot
();
2890
var root = tree.
GetCompilationUnitRoot
();
2919
var root = tree.
GetCompilationUnitRoot
();
2959
var root = tree.
GetCompilationUnitRoot
();
3004
var root = tree.
GetCompilationUnitRoot
();
3085
var root = tree.
GetCompilationUnitRoot
();
3610
var root = tree.
GetCompilationUnitRoot
();
4475
var root = tree.
GetCompilationUnitRoot
();
4539
var root = tree.
GetCompilationUnitRoot
();
4755
GetExpressionSyntax(tree.
GetCompilationUnitRoot
(), exprSynList);
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (166)
37
var root = tree.
GetCompilationUnitRoot
();
59
var root = tree.
GetCompilationUnitRoot
();
78
var root = tree.
GetCompilationUnitRoot
();
103
var root = tree.
GetCompilationUnitRoot
();
123
var root = tree.
GetCompilationUnitRoot
();
146
var root = tree.
GetCompilationUnitRoot
();
168
var root = tree.
GetCompilationUnitRoot
();
188
var root = tree.
GetCompilationUnitRoot
();
209
var root = tree.
GetCompilationUnitRoot
();
232
var root = tree.
GetCompilationUnitRoot
();
256
var root = tree.
GetCompilationUnitRoot
();
276
var root = tree.
GetCompilationUnitRoot
();
299
var root = tree.
GetCompilationUnitRoot
();
332
var root = tree.
GetCompilationUnitRoot
();
379
var root = tree.
GetCompilationUnitRoot
();
405
var root = tree.
GetCompilationUnitRoot
();
428
var root = tree.
GetCompilationUnitRoot
();
429
var node = root.FindToken(tree.
GetCompilationUnitRoot
().ToFullString().IndexOf("public event D Iter3", StringComparison.Ordinal)).Parent as BasePropertyDeclarationSyntax;
450
var root = tree.
GetCompilationUnitRoot
();
472
var root = tree.
GetCompilationUnitRoot
();
497
var root = tree.
GetCompilationUnitRoot
();
519
var root = tree.
GetCompilationUnitRoot
();
541
var root = tree.
GetCompilationUnitRoot
();
566
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
588
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
775
var fieldDecl = (FieldDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
797
var fieldDecl = (FieldDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
821
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
837
var delegateDecl = (DelegateDeclarationSyntax)(tree.
GetCompilationUnitRoot
().Members[0]);
857
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
881
var typeDecl = (TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0];
901
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
938
var root = tree.
GetCompilationUnitRoot
();
1004
var root = tree.
GetCompilationUnitRoot
();
1053
var namespaceDecl = (BaseNamespaceDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0];
1081
var cu = tree.
GetCompilationUnitRoot
();
1124
var cu = tree.
GetCompilationUnitRoot
();
1171
var cu = tree.
GetCompilationUnitRoot
();
1210
var cu = tree.
GetCompilationUnitRoot
();
1246
var cu = tree.
GetCompilationUnitRoot
();
1280
var cu = tree.
GetCompilationUnitRoot
();
1330
var cu = tree.
GetCompilationUnitRoot
();
1380
var cu = tree.
GetCompilationUnitRoot
();
1433
var cu = tree.
GetCompilationUnitRoot
();
1481
var cu = tree.
GetCompilationUnitRoot
();
1529
var cu = tree.
GetCompilationUnitRoot
();
1593
var cu = tree.
GetCompilationUnitRoot
();
1627
var cu = tree.
GetCompilationUnitRoot
();
1665
var cu = tree.
GetCompilationUnitRoot
();
1709
var cu = tree.
GetCompilationUnitRoot
();
1813
var cu = tree.
GetCompilationUnitRoot
();
1869
var cu = tree.
GetCompilationUnitRoot
();
2006
var cu = tree.
GetCompilationUnitRoot
();
2050
var cu = tree.
GetCompilationUnitRoot
();
2250
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
2286
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
2323
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
2359
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
2395
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
2425
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
2457
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
2494
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
2531
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
2562
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[1];
2591
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[1];
2616
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
2641
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
2671
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
2699
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
2783
var root = tree.
GetCompilationUnitRoot
();
2810
var root = tree.
GetCompilationUnitRoot
();
2842
var root = tree.
GetCompilationUnitRoot
();
2904
var root = tree.
GetCompilationUnitRoot
();
2934
var root = tree.
GetCompilationUnitRoot
();
2966
var root = tree.
GetCompilationUnitRoot
();
3015
var root = tree.
GetCompilationUnitRoot
();
3042
var root = tree.
GetCompilationUnitRoot
();
3072
var root = tree.
GetCompilationUnitRoot
();
3108
var root = tree.
GetCompilationUnitRoot
();
3138
var root = tree.
GetCompilationUnitRoot
();
3177
var accessorDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single();
3211
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[2]).Members[0];
3234
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
3265
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
3311
var root = tree.
GetCompilationUnitRoot
();
3314
var paramNode = tree.
GetCompilationUnitRoot
().FindToken(tree.
GetCompilationUnitRoot
().ToFullString().IndexOf("param1", StringComparison.Ordinal)).Parent;
3340
var root = tree.
GetCompilationUnitRoot
();
3366
var root = tree.
GetCompilationUnitRoot
();
3381
var root = tree.
GetCompilationUnitRoot
();
3405
var root = tree.
GetCompilationUnitRoot
();
3408
var foreachNode = tree.
GetCompilationUnitRoot
().FindToken(tree.
GetCompilationUnitRoot
().ToFullString().IndexOf("foreach", StringComparison.Ordinal)).Parent;
3426
var root = tree.
GetCompilationUnitRoot
();
3429
var delegateNode = tree.
GetCompilationUnitRoot
().FindToken(tree.
GetCompilationUnitRoot
().ToFullString().IndexOf("delegate", StringComparison.Ordinal)).Parent;
3445
var root = tree.
GetCompilationUnitRoot
();
3448
var usingNode = tree.
GetCompilationUnitRoot
().FindToken(tree.
GetCompilationUnitRoot
().ToFullString().IndexOf("using", StringComparison.Ordinal)).Parent;
3477
var foreachNode = tree.
GetCompilationUnitRoot
().FindToken(tree.
GetCompilationUnitRoot
().ToFullString().IndexOf("aaa", StringComparison.Ordinal)).Parent;
3501
var foreachNode = tree.
GetCompilationUnitRoot
().FindToken(tree.
GetCompilationUnitRoot
().ToFullString().IndexOf("aaa", StringComparison.Ordinal)).Parent;
3528
var foreachNode1 = tree.
GetCompilationUnitRoot
().FindToken(tree.
GetCompilationUnitRoot
().ToFullString().IndexOf("aaa", StringComparison.Ordinal)).Parent;
3534
var foreachNode2 = tree.
GetCompilationUnitRoot
().FindToken(tree.
GetCompilationUnitRoot
().ToFullString().IndexOf("bbb", StringComparison.Ordinal)).Parent;
3565
var catchDeclaration = tree.
GetCompilationUnitRoot
().FindToken(tree.
GetCompilationUnitRoot
().ToFullString().IndexOf("aaa", StringComparison.Ordinal)).Parent;
3586
var methodDecl = tree.
GetCompilationUnitRoot
().FindToken(tree.
GetCompilationUnitRoot
().ToFullString().IndexOf("Goo", StringComparison.Ordinal)).Parent;
3611
var methodDecl = tree.
GetCompilationUnitRoot
().FindToken(tree.
GetCompilationUnitRoot
().ToFullString().IndexOf("Goo", StringComparison.Ordinal)).Parent;
3633
var cu = tree.
GetCompilationUnitRoot
();
3668
dynamic methodDecl = (MethodDeclarationSyntax)tree.
GetCompilationUnitRoot
().FindToken(tree.
GetCompilationUnitRoot
().ToFullString().IndexOf("Main", StringComparison.Ordinal)).Parent;
3686
var globalStmt = tree.
GetCompilationUnitRoot
().FindToken(tree.
GetCompilationUnitRoot
().ToFullString().IndexOf('/')).Parent.AncestorsAndSelf().Single(x => x.IsKind(SyntaxKind.GlobalStatement));
3709
var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Members[0];
3737
var root = tree.
GetCompilationUnitRoot
();
3749
var root2 = tree.
GetCompilationUnitRoot
();
3847
var queryExpr = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParenthesizedExpressionSyntax>().First();
3866
var node = (IdentifierNameSyntax)tree.
GetCompilationUnitRoot
().DescendantTokens().Where(t => t.ToString() == "Alias").Last().Parent;
3901
var param = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.Identifier.ValueText == "name").First();
3922
var usingDirectives = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray();
3966
var attr = (AttributeSyntax)((ClassDeclarationSyntax)((CompilationUnitSyntax)tree2.
GetCompilationUnitRoot
()).Members[0]).AttributeLists[0].Attributes[0];
3999
var typeofSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single();
4127
var call = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
4145
call = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
4415
var lambda = (SimpleLambdaExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().First(x => x is SimpleLambdaExpressionSyntax);
4440
var conversionDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ConversionOperatorDeclarationSyntax>().Single();
4471
var conversionDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ConversionOperatorDeclarationSyntax>().Single();
4502
var operatorDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<OperatorDeclarationSyntax>().Single();
4604
var node = (DefaultExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Where(i => i is DefaultExpressionSyntax).First();
4691
var decl = (ClassDeclarationSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.ClassDeclaration));
4706
var decl = (ClassDeclarationSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.ClassDeclaration));
4721
var decl = (ClassDeclarationSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.ClassDeclaration));
4741
var enumDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<EnumDeclarationSyntax>().Single();
4742
var eventDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<EventDeclarationSyntax>().Single();
4767
var structDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<StructDeclarationSyntax>().First();
4768
var interfaceDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<InterfaceDeclarationSyntax>().Last();
4797
var decl = (TupleExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression));
4820
var decl = (TupleExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression));
4843
var decl = (TupleExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression));
4866
var decl = (TupleExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression));
4889
var decl = (TupleExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression));
4912
var decl = (ArgumentSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument));
4935
var decl = (ArgumentSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument));
4958
var decl = (ArgumentSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument));
4993
var decl = (ArgumentSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument));
5039
var decl = (ArgumentSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument));
5088
var decl = (ArgumentSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument));
5111
var decl = (ArgumentSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument));
5124
var root = tree.
GetCompilationUnitRoot
();
5173
var cu = tree.
GetCompilationUnitRoot
();
5222
var decls = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().ToArray();
5243
var decls = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().ToArray();
5264
var decls = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().ToArray();
5302
var root = tree.
GetCompilationUnitRoot
();
5353
var root = tree.
GetCompilationUnitRoot
();
5397
var root = tree.
GetCompilationUnitRoot
();
5445
var root = tree.
GetCompilationUnitRoot
();
5488
var root = tree.
GetCompilationUnitRoot
();
5539
var root = tree.
GetCompilationUnitRoot
();
5583
var root = tree.
GetCompilationUnitRoot
();
5631
var root = tree.
GetCompilationUnitRoot
();
Compilation\SemanticModelGetSemanticInfoTests.cs (3)
14484
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<OmittedArraySizeExpressionSyntax>().Last();
14656
var argumentSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AttributeArgumentSyntax>().Single();
15434
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().Single(n => n.Kind() == SyntaxKind.ThisExpression);
DeclarationTests.cs (1)
942
_root = CloneNodeAsRoot(_underlyingTree.
GetCompilationUnitRoot
(CancellationToken.None));
DocumentationComments\CrefTests.cs (1)
6618
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
DocumentationComments\DocumentationCommentCompilerTests.cs (3)
2354
var revisedSource = new DocumentationCommentAdder().Visit(Parse(source).
GetCompilationUnitRoot
()).ToFullString();
2538
var revisedSource = new DocumentationCommentAdder().Visit(Parse(source).
GetCompilationUnitRoot
()).ToFullString();
2907
var revisedSource = new DocumentationCommentAdder().Visit(Parse(source).
GetCompilationUnitRoot
()).ToFullString();
DocumentationComments\DocumentationCommentIDTests.cs (4)
31
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<UsingDirectiveSyntax>().Single();
144
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<GotoStatementSyntax>().Single().Expression;
165
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single();
309
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<FromClauseSyntax>().Single();
DocumentationComments\ParameterTests.cs (1)
841
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
SymbolDisplay\SymbolDisplayTests.cs (2)
5890
var methodDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
5900
methodDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Symbols\AnonymousTypesSemanticsTests.cs (1)
2054
stack.Push(tree.
GetCompilationUnitRoot
());
Symbols\AnonymousTypesSymbolTests.cs (1)
1640
var expr = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AnonymousObjectCreationExpressionSyntax>().Single();
Symbols\AssemblyAndNamespaceTests.cs (1)
331
var root = tree.
GetCompilationUnitRoot
();
Symbols\CompilationCreationTests.cs (1)
55
var types = expectedSyntaxTrees.Select(tree => compilation.GetSemanticModel(tree).GetDeclaredSymbol(tree.
GetCompilationUnitRoot
().Members.Single())).ToArray();
Symbols\ConversionTests.cs (3)
392
var variableDeclarator = (VariableDeclaratorSyntax)tree.
GetCompilationUnitRoot
()
399
var sourceExpression1 = (ExpressionSyntax)tree.
GetCompilationUnitRoot
()
405
var sourceExpression2 = (ExpressionSyntax)tree.
GetCompilationUnitRoot
()
Symbols\DestructorTests.cs (2)
407
var destructorDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DestructorDeclarationSyntax>().Single();
413
var finalizeSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single().Name;
Symbols\ExtensionMethodTests.cs (7)
227
syntaxTree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single()).Symbol;
2431
var expr = ((ExpressionStatementSyntax)((GlobalStatementSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Statement).Expression;
2727
var node = tree.
GetCompilationUnitRoot
().FindToken(code.IndexOf("GetHashCode", StringComparison.Ordinal)).Parent;
2737
node = tree.
GetCompilationUnitRoot
().FindToken(code.IndexOf("Cast<T1>", StringComparison.Ordinal)).Parent;
2952
var memberAccess = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
3010
var memberAccess = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
3139
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().ToList();
Symbols\ImplicitClassTests.cs (3)
73
IEnumerable<IdentifierNameSyntax> identifiers = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>();
116
var namespaceDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<NamespaceDeclarationSyntax>().Single();
117
var methodDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
Symbols\IndexerTests.cs (5)
1289
var indexerAccessSyntax = GetElementAccessExpressions(tree.
GetCompilationUnitRoot
()).Single();
2531
var actual = GetElementAccessExpressions(tree.
GetCompilationUnitRoot
()).Select(syntax => model.GetSymbolInfo(syntax).Symbol.ToTestDisplayString());
2615
var elementAccessSyntaxes = GetElementAccessExpressions(tree.
GetCompilationUnitRoot
());
2702
var elementAccessSyntaxes = GetElementAccessExpressions(tree.
GetCompilationUnitRoot
());
2844
ExpressionSyntax expr = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ElementAccessExpressionSyntax>().FirstOrDefault();
Symbols\LocalFunctionTests.cs (4)
34
var localSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
55
var localSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
76
var localSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
99
var localsSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray();
Symbols\MethodEqualityTests.cs (1)
208
var root = tree.
GetCompilationUnitRoot
();
Symbols\Source\BaseClassTests.cs (2)
271
var classA = (TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0];
308
var classA = (TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0];
Symbols\Source\DeclaringSyntaxNodeTests.cs (5)
155
var node = tree.
GetCompilationUnitRoot
().FindToken(position).Parent.FirstAncestorOrSelf<TNode>();
263
var declaratorA1 = tree.
GetCompilationUnitRoot
().FindToken(posA1).Parent.FirstAncestorOrSelf<VariableDeclaratorSyntax>();
307
var declaratorQ = tree.
GetCompilationUnitRoot
().FindToken(posQ).Parent.FirstAncestorOrSelf<VariableDeclaratorSyntax>();
314
var declaratorX = tree.
GetCompilationUnitRoot
().FindToken(posX).Parent.FirstAncestorOrSelf<VariableDeclaratorSyntax>();
321
var declaratorZ = tree.
GetCompilationUnitRoot
().FindToken(posZ).Parent.FirstAncestorOrSelf<VariableDeclaratorSyntax>();
Symbols\Source\DelegateTests.cs (2)
827
ExpressionSyntax lambdaSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single();
834
lambdaSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single();
Symbols\Source\EnumTests.cs (1)
979
var decls = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<EnumDeclarationSyntax>().ToArray();
Symbols\Source\ExternAliasTests.cs (3)
350
var root = tree.
GetCompilationUnitRoot
() as CompilationUnitSyntax;
408
var aliasSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single();
434
var aliasSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single();
Symbols\Source\UsingAliasTests.cs (15)
31
var root = tree.
GetCompilationUnitRoot
();
88
var root = tree.
GetCompilationUnitRoot
();
148
var root = tree.
GetCompilationUnitRoot
();
203
var root = tree.
GetCompilationUnitRoot
();
268
var root = tree.
GetCompilationUnitRoot
();
295
var root = tree.
GetCompilationUnitRoot
();
341
var root = tree.
GetCompilationUnitRoot
();
382
var root = tree.
GetCompilationUnitRoot
();
403
var root = tree.
GetCompilationUnitRoot
();
422
var root = tree.
GetCompilationUnitRoot
();
441
var root = tree.
GetCompilationUnitRoot
();
460
var root = tree.
GetCompilationUnitRoot
();
479
var root = tree.
GetCompilationUnitRoot
();
500
var root = tree.
GetCompilationUnitRoot
();
523
UsingDirectiveSyntax usingAlias = syntaxTree.
GetCompilationUnitRoot
().Usings.First();
Symbols\TypeTests.cs (1)
1854
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (663)
Diagnostics\LocationsTests.cs (1)
455
var token = syntaxTree.
GetCompilationUnitRoot
().FindToken(sampleProgram.IndexOf("ct", StringComparison.Ordinal));
IncrementalParsing\BinaryExpression.cs (3)
31
var type = newTree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
207
TypeDeclarationSyntax classType = newTree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
216
var statementType = newTree.
GetCompilationUnitRoot
().Members[0] as GlobalStatementSyntax;
IncrementalParsing\ChangingIdentifiers.cs (2)
274
TypeDeclarationSyntax classType = newTree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
282
var method = newTree.
GetCompilationUnitRoot
().Members[0] as MethodDeclarationSyntax;
IncrementalParsing\CompoundAssignment.cs (2)
146
var classType = newTree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
156
var statementType = newTree.
GetCompilationUnitRoot
().Members[0] as GlobalStatementSyntax;
IncrementalParsing\GrammarAmbiguities.cs (3)
91
Assert.False(originalTree.
GetCompilationUnitRoot
().ContainsDiagnostics);
95
dynamic r = incrementalTree.
GetCompilationUnitRoot
();
103
var incrementalRoot = syntaxTree.
GetCompilationUnitRoot
();
IncrementalParsing\IncrementalParsingTests.cs (104)
505
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
537
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
585
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
846
WalkTreeAndVerify(withCloseBraceDeletedTree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
915
var fullText = newTree.
GetCompilationUnitRoot
().ToFullString();
963
var finalString = startTree.
GetCompilationUnitRoot
().ToFullString();
967
var finalText = newTree.
GetCompilationUnitRoot
().ToFullString();
977
var finalString = startTree.
GetCompilationUnitRoot
().ToFullString();
981
var output = newTree.
GetCompilationUnitRoot
().ToFullString();
1191
Assert.Equal(0, syntaxTree.
GetCompilationUnitRoot
().Errors().Length);
1211
Assert.Equal(0, syntaxTree.
GetCompilationUnitRoot
().Errors().Length);
1230
Assert.Equal(0, syntaxTree.
GetCompilationUnitRoot
().Errors().Length);
1524
Assert.Equal(parsedTree.
GetCompilationUnitRoot
().ToFullString(), incrementalTree.
GetCompilationUnitRoot
().ToFullString());
1664
Assert.Equal(parsedTree.
GetCompilationUnitRoot
().ChildNodesAndTokens().Count, incrementalTree.
GetCompilationUnitRoot
().ChildNodesAndTokens().Count);
1667
for (int i = 0; i < parsedTree.
GetCompilationUnitRoot
().ChildNodesAndTokens().Count; i++)
1669
Assert.Equal(parsedTree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[i].Kind(), incrementalTree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[i].Kind());
1988
Assert.Equal(parsedTree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[0].AsNode().ToFullString(), incrementalTree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[0].AsNode().ToFullString());
2094
Assert.Equal(parsedTree.
GetCompilationUnitRoot
().ToFullString(), incrementalTree.
GetCompilationUnitRoot
().ToFullString());
2443
CompareTreeEquivalence(parsedTree.
GetCompilationUnitRoot
(), incrementalTree.
GetCompilationUnitRoot
());
2475
CompareTreeEquivalence(parsedTree.
GetCompilationUnitRoot
(), incrementalTree.
GetCompilationUnitRoot
());
2508
CompareTreeEquivalence(parsedTree.
GetCompilationUnitRoot
(), incrementalTree.
GetCompilationUnitRoot
());
2559
CompareTreeEquivalence(parsedTree.
GetCompilationUnitRoot
(), incrementalTree.
GetCompilationUnitRoot
());
2589
CompareTreeEquivalence(parsedTree.
GetCompilationUnitRoot
(), incrementalTree.
GetCompilationUnitRoot
());
2618
CompareTreeEquivalence(parsedTree.
GetCompilationUnitRoot
(), incrementalTree.
GetCompilationUnitRoot
());
2722
CompareTreeEquivalence(parsedTree.
GetCompilationUnitRoot
(), incrementalTree.
GetCompilationUnitRoot
());
2755
CompareTreeEquivalence(parsedTree.
GetCompilationUnitRoot
(), reparsedTree.
GetCompilationUnitRoot
());
2769
Assert.Equal(oldText.ToString(), startTree.
GetCompilationUnitRoot
().ToFullString());
2907
var fullText = fullTree.
GetCompilationUnitRoot
().ToFullString();
2908
var incText = newTree.
GetCompilationUnitRoot
().ToFullString();
2921
fullText = fullTree.
GetCompilationUnitRoot
().ToFullString();
2922
incText = newTree.
GetCompilationUnitRoot
().ToFullString();
2992
int incCount = currTree.
GetCompilationUnitRoot
().ChildNodesAndTokens().Count;
2993
int fullCount = fullTree.
GetCompilationUnitRoot
().ChildNodesAndTokens().Count;
2995
WalkTreeAndVerify(currTree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3028
WalkTreeAndVerify(currTree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3040
tree.
GetCompilationUnitRoot
().Members.First().Green;
3183
WalkTreeAndVerify(newTree.
GetCompilationUnitRoot
(), SyntaxFactory.ParseSyntaxTree(newText).
GetCompilationUnitRoot
());
3203
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3224
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3245
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3266
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3287
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3309
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3333
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3357
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3381
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3405
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3429
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3455
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3480
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3506
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3532
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3550
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3568
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3586
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3600
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3614
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3629
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3666
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3717
ParentChecker.CheckParents(parsedTree.
GetCompilationUnitRoot
(), parsedTree);
3718
ParentChecker.CheckParents(incrementalTree.
GetCompilationUnitRoot
(), incrementalTree);
3726
Assert.Equal(oldText.ToString(), startTree.
GetCompilationUnitRoot
().ToFullString());
IncrementalParsing\SyntaxDifferences.cs (2)
26
GatherNodes(oldTree.
GetCompilationUnitRoot
(), hashSet);
29
GetRebuiltNodes(newTree.
GetCompilationUnitRoot
(), hashSet, nodes);
IncrementalParsing\TypeChanges.cs (8)
32
var classType = newTree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
47
var classType = newTree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
62
var classType = newTree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
77
var classType = newTree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
92
var classType = newTree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
108
var classType = newTree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
124
var classType = newTree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
140
var classType = newTree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
IncrementalParsing\UnaryExpression.cs (2)
89
var classType = newTree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax;
99
var statementType = newTree.
GetCompilationUnitRoot
().Members[0] as GlobalStatementSyntax;
LexicalAndXml\PreprocessorTests.cs (7)
94
return SyntaxFactory.ParseSyntaxTree(itext, options).
GetCompilationUnitRoot
();
3214
TestRoundTripping(tree.
GetCompilationUnitRoot
(), text, false);
3551
TestRoundTripping(tree.
GetCompilationUnitRoot
(), text, false);
3554
VerifyErrorCode(tree.
GetCompilationUnitRoot
(), (int)ErrorCode.ERR_InvalidMemberDecl); // CS1519 - parser gives Two
3555
VerifyDirectivesSpecial(tree.
GetCompilationUnitRoot
(), new DirectiveInfo { Kind = SyntaxKind.LineDirectiveTrivia, Status = NodeStatus.IsActive, Number = 100, Text = "test.cs" });
3880
var node = tree.
GetCompilationUnitRoot
();
4562
var root = tree.
GetCompilationUnitRoot
();
LexicalAndXml\XmlDocCommentTests.cs (310)
78
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
79
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
80
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.LeadingTrivia;
98
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
99
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
100
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.LeadingTrivia;
115
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
116
Assert.NotEqual(0, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
117
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.LeadingTrivia;
130
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
131
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
132
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.LeadingTrivia;
146
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
147
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
148
Assert.Equal(SyntaxKind.ClassDeclaration, tree.
GetCompilationUnitRoot
().Members[0].Kind());
149
var leading = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia();
168
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
169
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
170
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.LeadingTrivia;
192
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
193
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
194
Assert.Equal(SyntaxKind.ClassDeclaration, tree.
GetCompilationUnitRoot
().Members[0].Kind());
195
var leading = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia();
215
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
216
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
217
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
238
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
239
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
240
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
261
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
262
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
263
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
288
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
289
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
290
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
316
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
317
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
318
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
340
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
341
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
342
var leading = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia();
365
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
366
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
367
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
391
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
392
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
393
var leading = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia();
418
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
419
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
420
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
445
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
446
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
447
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
473
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
474
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
475
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
502
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
503
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
504
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
532
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
533
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
534
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
561
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
562
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
563
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
591
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
592
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
593
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
622
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
623
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
624
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
645
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
646
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
647
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
667
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
668
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
669
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
689
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
690
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
691
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
711
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
712
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
713
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
733
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
734
Assert.NotEqual(0, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
735
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
753
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
754
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
755
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
787
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
788
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
789
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
820
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
821
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
822
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
851
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
852
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
853
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
879
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
880
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Warnings().Length);
881
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
904
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
905
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
906
var leading = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia();
930
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
931
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
932
var leading = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia();
955
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
956
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
957
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
982
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
983
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
984
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1013
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1014
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1015
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1041
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1042
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1043
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1066
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1067
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1068
var leading = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia();
1091
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1092
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1093
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1118
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1119
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1120
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1151
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1152
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1153
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1182
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1183
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1184
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1208
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1209
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1210
var leading = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia();
1235
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1236
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1237
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1263
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1264
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Errors().Length);
1265
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1288
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1289
Assert.Equal(2, tree.
GetCompilationUnitRoot
().ChildNodesAndTokens().Count);
1290
Assert.Equal(SyntaxKind.ClassDeclaration, tree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[0].Kind());
1291
var classdecl = (TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[0].AsNode();
1298
Assert.Equal(SyntaxKind.EndOfFileToken, tree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[1].Kind());
1308
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1309
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1310
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1332
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1333
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1334
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1357
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1358
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1359
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1381
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1382
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1383
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1406
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1407
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1408
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1430
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1431
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1432
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1455
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1456
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1457
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1479
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1480
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1481
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1504
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1505
Assert.NotEqual(0, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1515
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1516
Assert.NotEqual(0, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1526
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1527
Assert.NotEqual(0, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1537
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1538
Assert.NotEqual(0, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1548
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1549
Assert.NotEqual(0, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1559
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1560
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1561
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1587
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1588
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1589
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1615
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1616
Assert.NotEqual(0, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1617
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1641
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1642
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1643
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1672
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1675
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Warnings().Length);
1678
VerifyDiagnostics(tree.
GetCompilationUnitRoot
(), new List<TestError>() { new TestError(1570, true) });
1689
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1692
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Warnings().Length);
1695
VerifyDiagnostics(tree.
GetCompilationUnitRoot
(), new List<TestError>() { new TestError(1570, true) });
1708
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1709
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1712
var trivias = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1747
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1748
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1751
var trivias = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1787
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1790
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Warnings().Length);
1793
var trivias = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1828
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1829
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1832
Assert.Equal(typeof(MethodDeclarationSyntax), (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0].GetType());
1834
var keyword = ((tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType;
1863
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1864
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1867
Assert.Equal(typeof(MethodDeclarationSyntax), (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0].GetType());
1869
var keyword = ((tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType;
1898
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1899
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1902
Assert.Equal(typeof(PropertyDeclarationSyntax), (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0].GetType());
1904
var keyword = ((tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0] as PropertyDeclarationSyntax).Type;
1933
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1934
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1937
Assert.Equal(typeof(IndexerDeclarationSyntax), (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0].GetType());
1939
var keyword = ((tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0] as IndexerDeclarationSyntax).Type;
1968
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1969
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1972
Assert.Equal(typeof(MethodDeclarationSyntax), (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0].GetType());
1975
var method = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax;
2005
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2006
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
2009
Assert.Equal(typeof(ClassDeclarationSyntax), tree.
GetCompilationUnitRoot
().Members[0].GetType());
2012
var typeParameter = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).TypeParameterList.Parameters.Single();
2043
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2044
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Errors().Length); // 4 errors because of the incomplete class decl
2047
Assert.Equal(typeof(MethodDeclarationSyntax), (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0].GetType());
2049
var keyword = ((tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType;
2079
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2080
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
2082
var bracket = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).CloseBraceToken;
2110
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2111
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Errors().Length); // error because of the incomplete class decl
2114
var classDecl = (TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0];
2143
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2144
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length); // 4 errors because of the incomplete class decl
2147
var bracket = tree.
GetCompilationUnitRoot
().EndOfFileToken;
2173
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2174
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length); // 4 errors because of the incomplete class decl
2177
var bracket = tree.
GetCompilationUnitRoot
().EndOfFileToken;
2204
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2205
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
2208
var bracket = tree.
GetCompilationUnitRoot
().EndOfFileToken;
2239
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2242
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Errors().Length);
2243
VerifyDiagnostics(tree.
GetCompilationUnitRoot
(), new List<TestError>() { new TestError(1035, false) });
2254
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2255
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
2257
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2282
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2283
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
2286
var eofToken = tree.
GetCompilationUnitRoot
().EndOfFileToken;
2324
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2325
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
2327
var eofToken = tree.
GetCompilationUnitRoot
().EndOfFileToken;
2356
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2359
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Warnings().Length);
2362
var eofToken = tree.
GetCompilationUnitRoot
().EndOfFileToken;
2380
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2381
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
2384
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2410
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2411
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
2414
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2439
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2441
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2462
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2465
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Warnings().Length);
2467
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2489
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2492
Assert.Equal(2, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
2494
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2514
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2517
Assert.Equal(2, tree.
GetCompilationUnitRoot
().Warnings().Length);
2519
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2539
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2541
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2565
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2567
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2591
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2594
Assert.Equal(2, tree.
GetCompilationUnitRoot
().Warnings().Length);
2606
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2609
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Warnings().Length);
2620
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2623
Assert.Equal(2, tree.
GetCompilationUnitRoot
().Warnings().Length);
2635
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2637
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2653
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2655
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2676
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2677
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
2694
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2695
Assert.Equal(4, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
2696
VerifyDiagnostics(tree.
GetCompilationUnitRoot
(), new List<TestError>
2720
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2721
Assert.Equal(4, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
2722
VerifyDiagnostics(tree.
GetCompilationUnitRoot
(), new List<TestError>
2743
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2745
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2767
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2769
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
Parsing\LineSpanDirectiveParsingTests.cs (1)
30
var node = ParseTree(text, options).
GetCompilationUnitRoot
();
Parsing\ParserErrorMessageTests.cs (25)
5440
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5443
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5462
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5465
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5527
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5530
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5546
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5549
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5589
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5592
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5624
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5627
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5658
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5661
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5947
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5965
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5978
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5986
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6007
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6014
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6037
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6050
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6079
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6092
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6366
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify(
Parsing\ParsingErrorRecoveryTests.cs (9)
7396
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
7415
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
7449
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
7474
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
7499
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
7525
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
7549
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
7574
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
7588
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
Parsing\ParsingTests.cs (2)
87
ParseTree(text, options).
GetCompilationUnitRoot
();
158
_node = tree.
GetCompilationUnitRoot
();
Parsing\RoundTrippingTests.cs (9)
29
var toText = tree.
GetCompilationUnitRoot
().ToFullString();
37
Assert.NotEqual(0, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
41
Assert.Equal(errorCount, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
47
Assert.Equal(memberCount, tree.
GetCompilationUnitRoot
().Members.Count);
50
ParentChecker.CheckParents(tree.
GetCompilationUnitRoot
(), tree);
56
var toText = tree.
GetCompilationUnitRoot
().ToFullString();
59
var nodes = tree.
GetCompilationUnitRoot
().DescendantTokens(tk => tk.FullWidth > 0).ToList();
104
var toText = tree.
GetCompilationUnitRoot
().ToFullString();
1583
var newTest = tree.
GetCompilationUnitRoot
().ToFullString();
Parsing\ScriptParsingTests.cs (11)
36
var parsedText = parsedTree.
GetCompilationUnitRoot
();
191
Assert.True(tree.
GetCompilationUnitRoot
().ContainsDiagnostics);
233
Assert.True(tree.
GetCompilationUnitRoot
().ContainsDiagnostics);
2644
Assert.False(tree.
GetCompilationUnitRoot
().ContainsDiagnostics);
2676
Assert.False(tree.
GetCompilationUnitRoot
().ContainsDiagnostics);
9611
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ChildNodes().Count());
9612
Assert.Equal(SyntaxKind.GlobalStatement, tree.
GetCompilationUnitRoot
().ChildNodes().ToList()[0].Kind());
9634
var root = tree.
GetCompilationUnitRoot
();
9645
root = tree.
GetCompilationUnitRoot
();
9661
root = tree.
GetCompilationUnitRoot
();
9708
var root = tree.
GetCompilationUnitRoot
();
Syntax\StructuredTriviaTests.cs (7)
108
var compilationUnit = tree.
GetCompilationUnitRoot
();
122
var compilationUnit = tree.
GetCompilationUnitRoot
();
133
var compilationUnit = tree.
GetCompilationUnitRoot
();
146
var compilationUnit = tree.
GetCompilationUnitRoot
();
167
var trivia = tree.
GetCompilationUnitRoot
().DescendantTrivia().Single(t => t.Kind() == SyntaxKind.SingleLineDocumentationCommentTrivia);
183
var trivia = tree.
GetCompilationUnitRoot
().DescendantTrivia().Single(t => t.Kind() == SyntaxKind.MultiLineDocumentationCommentTrivia);
192
var trivia = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia();
Syntax\SyntaxAnnotationTests.cs (33)
53
var fromNode = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).
GetCompilationUnitRoot
();
62
var fromNode = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).
GetCompilationUnitRoot
();
63
var toNode = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).
GetCompilationUnitRoot
();
72
var toToken = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).
GetCompilationUnitRoot
().DescendantTokens().First();
80
var fromToken = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).
GetCompilationUnitRoot
().DescendantTokens().First();
89
var fromToken = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).
GetCompilationUnitRoot
().DescendantTokens().First();
90
var toToken = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).
GetCompilationUnitRoot
().DescendantTokens().First();
100
var toTrivia = GetAllTrivia(tree.
GetCompilationUnitRoot
()).FirstOrDefault();
110
var fromTrivia = GetAllTrivia(tree.
GetCompilationUnitRoot
()).FirstOrDefault();
119
var fromTrivia = GetAllTrivia(tree.
GetCompilationUnitRoot
()).FirstOrDefault();
120
var toTrivia = GetAllTrivia(tree.
GetCompilationUnitRoot
()).FirstOrDefault();
135
var matchingNodesOrTokens = tree.
GetCompilationUnitRoot
().GetAnnotatedNodesAndTokens(annotation);
145
var matchingTrivia = tree.
GetCompilationUnitRoot
().GetAnnotatedTrivia(annotation);
161
var node = GetAllNodesAndTokens(tree.
GetCompilationUnitRoot
()).First(t => t.IsNode).AsNode();
165
var newRoot = tree.
GetCompilationUnitRoot
().ReplaceNode(node, annotatedNode);
193
var token = GetAllNodesAndTokens(tree.
GetCompilationUnitRoot
()).First(t => t.IsToken).AsToken();
197
var newRoot = tree.
GetCompilationUnitRoot
().ReplaceToken(token, annotatedToken);
225
var trivia = GetAllTrivia(tree.
GetCompilationUnitRoot
()).First();
229
var newRoot = tree.
GetCompilationUnitRoot
().ReplaceTrivia(trivia, annotatedTrivia);
253
SyntaxNode newRoot = tree.
GetCompilationUnitRoot
();
265
TestMultipleAnnotationsInTree(tree.
GetCompilationUnitRoot
(), newRoot, annotations);
284
var firstNode = GetAllNodesAndTokens(tree.
GetCompilationUnitRoot
()).First(t => t.IsNode).AsNode();
289
var newRoot = tree.
GetCompilationUnitRoot
().ReplaceNode(lastChildOfFirstNode, annotatedNode);
389
var sourceTreeRoot = rewriter.Visit(tree1.
GetCompilationUnitRoot
());
391
var destTreeRoot = CopyAnnotationsTo(sourceTreeRoot, tree2.
GetCompilationUnitRoot
());
476
var currentRoot = syntaxTree.
GetCompilationUnitRoot
();
507
var candidatePool = GetAllNodesAndTokens(syntaxTree.
GetCompilationUnitRoot
());
518
var newRoot = Replace(syntaxTree.
GetCompilationUnitRoot
(), firstItem, firstAnnotated);
566
foreach (var trivia in GetAllTrivia(syntaxTree.
GetCompilationUnitRoot
()))
570
var newRoot = syntaxTree.
GetCompilationUnitRoot
().ReplaceTrivia(trivia, newTrivia);
580
var allNodesAndTokens = GetAllNodesAndTokens(syntaxTree.
GetCompilationUnitRoot
());
590
newRoot = syntaxTree.
GetCompilationUnitRoot
().ReplaceToken(nodeOrToken.AsToken(), newToken);
595
newRoot = syntaxTree.
GetCompilationUnitRoot
().ReplaceNode(nodeOrToken.AsNode(), newNode);
Syntax\SyntaxDiffingTests.cs (4)
28
Assert.Equal(newTree.
GetCompilationUnitRoot
().FullSpan, spans[0]);
47
var decl = (TypeDeclarationSyntax)(newTree.
GetCompilationUnitRoot
()).Members[0];
67
var decl1 = (TypeDeclarationSyntax)(newTree.
GetCompilationUnitRoot
()).Members[0];
69
var decl2 = (TypeDeclarationSyntax)(newTree.
GetCompilationUnitRoot
()).Members[1];
Syntax\SyntaxNodeTests.cs (106)
512
var tokens = t1.
GetCompilationUnitRoot
().DescendantTokens().ToList();
525
var tokens = t1.
GetCompilationUnitRoot
().DescendantTokens().ToList();
538
var tokens = t1.
GetCompilationUnitRoot
().DescendantTokens().ToList();
555
var tokens = t1.
GetCompilationUnitRoot
().DescendantTokens(new TextSpan(0, 16)).ToList();
567
var tokens = t1.
GetCompilationUnitRoot
().DescendantTokens(new TextSpan(1, 14)).ToList();
579
var tokens = t1.
GetCompilationUnitRoot
().DescendantTokens(new TextSpan(7, 17)).ToList();
592
var tokens = t1.
GetCompilationUnitRoot
().DescendantTokens(new TextSpan(8, 15)).ToList();
641
var node = t1.
GetCompilationUnitRoot
().DescendantTokens(new TextSpan(6, 3)).First();
651
var token = tree.
GetCompilationUnitRoot
().FindToken("class\n #i".Length);
654
token = tree.
GetCompilationUnitRoot
().FindToken("class\n #i".Length, findInsideTrivia: true);
767
var trivia = tree.
GetCompilationUnitRoot
().FindTrivia(position);
779
Assert.True(tree.
GetCompilationUnitRoot
().IsEquivalentTo(tree.
GetCompilationUnitRoot
()));
787
Assert.False(tree.
GetCompilationUnitRoot
().IsEquivalentTo(null));
796
Assert.NotEqual(tree1.
GetCompilationUnitRoot
(), tree2.
GetCompilationUnitRoot
());
797
Assert.True(tree1.
GetCompilationUnitRoot
().IsEquivalentTo(tree2.
GetCompilationUnitRoot
()));
805
Assert.NotEqual(tree1.
GetCompilationUnitRoot
(), tree2.
GetCompilationUnitRoot
());
806
Assert.False(tree1.
GetCompilationUnitRoot
().IsEquivalentTo(tree2.
GetCompilationUnitRoot
()));
814
Assert.NotEqual(tree1.
GetCompilationUnitRoot
(), tree2.
GetCompilationUnitRoot
());
815
Assert.False(tree1.
GetCompilationUnitRoot
().IsEquivalentTo(tree2.
GetCompilationUnitRoot
()));
823
var m1 = ((TypeDeclarationSyntax)tree1.
GetCompilationUnitRoot
().Members[0]).Members[0];
824
var m2 = ((TypeDeclarationSyntax)tree2.
GetCompilationUnitRoot
().Members[0]).Members[0];
836
Assert.False(tree1.
GetCompilationUnitRoot
().IsEquivalentTo(tree2.
GetCompilationUnitRoot
()));
844
Assert.True(tree.
GetCompilationUnitRoot
().IsIncrementallyIdenticalTo(tree.
GetCompilationUnitRoot
()));
852
Assert.True(tree.
GetCompilationUnitRoot
().EndOfFileToken.IsIncrementallyIdenticalTo(tree.
GetCompilationUnitRoot
().EndOfFileToken));
860
Assert.False(tree.
GetCompilationUnitRoot
().GetFirstToken().IsIncrementallyIdenticalTo(tree.
GetCompilationUnitRoot
().GetFirstToken().GetNextToken()));
869
Assert.True(tree1.
GetCompilationUnitRoot
().GetFirstToken().IsIncrementallyIdenticalTo(tree2.
GetCompilationUnitRoot
().GetFirstToken()));
878
Assert.False(tree1.
GetCompilationUnitRoot
().IsIncrementallyIdenticalTo(tree2.
GetCompilationUnitRoot
()));
888
tree1.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single().IsIncrementallyIdenticalTo(
889
tree2.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single()));
899
tree1.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single().IsIncrementallyIdenticalTo(
900
tree2.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single()));
909
var trivia = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia()[0];
912
var triviaAgain = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia()[0];
922
var first = tree.
GetCompilationUnitRoot
().GetFirstToken();
930
var first = tree.
GetCompilationUnitRoot
().GetFirstToken(includeZeroWidth: true);
938
var last = tree.
GetCompilationUnitRoot
().GetLastToken();
946
var last = tree.
GetCompilationUnitRoot
().GetLastToken(includeZeroWidth: true);
949
last = tree.
GetCompilationUnitRoot
().Members[0].GetLastToken(includeZeroWidth: true);
959
var root1 = tree1.
GetCompilationUnitRoot
();
982
var tokens = tree.
GetCompilationUnitRoot
().DescendantTokens().ToList();
985
var token = tree.
GetCompilationUnitRoot
().GetFirstToken(includeSkipped: true);
1008
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1010
var tokens = tree.
GetCompilationUnitRoot
().DescendantTokens(descendIntoTrivia: true).Where(SyntaxToken.NonZeroWidth).ToList();
1015
var token = tree.
GetCompilationUnitRoot
().GetFirstToken(includeSkipped: true);
1036
var tokens = tree.
GetCompilationUnitRoot
().DescendantTokens().ToList();
1040
var token = tree.
GetCompilationUnitRoot
().GetFirstToken(includeSkipped: false);
1081
var tokens = tree.
GetCompilationUnitRoot
().DescendantTokens().ToList();
1084
var token = tree.
GetCompilationUnitRoot
().GetLastToken(); // skip EOF
1108
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1110
var tokens = tree.
GetCompilationUnitRoot
().DescendantTokens(descendIntoTrivia: true).Where(SyntaxToken.NonZeroWidth).ToList();
1115
var token = tree.
GetCompilationUnitRoot
().GetLastToken(includeSkipped: true);
1138
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1140
var tokens = tree.
GetCompilationUnitRoot
().DescendantTokens().ToList();
1144
var token = tree.
GetCompilationUnitRoot
().GetLastToken(includeSkipped: false);
1188
var tokens = tree.
GetCompilationUnitRoot
().DescendantTokens().ToList();
1191
var token = tree.
GetCompilationUnitRoot
().GetFirstToken(includeZeroWidth: true);
1230
var tokens = tree.
GetCompilationUnitRoot
().DescendantTokens().ToList();
1233
var token = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetPreviousToken(includeZeroWidth: true);
1257
SyntaxToken token = syntaxTree.
GetCompilationUnitRoot
().EndOfFileToken.GetPreviousToken(includeZeroWidth: true);
1277
var children = tree.
GetCompilationUnitRoot
().Members[0].ChildNodesAndTokens().ToList();
1295
var children = tree.
GetCompilationUnitRoot
().Members[0].ChildNodesAndTokens().ToList();
1314
var child = tree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[0];
1315
var member = (TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0];
1331
var trivia = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia()[0];
1342
var trivia = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia()[0];
1378
var d = tree.
GetCompilationUnitRoot
().GetFirstDirective();
1390
var d = tree.
GetCompilationUnitRoot
().GetLastDirective();
1407
var d1 = tree.
GetCompilationUnitRoot
().GetFirstDirective();
1435
var d1 = tree.
GetCompilationUnitRoot
().GetLastDirective();
1459
var c = tree.
GetCompilationUnitRoot
().Members[0];
1494
var d = tree.
GetCompilationUnitRoot
().GetFirstDirective();
1525
var d = tree.
GetCompilationUnitRoot
().GetFirstDirective();
1564
var d = tree.
GetCompilationUnitRoot
().GetLastDirective();
1595
var d = tree.
GetCompilationUnitRoot
().GetFirstDirective();
1629
var d = tree.
GetCompilationUnitRoot
().GetFirstDirective();
1663
var d = tree.
GetCompilationUnitRoot
().GetLastDirective();
1693
var d = tree.
GetCompilationUnitRoot
().GetLastDirective();
1716
var d = tree.
GetCompilationUnitRoot
().GetFirstDirective();
1737
var d = tree.
GetCompilationUnitRoot
().GetLastDirective();
1755
var rootNode = tree.
GetCompilationUnitRoot
();
1773
var rootNode = tree.
GetCompilationUnitRoot
();
1784
var rootNode = SyntaxFactory.ParseSyntaxTree("using X; namespace Y { }").
GetCompilationUnitRoot
();
2002
Assert.Equal(SyntaxKind.MethodDeclaration, tree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[0].ChildNodesAndTokens()[3].Kind());
2011
var actualTokens = syntaxTree.
GetCompilationUnitRoot
().DescendantTokens();
2051
dynamic root = tree.
GetCompilationUnitRoot
();
3269
var root = tree.
GetCompilationUnitRoot
();
3354
foreach (var t in syntaxTree.
GetCompilationUnitRoot
().DescendantTokens())
3380
var token = syntaxTree.
GetCompilationUnitRoot
().FindToken(code.IndexOf("using Lib;", StringComparison.Ordinal));
3399
var trivia = tree.
GetCompilationUnitRoot
().FindTrivia(code.IndexOf("#r", StringComparison.Ordinal)); // ReferenceDirective.
3414
var compilationUnit = tree.
GetCompilationUnitRoot
();
3440
var compilationUnit = tree.
GetCompilationUnitRoot
();
3481
var node = SyntaxFactory.ParseSyntaxTree(" ").
GetCompilationUnitRoot
();
3810
var trivia = tree.
GetCompilationUnitRoot
().FindTrivia(position);
Syntax\SyntaxNormalizerTests.cs (3)
3723
TestNormalize(tree.
GetCompilationUnitRoot
(), """
3751
TestNormalize(tree.
GetCompilationUnitRoot
(),
3780
TestNormalize(tree.
GetCompilationUnitRoot
(),
Syntax\SyntaxRewriterTests.cs (9)
337
var tokenT = tree.
GetCompilationUnitRoot
().DescendantTokens().Where(t => t.ToString() == "T").Single();
338
Assert.Same(tree, tree.
GetCompilationUnitRoot
().ReplaceToken(tokenT, tokenT).SyntaxTree);
339
var newRoot = tree.
GetCompilationUnitRoot
().ReplaceToken(tokenT, SyntaxFactory.Identifier("U"));
349
var typeName = tree.
GetCompilationUnitRoot
().DescendantNodes().Where(n => n.IsKind(SyntaxKind.GenericName)).Single();
350
Assert.Same(tree, tree.
GetCompilationUnitRoot
().ReplaceNode(typeName, typeName).SyntaxTree);
351
var newRoot = tree.
GetCompilationUnitRoot
().ReplaceNode(typeName, SyntaxFactory.ParseTypeName("Class2<U>"));
540
Assert.NotNull(tree.
GetCompilationUnitRoot
().SyntaxTree);
542
var rewrittenRoot = rewriter.Visit(tree.
GetCompilationUnitRoot
());
601
var ifStmt1 = tree1.
GetCompilationUnitRoot
().DescendantNodes().OfType<IfStatementSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
Extensions.cs (1)
54
if (TryFindNodeOrToken(syntaxTree.
GetCompilationUnitRoot
(), kind, ref occurrence, ref foundNode))
SemanticModelTestBase.cs (1)
99
var constructorInitializer = GetFirstConstructorInitializer(tree.
GetCompilationUnitRoot
());
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\OperationTests.cs (1)
277
var methodBodySyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Last();
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
SyntaxPathTests.cs (1)
92
var root = tree.
GetCompilationUnitRoot
();
Microsoft.DotNet.GenFacades (3)
TypeParser.cs (3)
39
CompilationUnitSyntax root = tree.
GetCompilationUnitRoot
();
58
CompilationUnitSyntax root = tree.
GetCompilationUnitRoot
();
72
CompilationUnitSyntax root = tree.
GetCompilationUnitRoot
();