1533 references to GetCompilationUnitRoot
IdeCoreBenchmarks (2)
SerializationBenchmarks.cs (1)
44
_rootList.Add(tree.
GetCompilationUnitRoot
());
SyntacticChangeRangeBenchmark.cs (1)
45
_root = _tree.
GetCompilationUnitRoot
();
Microsoft.CodeAnalysis.CSharp (6)
Binder\Binder_Initializers.cs (1)
198
var syntaxRoot = syntaxTree.
GetCompilationUnitRoot
();
Compilation\CSharpCompilation.cs (2)
763
var root = tree.
GetCompilationUnitRoot
();
3593
var unit = syntaxTree.
GetCompilationUnitRoot
();
Compilation\SyntaxAndDeclarationManager.cs (3)
183
foreach (var directive in tree.
GetCompilationUnitRoot
().GetLoadDirectives())
449
var newLoadDirectivesSyntax = newTree.
GetCompilationUnitRoot
().GetLoadDirectives();
450
var loadDirectivesHaveChanged = !oldTree.
GetCompilationUnitRoot
().GetLoadDirectives().SequenceEqual(newLoadDirectivesSyntax);
Microsoft.CodeAnalysis.CSharp.CodeStyle (4)
CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (1)
49
var root = context.Tree.
GetCompilationUnitRoot
(context.CancellationToken);
CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
92
var root = context.SemanticModel.SyntaxTree.
GetCompilationUnitRoot
(context.CancellationToken);
190
var root = tree.
GetCompilationUnitRoot
(cancellationToken);
CSharpSemanticFacts.cs (1)
134
var root = original.SyntaxTree.
GetCompilationUnitRoot
(cancellationToken);
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (1)
CommandLineTests.cs (1)
9194
var loc = new SourceLocation(tree.
GetCompilationUnitRoot
().FindToken(6));
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();
703
var tuple1 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0);
709
var tuple2 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
734
var equals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
790
var tuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
814
var tuple1 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0);
827
var tuple2 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
875
var equals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
923
var equals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
972
var equals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
1022
var tuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
1029
var lastEquals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Last();
1076
var defaultLiterals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>()
1110
var defaultLiterals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>()
1142
var defaultLiterals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>()
1173
var defaultLiterals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>()
1232
var defaults = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>()
1332
var lastTuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Last();
1418
var literals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>();
1429
var defaultLiterals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>()
1484
var defaultLiterals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>()
1518
var tuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(3);
1578
var nulls = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>();
1587
var tuples = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>();
1615
var lastLiteral = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Last();
1640
var rightTuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(2);
1696
var tuple1 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0);
1704
var tuple2 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
1728
var addition = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Last();
1797
var tuple1 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0);
1803
var tuple2 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
1939
var tuple1 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0);
1945
var tuple2 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1);
2595
var firstEquals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().First();
2603
var secondEquals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Last();
2663
var equals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Last();
3299
var comparison = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
3705
var comparison = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
3829
var comparison = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
3932
var comparison = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
4057
var comparison = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
4104
var comparison = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().First();
4205
var lastNull = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LiteralExpressionSyntax>().Last();
5143
var equals = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().First();
5179
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();
3458
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
3630
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
3681
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
3927
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
3984
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
4017
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
4149
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
5468
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8297
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8328
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8383
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8412
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8441
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8489
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8523
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8556
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8585
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8632
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8667
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8696
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8725
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8755
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8810
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8840
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8899
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
8946
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
9019
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
9076
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
9148
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
9229
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
9312
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
16545
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
16572
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
16609
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
17216
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
17277
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
17336
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
17374
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
17407
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
17440
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19235
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19297
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19400
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19431
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19485
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19543
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19666
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19710
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
19741
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
20363
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
21352
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
22646
var finalString = startTree.
GetCompilationUnitRoot
().ToFullString();
22651
var finalText = newTree.
GetCompilationUnitRoot
().ToFullString();
22887
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
26261
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
26333
var doSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
26366
var doSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
26399
var doSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
26432
var doSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (27)
Attributes\AttributeTests.cs (3)
5422
var m = (ExpressionSyntax)cm.SyntaxTrees[0].
GetCompilationUnitRoot
().FindToken(index).Parent.Parent;
7241
var attrArgSyntaxes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AttributeArgumentSyntax>();
7282
var attrArgSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AttributeArgumentSyntax>().Single();
Emit\NumericIntPtrTests.cs (5)
11138
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
11161
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
11189
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
11214
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
11259
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
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;
Semantics\PatternSwitchTests.cs (4)
1513
var sRef = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "s").Single();
1515
var iRef = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "i").Single();
1517
var s2Ref = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "s2").Single();
1519
var i2Ref = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "i2").Single();
Microsoft.CodeAnalysis.CSharp.Features (3)
CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (1)
49
var root = context.Tree.
GetCompilationUnitRoot
(context.CancellationToken);
CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
92
var root = context.SemanticModel.SyntaxTree.
GetCompilationUnitRoot
(context.CancellationToken);
190
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 (280)
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)
1261
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();
4172
var designations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
4174
var refs = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>();
4240
var designations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
4259
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
4317
var tuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
4375
var designations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
4394
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
4448
var tuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
4510
foreach (var designation in tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DiscardDesignationSyntax>())
4518
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
4582
var tuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
4668
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
4725
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
4762
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
4840
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
4945
var declaration = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single();
4991
var declaration = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single();
5049
var declaration = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single();
5133
Assert.False(tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any());
5189
var designations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
5208
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
5262
var tuples = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ToArray();
5333
var designations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
5352
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
5406
var tuples = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ToArray();
5481
foreach (var designation in tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DiscardDesignationSyntax>())
5489
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
5549
var tuples = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ToArray();
5657
var designations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
5676
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
5712
var tuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
5767
var designations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
5786
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
5822
var tuple = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
5881
foreach (var designation in tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DiscardDesignationSyntax>())
5889
var declarations = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray();
5928
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)
2513
var root = tree.
GetCompilationUnitRoot
();
3132
var root = tree.
GetCompilationUnitRoot
();
Semantics\InteractiveSemanticModelTests.cs (2)
40
var root = tree.
GetCompilationUnitRoot
();
275
return GetExprSyntaxList(syntaxTree.
GetCompilationUnitRoot
(), null);
Semantics\LambdaTests.cs (22)
837
ExpressionSyntax expr = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().
845
var exprs = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>();
937
var invocation = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
1030
.
GetCompilationUnitRoot
()
1084
.
GetCompilationUnitRoot
()
1119
.
GetCompilationUnitRoot
()
1174
var expr = (ExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single().Body;
1202
var expr = (ExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer.Value;
1234
var expr = (ExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single().Body;
2116
var lambda = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
2162
var lambda = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
2208
var lambda = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
2254
var lambda = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
2300
var lambda = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
2330
var lambda = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
2357
var lambda = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LambdaExpressionSyntax>().Single();
2993
ExpressionSyntax contentType = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ContentType").Single();
3000
ExpressionSyntax b = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b").Single();
3009
ParameterSyntax parameterSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().Single();
3035
ExpressionSyntax contentType = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ContentType").Single();
3042
ExpressionSyntax b = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b").Single();
3050
ParameterSyntax parameterSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().Single();
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();
488
var lockStatements = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LockStatementSyntax>().ToList();
549
var localDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TypeParameterSyntax>().Single();
574
var lockStatements = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LockStatementSyntax>().ToList();
603
var localDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single();
627
var localDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single();
698
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)
15290
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
15311
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
15334
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
15362
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
15385
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
15415
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
Semantics\NonTrailingNamedArgumentsTests.cs (15)
44
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
366
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
392
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
422
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
454
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
483
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
533
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
568
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
597
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
651
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
678
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
709
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
743
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
775
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
949
var nodes = tree.
GetCompilationUnitRoot
().DescendantNodes();
Semantics\OperatorTests.cs (1)
8811
var methodDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Semantics\OutVarTests.cs (4)
34270
var method = syntaxTree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().ElementAt(i + 2);
34280
syntaxTree = syntaxTree.
GetCompilationUnitRoot
().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree;
34484
var method = syntaxTree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().ElementAt(i + 2);
34494
syntaxTree = syntaxTree.
GetCompilationUnitRoot
().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree;
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)
3254
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
3302
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
3353
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
Semantics\RecordTests.cs (1)
28322
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
Semantics\RefEscapingTests.cs (8)
4422
var tuple2 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(3);
4428
var tuple3 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(5);
4434
var tuple6 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(11);
4440
var tuple7 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(13);
4522
var tuple2 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(3);
4528
var tuple3 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(5);
4534
var tuple6 = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(11);
4540
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)
3328
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();
1029
var variables = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>();
1131
var variables = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>();
2343
var expressions = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<StackAllocArrayCreationExpressionSyntax>().ToArray();
2449
var expressions = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().ToArray();
2549
var expressions = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<StackAllocArrayCreationExpressionSyntax>().ToArray();
2633
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)
44
var catchClause = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<CatchClauseSyntax>().Single();
Semantics\UnsafeTests.cs (28)
2385
var methodDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
2560
Assert.True(tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AnonymousObjectCreationExpressionSyntax>().
4419
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single();
4456
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<FieldDeclarationSyntax>().Single();
4485
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single();
4523
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single();
4566
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single();
4697
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Last();
5007
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
5074
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
5320
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single();
5387
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single();
5445
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single();
5507
foreach (var nullSyntax in tree.
GetCompilationUnitRoot
().DescendantTokens().Where(token => token.IsKind(SyntaxKind.NullKeyword)))
5543
foreach (var declarationSyntax in tree.
GetCompilationUnitRoot
().DescendantTokens().OfType<VariableDeclarationSyntax>().Where(syntax => syntax.GetFirstToken().IsKind(SyntaxKind.VoidKeyword)))
6023
foreach (var binOpSyntax in tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>())
6073
foreach (var binOpSyntax in tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>())
6485
foreach (var binOpSyntax in tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>())
7339
var declarators = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(3).Reverse().ToArray();
7385
var declarators = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(numSymbols).Reverse().ToArray();
7386
var dereferences = tree.
GetCompilationUnitRoot
().DescendantNodes().Where(syntax => syntax.IsKind(SyntaxKind.PointerIndirectionExpression)).ToArray();
7459
var declarators = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(numSymbols).Reverse().ToArray();
7781
var syntaxes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SizeOfExpressionSyntax>();
7843
var syntaxes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SizeOfExpressionSyntax>();
7903
var syntaxes = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<SizeOfExpressionSyntax>();
8453
var stackAllocSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<StackAllocArrayCreationExpressionSyntax>().Single();
8985
var parameterSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().Single();
9025
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();
1340
var usingStatement = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<UsingStatementSyntax>().Single();
1375
var usingStatement = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<UsingStatementSyntax>().Single();
1852
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
1864
var usingStatements = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<UsingStatementSyntax>().ToList();
1880
var usingStatements = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<UsingStatementSyntax>().ToList();
1893
var usingStatements = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<UsingStatementSyntax>().ToList();
Semantics\Utf8StringsLiteralsTests.cs (14)
2969
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
2997
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3025
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3053
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3081
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3109
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3137
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3165
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3193
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3221
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3249
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3277
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
3305
var node = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression;
4063
foreach (var node in tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(b => b.IsKind(SyntaxKind.AddExpression)))
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (367)
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
();
4642
GetExpressionSyntax(tree.
GetCompilationUnitRoot
(), exprSynList);
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (158)
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();
4769
var structDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<StructDeclarationSyntax>().First();
4770
var interfaceDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<InterfaceDeclarationSyntax>().Last();
4799
var decl = (TupleExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression));
4822
var decl = (TupleExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression));
4845
var decl = (TupleExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression));
4868
var decl = (TupleExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression));
4891
var decl = (TupleExpressionSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression));
4914
var decl = (ArgumentSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument));
4937
var decl = (ArgumentSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument));
4960
var decl = (ArgumentSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument));
4995
var decl = (ArgumentSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument));
5041
var decl = (ArgumentSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument));
5090
var decl = (ArgumentSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument));
5113
var decl = (ArgumentSyntax)tree.
GetCompilationUnitRoot
().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument));
5126
var root = tree.
GetCompilationUnitRoot
();
5175
var cu = tree.
GetCompilationUnitRoot
();
5224
var decls = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().ToArray();
5245
var decls = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().ToArray();
5266
var decls = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParameterSyntax>().ToArray();
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)
419
_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)
1664
var revisedSource = new DocumentationCommentAdder().Visit(Parse(source).
GetCompilationUnitRoot
()).ToFullString();
1848
var revisedSource = new DocumentationCommentAdder().Visit(Parse(source).
GetCompilationUnitRoot
()).ToFullString();
2217
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)
856
var docComments = tree.
GetCompilationUnitRoot
().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
SymbolDisplay\SymbolDisplayTests.cs (2)
5754
var methodDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
5764
methodDecl = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Symbols\AnonymousTypesSemanticsTests.cs (1)
1967
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)
391
var variableDeclarator = (VariableDeclaratorSyntax)tree.
GetCompilationUnitRoot
()
398
var sourceExpression1 = (ExpressionSyntax)tree.
GetCompilationUnitRoot
()
404
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;
2437
var expr = ((ExpressionStatementSyntax)((GlobalStatementSyntax)tree.
GetCompilationUnitRoot
().Members[0]).Statement).Expression;
2733
var node = tree.
GetCompilationUnitRoot
().FindToken(code.IndexOf("GetHashCode", StringComparison.Ordinal)).Parent;
2743
node = tree.
GetCompilationUnitRoot
().FindToken(code.IndexOf("Cast<T1>", StringComparison.Ordinal)).Parent;
2958
var memberAccess = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
3016
var memberAccess = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
3145
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)
1288
var indexerAccessSyntax = GetElementAccessExpressions(tree.
GetCompilationUnitRoot
()).Single();
2530
var actual = GetElementAccessExpressions(tree.
GetCompilationUnitRoot
()).Select(syntax => model.GetSymbolInfo(syntax).Symbol.ToTestDisplayString());
2614
var elementAccessSyntaxes = GetElementAccessExpressions(tree.
GetCompilationUnitRoot
());
2701
var elementAccessSyntaxes = GetElementAccessExpressions(tree.
GetCompilationUnitRoot
());
2843
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)
828
ExpressionSyntax lambdaSyntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single();
835
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)
30
var root = tree.
GetCompilationUnitRoot
();
87
var root = tree.
GetCompilationUnitRoot
();
147
var root = tree.
GetCompilationUnitRoot
();
202
var root = tree.
GetCompilationUnitRoot
();
267
var root = tree.
GetCompilationUnitRoot
();
294
var root = tree.
GetCompilationUnitRoot
();
340
var root = tree.
GetCompilationUnitRoot
();
381
var root = tree.
GetCompilationUnitRoot
();
402
var root = tree.
GetCompilationUnitRoot
();
421
var root = tree.
GetCompilationUnitRoot
();
440
var root = tree.
GetCompilationUnitRoot
();
459
var root = tree.
GetCompilationUnitRoot
();
478
var root = tree.
GetCompilationUnitRoot
();
499
var root = tree.
GetCompilationUnitRoot
();
522
UsingDirectiveSyntax usingAlias = syntaxTree.
GetCompilationUnitRoot
().Usings.First();
Symbols\TypeTests.cs (1)
1851
var syntax = tree.
GetCompilationUnitRoot
().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (709)
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 (135)
50
Assert.Equal(0, oldTree.
GetCompilationUnitRoot
().Errors().Length);
51
Assert.Equal(0, newTree.
GetCompilationUnitRoot
().Errors().Length);
98
Assert.Equal(0, oldTree.
GetCompilationUnitRoot
().Errors().Length);
99
Assert.Equal(0, newTree.
GetCompilationUnitRoot
().Errors().Length);
134
Assert.Equal(0, oldTree.
GetCompilationUnitRoot
().Errors().Length);
135
Assert.Equal(0, newTree.
GetCompilationUnitRoot
().Errors().Length);
151
Assert.Equal(0, oldTree.
GetCompilationUnitRoot
().Errors().Length);
152
Assert.Equal(0, newTree.
GetCompilationUnitRoot
().Errors().Length);
167
Assert.Equal(0, oldTree.
GetCompilationUnitRoot
().Errors().Length);
168
Assert.Equal(0, newTree.
GetCompilationUnitRoot
().Errors().Length);
185
Assert.Equal(0, oldTree.
GetCompilationUnitRoot
().Errors().Length);
186
Assert.Equal(0, newTree.
GetCompilationUnitRoot
().Errors().Length);
203
Assert.Equal(0, oldTree.
GetCompilationUnitRoot
().Errors().Length);
204
Assert.Equal(0, newTree.
GetCompilationUnitRoot
().Errors().Length);
219
Assert.Equal(0, oldTree.
GetCompilationUnitRoot
().Errors().Length);
220
Assert.Equal(0, newTree.
GetCompilationUnitRoot
().Errors().Length);
241
Assert.Equal(0, oldTree.
GetCompilationUnitRoot
().Errors().Length);
242
Assert.Equal(0, newTree.
GetCompilationUnitRoot
().Errors().Length);
263
Assert.Equal(0, oldTree.
GetCompilationUnitRoot
().Errors().Length);
264
Assert.Equal(0, newTree.
GetCompilationUnitRoot
().Errors().Length);
287
Assert.Equal(0, oldTree.
GetCompilationUnitRoot
().Errors().Length);
288
Assert.Equal(0, newTree.
GetCompilationUnitRoot
().Errors().Length);
312
Assert.Equal(0, oldTree.
GetCompilationUnitRoot
().Errors().Length);
313
Assert.Equal(0, newTree.
GetCompilationUnitRoot
().Errors().Length);
331
Assert.Equal(0, oldTree.
GetCompilationUnitRoot
().Errors().Length);
332
Assert.Equal(0, newTree.
GetCompilationUnitRoot
().Errors().Length);
354
Assert.Equal(0, oldTree.
GetCompilationUnitRoot
().Errors().Length);
355
var oldDirectives = oldTree.
GetCompilationUnitRoot
().GetDirectives();
363
var errors = newTree.
GetCompilationUnitRoot
().Errors();
367
var newDirectives = newTree.
GetCompilationUnitRoot
().GetDirectives();
397
var errors = oldTree.
GetCompilationUnitRoot
().Errors();
401
var oldDirectives = oldTree.
GetCompilationUnitRoot
().GetDirectives();
408
errors = newTree.
GetCompilationUnitRoot
().Errors();
410
var newDirectives = newTree.
GetCompilationUnitRoot
().GetDirectives();
540
var fullText = newTree.
GetCompilationUnitRoot
().ToFullString();
588
var finalString = startTree.
GetCompilationUnitRoot
().ToFullString();
592
var finalText = newTree.
GetCompilationUnitRoot
().ToFullString();
602
var finalString = startTree.
GetCompilationUnitRoot
().ToFullString();
606
var output = newTree.
GetCompilationUnitRoot
().ToFullString();
816
Assert.Equal(0, syntaxTree.
GetCompilationUnitRoot
().Errors().Length);
836
Assert.Equal(0, syntaxTree.
GetCompilationUnitRoot
().Errors().Length);
855
Assert.Equal(0, syntaxTree.
GetCompilationUnitRoot
().Errors().Length);
1149
Assert.Equal(parsedTree.
GetCompilationUnitRoot
().ToFullString(), incrementalTree.
GetCompilationUnitRoot
().ToFullString());
1289
Assert.Equal(parsedTree.
GetCompilationUnitRoot
().ChildNodesAndTokens().Count, incrementalTree.
GetCompilationUnitRoot
().ChildNodesAndTokens().Count);
1292
for (int i = 0; i < parsedTree.
GetCompilationUnitRoot
().ChildNodesAndTokens().Count; i++)
1294
Assert.Equal(parsedTree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[i].Kind(), incrementalTree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[i].Kind());
1613
Assert.Equal(parsedTree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[0].AsNode().ToFullString(), incrementalTree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[0].AsNode().ToFullString());
1719
Assert.Equal(parsedTree.
GetCompilationUnitRoot
().ToFullString(), incrementalTree.
GetCompilationUnitRoot
().ToFullString());
2068
CompareTreeEquivalence(parsedTree.
GetCompilationUnitRoot
(), incrementalTree.
GetCompilationUnitRoot
());
2100
CompareTreeEquivalence(parsedTree.
GetCompilationUnitRoot
(), incrementalTree.
GetCompilationUnitRoot
());
2133
CompareTreeEquivalence(parsedTree.
GetCompilationUnitRoot
(), incrementalTree.
GetCompilationUnitRoot
());
2184
CompareTreeEquivalence(parsedTree.
GetCompilationUnitRoot
(), incrementalTree.
GetCompilationUnitRoot
());
2214
CompareTreeEquivalence(parsedTree.
GetCompilationUnitRoot
(), incrementalTree.
GetCompilationUnitRoot
());
2243
CompareTreeEquivalence(parsedTree.
GetCompilationUnitRoot
(), incrementalTree.
GetCompilationUnitRoot
());
2347
CompareTreeEquivalence(parsedTree.
GetCompilationUnitRoot
(), incrementalTree.
GetCompilationUnitRoot
());
2380
CompareTreeEquivalence(parsedTree.
GetCompilationUnitRoot
(), reparsedTree.
GetCompilationUnitRoot
());
2394
Assert.Equal(oldText.ToString(), startTree.
GetCompilationUnitRoot
().ToFullString());
2501
var parsedTree = this.Parse(changedTree.
GetCompilationUnitRoot
().ToFullString());
2504
parsedTree.
GetCompilationUnitRoot
().EndOfFileToken.FullSpan,
2505
changedTree.
GetCompilationUnitRoot
().EndOfFileToken.FullSpan);
2532
var fullText = fullTree.
GetCompilationUnitRoot
().ToFullString();
2533
var incText = newTree.
GetCompilationUnitRoot
().ToFullString();
2546
fullText = fullTree.
GetCompilationUnitRoot
().ToFullString();
2547
incText = newTree.
GetCompilationUnitRoot
().ToFullString();
2617
int incCount = currTree.
GetCompilationUnitRoot
().ChildNodesAndTokens().Count;
2618
int fullCount = fullTree.
GetCompilationUnitRoot
().ChildNodesAndTokens().Count;
2620
WalkTreeAndVerify(currTree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
2653
WalkTreeAndVerify(currTree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
2665
tree.
GetCompilationUnitRoot
().Members.First().Green;
2746
Assert.Equal(0, oldTree.
GetCompilationUnitRoot
().Errors().Length);
2747
Assert.Equal(0, newTree.
GetCompilationUnitRoot
().Errors().Length);
2808
WalkTreeAndVerify(newTree.
GetCompilationUnitRoot
(), SyntaxFactory.ParseSyntaxTree(newText).
GetCompilationUnitRoot
());
2828
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
2849
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
2870
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
2891
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
2912
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
2934
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
2958
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
2982
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3006
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3030
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3054
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3080
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3105
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3131
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3157
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3175
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3193
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3211
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3225
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3239
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3254
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3291
WalkTreeAndVerify(tree.
GetCompilationUnitRoot
(), fullTree.
GetCompilationUnitRoot
());
3342
ParentChecker.CheckParents(parsedTree.
GetCompilationUnitRoot
(), parsedTree);
3343
ParentChecker.CheckParents(incrementalTree.
GetCompilationUnitRoot
(), incrementalTree);
3351
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)
77
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
78
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
79
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.LeadingTrivia;
97
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
98
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
99
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.LeadingTrivia;
114
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
115
Assert.NotEqual(0, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
116
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.LeadingTrivia;
129
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
130
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
131
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.LeadingTrivia;
145
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
146
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
147
Assert.Equal(SyntaxKind.ClassDeclaration, tree.
GetCompilationUnitRoot
().Members[0].Kind());
148
var leading = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia();
167
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
168
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
169
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.LeadingTrivia;
191
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
192
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
193
Assert.Equal(SyntaxKind.ClassDeclaration, tree.
GetCompilationUnitRoot
().Members[0].Kind());
194
var leading = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia();
214
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
215
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
216
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
237
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
238
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
239
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
260
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
261
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
262
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
287
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
288
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
289
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
315
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
316
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
317
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
339
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
340
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
341
var leading = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia();
364
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
365
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
366
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
390
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
391
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
392
var leading = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia();
417
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
418
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
419
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
444
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
445
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
446
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
472
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
473
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
474
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
501
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
502
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
503
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
531
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
532
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
533
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
560
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
561
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
562
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
590
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
591
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
592
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
621
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
622
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
623
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
644
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
645
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
646
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
666
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
667
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
668
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
688
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
689
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
690
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
710
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
711
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
712
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
732
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
733
Assert.NotEqual(0, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
734
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
752
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
753
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
754
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
786
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
787
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
788
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
819
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
820
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
821
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
850
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
851
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
852
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
878
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
879
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Warnings().Length);
880
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
903
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
904
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
905
var leading = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia();
929
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
930
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
931
var leading = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia();
954
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
955
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
956
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
981
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
982
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
983
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1012
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1013
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1014
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1040
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1041
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1042
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1065
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1066
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1067
var leading = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia();
1090
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1091
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1092
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1117
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1118
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1119
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1150
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1151
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1152
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1181
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1182
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1183
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1207
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1208
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1209
var leading = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia();
1234
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1235
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1236
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1262
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1263
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Errors().Length);
1264
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1287
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1288
Assert.Equal(2, tree.
GetCompilationUnitRoot
().ChildNodesAndTokens().Count);
1289
Assert.Equal(SyntaxKind.ClassDeclaration, tree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[0].Kind());
1290
var classdecl = (TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[0].AsNode();
1297
Assert.Equal(SyntaxKind.EndOfFileToken, tree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[1].Kind());
1307
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1308
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1309
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1331
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1332
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1333
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1356
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1357
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1358
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1380
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1381
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1382
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1405
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1406
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1407
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1429
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1430
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1431
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1454
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1455
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1456
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1478
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1479
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1480
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1503
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1504
Assert.NotEqual(0, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1514
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1515
Assert.NotEqual(0, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1525
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1526
Assert.NotEqual(0, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1536
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1537
Assert.NotEqual(0, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1547
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1548
Assert.NotEqual(0, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1558
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1559
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1560
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1586
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1587
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1588
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1614
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1615
Assert.NotEqual(0, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
1616
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1640
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1641
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1642
var leading = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1671
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1674
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Warnings().Length);
1677
VerifyDiagnostics(tree.
GetCompilationUnitRoot
(), new List<TestError>() { new TestError(1570, true) });
1688
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1691
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Warnings().Length);
1694
VerifyDiagnostics(tree.
GetCompilationUnitRoot
(), new List<TestError>() { new TestError(1570, true) });
1707
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1708
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1711
var trivias = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1746
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1747
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1750
var trivias = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1786
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1789
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Warnings().Length);
1792
var trivias = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia();
1827
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1828
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1831
Assert.Equal(typeof(MethodDeclarationSyntax), (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0].GetType());
1833
var keyword = ((tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType;
1862
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1863
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1866
Assert.Equal(typeof(MethodDeclarationSyntax), (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0].GetType());
1868
var keyword = ((tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType;
1897
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1898
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1901
Assert.Equal(typeof(PropertyDeclarationSyntax), (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0].GetType());
1903
var keyword = ((tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0] as PropertyDeclarationSyntax).Type;
1932
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1933
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1936
Assert.Equal(typeof(IndexerDeclarationSyntax), (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0].GetType());
1938
var keyword = ((tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0] as IndexerDeclarationSyntax).Type;
1967
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1968
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
1971
Assert.Equal(typeof(MethodDeclarationSyntax), (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0].GetType());
1974
var method = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax;
2004
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2005
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
2008
Assert.Equal(typeof(ClassDeclarationSyntax), tree.
GetCompilationUnitRoot
().Members[0].GetType());
2011
var typeParameter = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).TypeParameterList.Parameters.Single();
2042
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2043
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Errors().Length); // 4 errors because of the incomplete class decl
2046
Assert.Equal(typeof(MethodDeclarationSyntax), (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0].GetType());
2048
var keyword = ((tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType;
2078
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2079
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
2081
var bracket = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).CloseBraceToken;
2109
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2110
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Errors().Length); // error because of the incomplete class decl
2113
var classDecl = (TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0];
2142
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2143
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length); // 4 errors because of the incomplete class decl
2146
var bracket = tree.
GetCompilationUnitRoot
().EndOfFileToken;
2172
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2173
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length); // 4 errors because of the incomplete class decl
2176
var bracket = tree.
GetCompilationUnitRoot
().EndOfFileToken;
2203
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2204
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
2207
var bracket = tree.
GetCompilationUnitRoot
().EndOfFileToken;
2238
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2241
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Errors().Length);
2242
VerifyDiagnostics(tree.
GetCompilationUnitRoot
(), new List<TestError>() { new TestError(1035, false) });
2253
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2254
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
2256
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2281
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2282
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
2285
var eofToken = tree.
GetCompilationUnitRoot
().EndOfFileToken;
2323
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2324
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
2326
var eofToken = tree.
GetCompilationUnitRoot
().EndOfFileToken;
2355
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2358
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Warnings().Length);
2361
var eofToken = tree.
GetCompilationUnitRoot
().EndOfFileToken;
2379
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2380
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
2383
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2409
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2410
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
2413
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2438
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2440
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2461
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2464
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Warnings().Length);
2466
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2488
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2491
Assert.Equal(2, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
2493
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2513
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2516
Assert.Equal(2, tree.
GetCompilationUnitRoot
().Warnings().Length);
2518
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2538
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2540
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2564
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2566
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2590
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2593
Assert.Equal(2, tree.
GetCompilationUnitRoot
().Warnings().Length);
2605
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2608
Assert.Equal(1, tree.
GetCompilationUnitRoot
().Warnings().Length);
2619
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2622
Assert.Equal(2, tree.
GetCompilationUnitRoot
().Warnings().Length);
2634
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2636
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2652
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2654
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2675
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2676
Assert.Equal(0, tree.
GetCompilationUnitRoot
().Errors().Length);
2693
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2694
Assert.Equal(4, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
2695
VerifyDiagnostics(tree.
GetCompilationUnitRoot
(), new List<TestError>
2719
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2720
Assert.Equal(4, tree.
GetCompilationUnitRoot
().ErrorsAndWarnings().Length);
2721
VerifyDiagnostics(tree.
GetCompilationUnitRoot
(), new List<TestError>
2742
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2744
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
2766
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
2768
var classKeyword = (tree.
GetCompilationUnitRoot
().Members[0] as TypeDeclarationSyntax).Keyword;
Parsing\LineSpanDirectiveParsingTests.cs (1)
30
var node = ParseTree(text, options).
GetCompilationUnitRoot
();
Parsing\ParserErrorMessageTests.cs (25)
5601
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5604
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5623
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5626
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5688
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5691
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5707
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5710
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5750
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5753
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5785
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5788
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5819
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
5822
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6108
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6126
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6139
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6147
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6168
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6175
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6198
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6211
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6240
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6253
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify();
6527
tree.
GetCompilationUnitRoot
().GetDiagnostics().Verify(
Parsing\ParsingErrorRecoveryTests.cs (9)
6606
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
6625
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
6659
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
6684
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
6709
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
6735
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
6759
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
6784
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
6798
Assert.Equal(text, syntaxTree.
GetCompilationUnitRoot
().ToFullString());
Parsing\ParsingTests.cs (2)
87
ParseTree(text, options).
GetCompilationUnitRoot
();
154
_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);
9615
Assert.Equal(1, tree.
GetCompilationUnitRoot
().ChildNodes().Count());
9616
Assert.Equal(SyntaxKind.GlobalStatement, tree.
GetCompilationUnitRoot
().ChildNodes().ToList()[0].Kind());
9638
var root = tree.
GetCompilationUnitRoot
();
9649
root = tree.
GetCompilationUnitRoot
();
9665
root = tree.
GetCompilationUnitRoot
();
9712
var root = tree.
GetCompilationUnitRoot
();
Syntax\SerializationTests.cs (15)
25
var root = tree.
GetCompilationUnitRoot
();
35
Assert.True(droot.IsEquivalentTo(tree.
GetCompilationUnitRoot
()));
43
var root = tree.
GetCompilationUnitRoot
();
56
Assert.True(droot.IsEquivalentTo(tree.
GetCompilationUnitRoot
()));
66
var root = tree.
GetCompilationUnitRoot
().WithAdditionalAnnotations(annotation);
81
Assert.True(droot.IsEquivalentTo(tree.
GetCompilationUnitRoot
()));
90
var root = tree.
GetCompilationUnitRoot
().WithAdditionalAnnotations(annotation, annotation);
105
Assert.True(droot.IsEquivalentTo(tree.
GetCompilationUnitRoot
()));
114
var root = tree.
GetCompilationUnitRoot
().WithAdditionalAnnotations(annotation);
129
Assert.True(droot.IsEquivalentTo(tree.
GetCompilationUnitRoot
()));
143
var root = tree.
GetCompilationUnitRoot
().WithAdditionalAnnotations(annotation1);
189
var root = tree.
GetCompilationUnitRoot
().WithAdditionalAnnotations(annotation1, annotation1);
210
var root = tree.
GetCompilationUnitRoot
();
220
Assert.True(newRoot.IsEquivalentTo(tree.
GetCompilationUnitRoot
()));
279
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);
765
var trivia = tree.
GetCompilationUnitRoot
().FindTrivia(position);
777
Assert.True(tree.
GetCompilationUnitRoot
().IsEquivalentTo(tree.
GetCompilationUnitRoot
()));
785
Assert.False(tree.
GetCompilationUnitRoot
().IsEquivalentTo(null));
794
Assert.NotEqual(tree1.
GetCompilationUnitRoot
(), tree2.
GetCompilationUnitRoot
());
795
Assert.True(tree1.
GetCompilationUnitRoot
().IsEquivalentTo(tree2.
GetCompilationUnitRoot
()));
803
Assert.NotEqual(tree1.
GetCompilationUnitRoot
(), tree2.
GetCompilationUnitRoot
());
804
Assert.False(tree1.
GetCompilationUnitRoot
().IsEquivalentTo(tree2.
GetCompilationUnitRoot
()));
812
Assert.NotEqual(tree1.
GetCompilationUnitRoot
(), tree2.
GetCompilationUnitRoot
());
813
Assert.False(tree1.
GetCompilationUnitRoot
().IsEquivalentTo(tree2.
GetCompilationUnitRoot
()));
821
var m1 = ((TypeDeclarationSyntax)tree1.
GetCompilationUnitRoot
().Members[0]).Members[0];
822
var m2 = ((TypeDeclarationSyntax)tree2.
GetCompilationUnitRoot
().Members[0]).Members[0];
834
Assert.False(tree1.
GetCompilationUnitRoot
().IsEquivalentTo(tree2.
GetCompilationUnitRoot
()));
842
Assert.True(tree.
GetCompilationUnitRoot
().IsIncrementallyIdenticalTo(tree.
GetCompilationUnitRoot
()));
850
Assert.True(tree.
GetCompilationUnitRoot
().EndOfFileToken.IsIncrementallyIdenticalTo(tree.
GetCompilationUnitRoot
().EndOfFileToken));
858
Assert.False(tree.
GetCompilationUnitRoot
().GetFirstToken().IsIncrementallyIdenticalTo(tree.
GetCompilationUnitRoot
().GetFirstToken().GetNextToken()));
867
Assert.True(tree1.
GetCompilationUnitRoot
().GetFirstToken().IsIncrementallyIdenticalTo(tree2.
GetCompilationUnitRoot
().GetFirstToken()));
876
Assert.False(tree1.
GetCompilationUnitRoot
().IsIncrementallyIdenticalTo(tree2.
GetCompilationUnitRoot
()));
886
tree1.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single().IsIncrementallyIdenticalTo(
887
tree2.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single()));
897
tree1.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single().IsIncrementallyIdenticalTo(
898
tree2.
GetCompilationUnitRoot
().DescendantNodes().OfType<MethodDeclarationSyntax>().Single()));
907
var trivia = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia()[0];
910
var triviaAgain = tree.
GetCompilationUnitRoot
().Members[0].GetLeadingTrivia()[0];
920
var first = tree.
GetCompilationUnitRoot
().GetFirstToken();
928
var first = tree.
GetCompilationUnitRoot
().GetFirstToken(includeZeroWidth: true);
936
var last = tree.
GetCompilationUnitRoot
().GetLastToken();
944
var last = tree.
GetCompilationUnitRoot
().GetLastToken(includeZeroWidth: true);
947
last = tree.
GetCompilationUnitRoot
().Members[0].GetLastToken(includeZeroWidth: true);
957
var root1 = tree1.
GetCompilationUnitRoot
();
980
var tokens = tree.
GetCompilationUnitRoot
().DescendantTokens().ToList();
983
var token = tree.
GetCompilationUnitRoot
().GetFirstToken(includeSkipped: true);
1006
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1008
var tokens = tree.
GetCompilationUnitRoot
().DescendantTokens(descendIntoTrivia: true).Where(SyntaxToken.NonZeroWidth).ToList();
1013
var token = tree.
GetCompilationUnitRoot
().GetFirstToken(includeSkipped: true);
1034
var tokens = tree.
GetCompilationUnitRoot
().DescendantTokens().ToList();
1038
var token = tree.
GetCompilationUnitRoot
().GetFirstToken(includeSkipped: false);
1079
var tokens = tree.
GetCompilationUnitRoot
().DescendantTokens().ToList();
1082
var token = tree.
GetCompilationUnitRoot
().GetLastToken(); // skip EOF
1106
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1108
var tokens = tree.
GetCompilationUnitRoot
().DescendantTokens(descendIntoTrivia: true).Where(SyntaxToken.NonZeroWidth).ToList();
1113
var token = tree.
GetCompilationUnitRoot
().GetLastToken(includeSkipped: true);
1136
Assert.Equal(text, tree.
GetCompilationUnitRoot
().ToFullString());
1138
var tokens = tree.
GetCompilationUnitRoot
().DescendantTokens().ToList();
1142
var token = tree.
GetCompilationUnitRoot
().GetLastToken(includeSkipped: false);
1186
var tokens = tree.
GetCompilationUnitRoot
().DescendantTokens().ToList();
1189
var token = tree.
GetCompilationUnitRoot
().GetFirstToken(includeZeroWidth: true);
1228
var tokens = tree.
GetCompilationUnitRoot
().DescendantTokens().ToList();
1231
var token = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetPreviousToken(includeZeroWidth: true);
1255
SyntaxToken token = ((SyntaxToken)((SyntaxTree)syntaxTree).
GetCompilationUnitRoot
().EndOfFileToken).GetPreviousToken(includeZeroWidth: true);
1275
var children = tree.
GetCompilationUnitRoot
().Members[0].ChildNodesAndTokens().ToList();
1293
var children = tree.
GetCompilationUnitRoot
().Members[0].ChildNodesAndTokens().ToList();
1312
var child = tree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[0];
1313
var member = (TypeDeclarationSyntax)tree.
GetCompilationUnitRoot
().Members[0];
1329
var trivia = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia()[0];
1340
var trivia = tree.
GetCompilationUnitRoot
().EndOfFileToken.GetLeadingTrivia()[0];
1376
var d = tree.
GetCompilationUnitRoot
().GetFirstDirective();
1388
var d = tree.
GetCompilationUnitRoot
().GetLastDirective();
1405
var d1 = tree.
GetCompilationUnitRoot
().GetFirstDirective();
1433
var d1 = tree.
GetCompilationUnitRoot
().GetLastDirective();
1457
var c = tree.
GetCompilationUnitRoot
().Members[0];
1492
var d = tree.
GetCompilationUnitRoot
().GetFirstDirective();
1523
var d = tree.
GetCompilationUnitRoot
().GetFirstDirective();
1562
var d = tree.
GetCompilationUnitRoot
().GetLastDirective();
1593
var d = tree.
GetCompilationUnitRoot
().GetFirstDirective();
1627
var d = tree.
GetCompilationUnitRoot
().GetFirstDirective();
1661
var d = tree.
GetCompilationUnitRoot
().GetLastDirective();
1691
var d = tree.
GetCompilationUnitRoot
().GetLastDirective();
1714
var d = tree.
GetCompilationUnitRoot
().GetFirstDirective();
1735
var d = tree.
GetCompilationUnitRoot
().GetLastDirective();
1753
var rootNode = tree.
GetCompilationUnitRoot
();
1771
var rootNode = tree.
GetCompilationUnitRoot
();
1782
var rootNode = SyntaxFactory.ParseSyntaxTree("using X; namespace Y { }").
GetCompilationUnitRoot
();
1991
Assert.Equal(SyntaxKind.MethodDeclaration, tree.
GetCompilationUnitRoot
().ChildNodesAndTokens()[0].ChildNodesAndTokens()[3].Kind());
2000
var actualTokens = syntaxTree.
GetCompilationUnitRoot
().DescendantTokens();
2040
dynamic root = tree.
GetCompilationUnitRoot
();
3258
var root = tree.
GetCompilationUnitRoot
();
3343
foreach (var t in syntaxTree.
GetCompilationUnitRoot
().DescendantTokens())
3369
var token = syntaxTree.
GetCompilationUnitRoot
().FindToken(code.IndexOf("using Lib;", StringComparison.Ordinal));
3388
var trivia = tree.
GetCompilationUnitRoot
().FindTrivia(code.IndexOf("#r", StringComparison.Ordinal)); // ReferenceDirective.
3403
var compilationUnit = tree.
GetCompilationUnitRoot
();
3429
var compilationUnit = tree.
GetCompilationUnitRoot
();
3470
var node = SyntaxFactory.ParseSyntaxTree(" ").
GetCompilationUnitRoot
();
3799
var trivia = tree.
GetCompilationUnitRoot
().FindTrivia(position);
Syntax\SyntaxNormalizerTests.cs (3)
3709
TestNormalize(tree.
GetCompilationUnitRoot
(), """
3737
TestNormalize(tree.
GetCompilationUnitRoot
(),
3766
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.CSharp.Workspaces (1)
CSharpSemanticFacts.cs (1)
134
var root = original.SyntaxTree.
GetCompilationUnitRoot
(cancellationToken);
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
();