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)
198var syntaxRoot = syntaxTree.GetCompilationUnitRoot();
Compilation\CSharpCompilation.cs (2)
763var root = tree.GetCompilationUnitRoot(); 3593var unit = syntaxTree.GetCompilationUnitRoot();
Compilation\SyntaxAndDeclarationManager.cs (3)
183foreach (var directive in tree.GetCompilationUnitRoot().GetLoadDirectives()) 449var newLoadDirectivesSyntax = newTree.GetCompilationUnitRoot().GetLoadDirectives(); 450var loadDirectivesHaveChanged = !oldTree.GetCompilationUnitRoot().GetLoadDirectives().SequenceEqual(newLoadDirectivesSyntax);
Microsoft.CodeAnalysis.CSharp.CodeStyle (4)
CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (1)
49var root = context.Tree.GetCompilationUnitRoot(context.CancellationToken);
CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
92var root = context.SemanticModel.SyntaxTree.GetCompilationUnitRoot(context.CancellationToken); 190var root = tree.GetCompilationUnitRoot(cancellationToken);
CSharpSemanticFacts.cs (1)
134var root = original.SyntaxTree.GetCompilationUnitRoot(cancellationToken);
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (1)
CommandLineTests.cs (1)
9194var loc = new SourceLocation(tree.GetCompilationUnitRoot().FindToken(6));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (118)
BreakingChanges.cs (2)
199Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 218Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString());
CodeGen\CodeGenDeconstructTests.cs (8)
1366var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1423var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1467var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1508var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1561var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1668var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 5000var nodes = comp.SyntaxTrees[0].GetCompilationUnitRoot().DescendantNodesAndSelf(); 5123var nodes = comp.SyntaxTrees[0].GetCompilationUnitRoot().DescendantNodesAndSelf();
CodeGen\CodeGenTupleEqualityTests.cs (46)
362var tupleX = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 381var tupleY = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Last(); 703var tuple1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 709var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 734var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 790var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 814var tuple1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 827var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 875var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 923var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 972var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 1022var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 1029var lastEquals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Last(); 1076var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1110var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1142var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1173var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1232var defaults = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1332var lastTuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Last(); 1418var literals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>(); 1429var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1484var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1518var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(3); 1578var nulls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>(); 1587var tuples = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>(); 1615var lastLiteral = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Last(); 1640var rightTuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(2); 1696var tuple1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 1704var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 1728var addition = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Last(); 1797var tuple1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 1803var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 1939var tuple1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 1945var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 2595var firstEquals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 2603var secondEquals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Last(); 2663var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Last(); 3299var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 3705var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 3829var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 3932var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 4057var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 4104var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 4205var lastNull = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Last(); 5143var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 5179var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First();
CodeGen\CodeGenTupleTest.cs (62)
1609var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3218var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3251var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3458var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3630var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3681var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3927var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3984var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 4017var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 4149var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 5468var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8297var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8328var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8383var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8412var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8441var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8489var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8523var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8556var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8585var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8632var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8667var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8696var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8725var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8755var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8810var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8840var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8899var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 8946var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 9019var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 9076var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 9148var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 9229var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 9312var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 16545var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 16572var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 16609var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 17216var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 17277var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 17336var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 17374var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 17407var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 17440var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19235var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19297var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19400var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19431var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19485var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19543var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19666var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19710var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 19741var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 20363var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 21352var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 22646var finalString = startTree.GetCompilationUnitRoot().ToFullString(); 22651var finalText = newTree.GetCompilationUnitRoot().ToFullString(); 22887var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 26261var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 26333var doSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 26366var doSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 26399var doSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 26432var doSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (27)
Attributes\AttributeTests.cs (3)
5422var m = (ExpressionSyntax)cm.SyntaxTrees[0].GetCompilationUnitRoot().FindToken(index).Parent.Parent; 7241var attrArgSyntaxes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AttributeArgumentSyntax>(); 7282var attrArgSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Single();
Emit\NumericIntPtrTests.cs (5)
11138var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 11161var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 11189var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 11214var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 11259var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
FlowAnalysis\IterationJumpYieldStatementTests.cs (1)
914var foreachNode = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
FlowAnalysis\RegionAnalysisTests.cs (14)
3102var statement = compilation.SyntaxTrees[0].GetCompilationUnitRoot().DescendantNodesAndSelf().OfType<StatementSyntax>().First(); 4426var index = tree.GetCompilationUnitRoot().ToFullString().IndexOf(".Class)", StringComparison.Ordinal); 4427var tok = tree.GetCompilationUnitRoot().FindToken(index); 4526var stmt1 = tree.GetCompilationUnitRoot().DescendantNodesAndSelf().OfType<StatementSyntax>().Where(n => n.ToString() == "IntPtr p;").Single(); 4527var stmt2 = tree.GetCompilationUnitRoot().DescendantNodesAndSelf().OfType<StatementSyntax>().Where(n => n.ToString().StartsWith(keyword)).First(); 5487var methodBlock = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BlockSyntax>().First(); 6217var invocation = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 6228var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 6314var root = tree.GetCompilationUnitRoot(); 6353var root = tree.GetCompilationUnitRoot(); 6380var root = tree.GetCompilationUnitRoot(); 6418var statement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BlockSyntax>().FirstOrDefault(); 6446var root = tree.GetCompilationUnitRoot(); 7909var stmt = tree.GetCompilationUnitRoot().DescendantNodesAndSelf().OfType<ForEachStatementSyntax>().Single().Statement;
Semantics\PatternSwitchTests.cs (4)
1513var sRef = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "s").Single(); 1515var iRef = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "i").Single(); 1517var s2Ref = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "s2").Single(); 1519var i2Ref = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "i2").Single();
Microsoft.CodeAnalysis.CSharp.Features (3)
CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (1)
49var root = context.Tree.GetCompilationUnitRoot(context.CancellationToken);
CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
92var root = context.SemanticModel.SyntaxTree.GetCompilationUnitRoot(context.CancellationToken); 190var root = tree.GetCompilationUnitRoot(cancellationToken);
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (11)
IOperation\IOperationTests.cs (2)
587var root = tree.GetCompilationUnitRoot(); 615var root = tree.GetCompilationUnitRoot();
IOperation\IOperationTests_IVariableDeclaration.cs (9)
925var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1215var rankSpecifierOld = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First(); 1218syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree; 2301var rankSpecifierOld = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First(); 2304syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree; 2362var rankSpecifierOld = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First(); 2365syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree; 2830var rankSpecifierOld = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First(); 2833syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (280)
Semantics\AccessibilityTests.cs (1)
53s_testModel.IsAccessible(s_testModel.SyntaxTree.GetCompilationUnitRoot().FullSpan.End + 1, s_testSymbol));
Semantics\ArglistTests.cs (1)
959var root = tree.GetCompilationUnitRoot();
Semantics\BindingAsyncTests.cs (3)
58var simple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(); 61var parens = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>(); 87var del = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single();
Semantics\ConditionalOperatorTests.cs (1)
1261var compUnit = tree.GetCompilationUnitRoot();
Semantics\ConstantTests.cs (1)
2923var expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First();
Semantics\DeconstructionTests.cs (40)
1839var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3765var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3943var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 4172var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 4174var refs = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>(); 4240var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 4259var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4317var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 4375var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 4394var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4448var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 4510foreach (var designation in tree.GetCompilationUnitRoot().DescendantNodes().OfType<DiscardDesignationSyntax>()) 4518var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4582var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 4668var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4725var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 4762var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4840var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4945var declaration = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 4991var declaration = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 5049var declaration = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 5133Assert.False(tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 5189var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 5208var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5262var tuples = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ToArray(); 5333var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 5352var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5406var tuples = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ToArray(); 5481foreach (var designation in tree.GetCompilationUnitRoot().DescendantNodes().OfType<DiscardDesignationSyntax>()) 5489var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5549var tuples = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ToArray(); 5657var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 5676var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5712var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 5767var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 5786var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5822var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 5881foreach (var designation in tree.GetCompilationUnitRoot().DescendantNodes().OfType<DiscardDesignationSyntax>()) 5889var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5928var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single();
Semantics\ImplicitObjectCreationTests.cs (21)
56var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 131var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 178var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 228var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 842var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 883var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 1706var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1866var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1896var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1926var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1978var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2036var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2071var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2125var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 2217var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2514var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2565var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2922var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 3215var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 4157var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 4184var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExpressionStatementSyntax>().Single();
Semantics\InitOnlyMemberTests.cs (2)
2513var root = tree.GetCompilationUnitRoot(); 3132var root = tree.GetCompilationUnitRoot();
Semantics\InteractiveSemanticModelTests.cs (2)
40var root = tree.GetCompilationUnitRoot(); 275return GetExprSyntaxList(syntaxTree.GetCompilationUnitRoot(), null);
Semantics\LambdaTests.cs (22)
837ExpressionSyntax expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>(). 845var exprs = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>(); 937var invocation = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1030.GetCompilationUnitRoot() 1084.GetCompilationUnitRoot() 1119.GetCompilationUnitRoot() 1174var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single().Body; 1202var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer.Value; 1234var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single().Body; 2116var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2162var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2208var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2254var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2300var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2330var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2357var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2993ExpressionSyntax contentType = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ContentType").Single(); 3000ExpressionSyntax b = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b").Single(); 3009ParameterSyntax parameterSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 3035ExpressionSyntax contentType = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ContentType").Single(); 3042ExpressionSyntax b = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b").Single(); 3050ParameterSyntax parameterSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Single();
Semantics\LockTests.cs (9)
45var localDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 50var lockStatement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LockStatementSyntax>().Single(); 55var memberAccessExpression = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 488var lockStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LockStatementSyntax>().ToList(); 549var localDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TypeParameterSyntax>().Single(); 574var lockStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LockStatementSyntax>().ToList(); 603var localDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 627var localDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 698var lockStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LockStatementSyntax>().ToList();
Semantics\LookupPositionTests.cs (1)
3129SyntaxToken token = model.SyntaxTree.GetCompilationUnitRoot().FindToken(position, findInsideTrivia: true);
Semantics\LookupTests.cs (1)
1369var eof = tree.GetCompilationUnitRoot().FullSpan.End;
Semantics\NativeIntegerTests.cs (6)
15290var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 15311var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 15334var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 15362var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 15385var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 15415var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
Semantics\NonTrailingNamedArgumentsTests.cs (15)
44var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 366var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 392var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 422var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 454var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 483var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 533var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 568var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 597var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 651var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 678var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 709var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 743var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 775var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 949var nodes = tree.GetCompilationUnitRoot().DescendantNodes();
Semantics\OperatorTests.cs (1)
8811var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Semantics\OutVarTests.cs (4)
34270var method = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ElementAt(i + 2); 34280syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree; 34484var method = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ElementAt(i + 2); 34494syntaxTree = syntaxTree.GetCompilationUnitRoot().ReplaceNode(rankSpecifierOld, rankSpecifierNew).SyntaxTree;
Semantics\QueryTests.cs (30)
1453var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 1662var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 1722var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 1760var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 2177SelectClauseSyntax selectClause = (SelectClauseSyntax)tree.GetCompilationUnitRoot().FindToken(sourceCode.IndexOf("select", StringComparison.Ordinal)).Parent; 2207SelectClauseSyntax selectClause = (SelectClauseSyntax)tree.GetCompilationUnitRoot().FindToken(sourceCode.IndexOf("select w", StringComparison.Ordinal)).Parent; 2234var e = (IdentifierNameSyntax)tree.GetCompilationUnitRoot().FindToken(sourceCode.IndexOf("x+1", StringComparison.Ordinal)).Parent; 2240e = (IdentifierNameSyntax)tree.GetCompilationUnitRoot().FindToken(sourceCode.IndexOf("w+1", StringComparison.Ordinal)).Parent; 2299var selectExpression = tree.GetCompilationUnitRoot().FindToken(sourceCode.IndexOf('5')); 2357var unknownAccessorDecls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>(); 2384var selectClause = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SelectClause)).Single() as SelectClauseSyntax; 2385var fromClause1 = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => (n.IsKind(SyntaxKind.FromClause)) && (n.ToString().Contains("num1"))).Single() as FromClauseSyntax; 2386var fromClause2 = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => (n.IsKind(SyntaxKind.FromClause)) && (n.ToString().Contains("num2"))).Single() as FromClauseSyntax; 2429foreach (var ordering in tree.GetCompilationUnitRoot().DescendantNodes().OfType<OrderingSyntax>()) 2484var selectClause = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SelectClause)).Single() as SelectClauseSyntax; 2548var selectClause = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.SelectClause)).Single() as SelectClauseSyntax; 2583var orderingClause = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.AscendingOrdering)).Single() as OrderingSyntax; 2716var queryExpr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<QueryExpressionSyntax>().Where(x => x.ToFullString() == "from i in expr1 let ").Single(); 2742var queryExpr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<QueryExpressionSyntax>().Single(); 2897var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "C").Single(); 2930var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "C").Single(); 3134var selectNode = tree.GetCompilationUnitRoot().FindToken(index).Parent as SelectClauseSyntax; 3162var joinNode = tree.GetCompilationUnitRoot().FindToken(index).Parent as JoinClauseSyntax; 3377tree.GetCompilationUnitRoot().DescendantNodes(n => n.ToString().Contains("assem2")) 3386tree.GetCompilationUnitRoot().DescendantNodes(n => n.ToString().Contains("assem1")) 3420var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 3464var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 3511var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Test").Single(); 3550var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Test2").Single(); 3598var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "QueryExpressionTest").Single();
Semantics\RecordStructTests.cs (3)
3254var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 3302var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 3353var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
Semantics\RecordTests.cs (1)
28322var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
Semantics\RefEscapingTests.cs (8)
4422var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(3); 4428var tuple3 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(5); 4434var tuple6 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(11); 4440var tuple7 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(13); 4522var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(3); 4528var tuple3 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(5); 4534var tuple6 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(11); 4540var tuple7 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(13);
Semantics\ScriptSemanticsTests.cs (5)
244var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExpressionSyntax>().First(); 492GetCompilationUnitRoot() as CompilationUnitSyntax). 521var root = tree.GetCompilationUnitRoot(); 537var root = tree.GetCompilationUnitRoot(); 561var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExpressionSyntax>().First();
Semantics\SemanticErrorTests.cs (1)
3328var compilationUnit = tree.GetCompilationUnitRoot();
Semantics\StackAllocInitializerTests.cs (8)
367var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().ToArray(); 443var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().ToArray(); 1029var variables = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 1131var variables = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 2343var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<StackAllocArrayCreationExpressionSyntax>().ToArray(); 2449var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().ToArray(); 2549var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<StackAllocArrayCreationExpressionSyntax>().ToArray(); 2633var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().ToArray();
Semantics\StackAllocSpanExpressionsTests.cs (2)
53var variables = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 127var variables = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>();
Semantics\SuppressAccessibilityChecksTests.cs (2)
123var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single().Body; 212var root = tree.GetCompilationUnitRoot();
Semantics\SyntaxTreeRootTests.cs (1)
113Assert.Throws<InvalidCastException>(() => { var _ = (CSharpSyntaxTree)(Object)tree.GetCompilationUnitRoot(); });
Semantics\TargetTypedConditionalOperatorTests.cs (1)
336var compUnit = tree.GetCompilationUnitRoot();
Semantics\TargetTypedDefaultTests.cs (36)
42var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 142var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 194var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 242var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 279var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 324var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 518var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 564var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 607var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 665var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 746var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 835var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 864var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1140var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1255var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1629var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1734var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1800var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1871var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 1909var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2089var def = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ElementAt(0); 2331var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2412var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2455var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2481var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 2483var digit = tree.GetCompilationUnitRoot().FindToken(source.IndexOf('2')); 3055var def = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 3342var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3381var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3512var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3575var default1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 3583var default2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DefaultExpressionSyntax>().ElementAt(0); 3590var default3 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DefaultExpressionSyntax>().ElementAt(1); 3597var default4 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DefaultExpressionSyntax>().ElementAt(2); 3671var nodes = tree.GetCompilationUnitRoot().DescendantNodes(); 3711var nodes = tree.GetCompilationUnitRoot().DescendantNodes();
Semantics\TryCatchTests.cs (1)
44var catchClause = tree.GetCompilationUnitRoot().DescendantNodes().OfType<CatchClauseSyntax>().Single();
Semantics\UnsafeTests.cs (28)
2385var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 2560Assert.True(tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectCreationExpressionSyntax>(). 4419var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 4456var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Single(); 4485var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 4523var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 4566var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 4697var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Last(); 5007var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 5074var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 5320var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 5387var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 5445var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 5507foreach (var nullSyntax in tree.GetCompilationUnitRoot().DescendantTokens().Where(token => token.IsKind(SyntaxKind.NullKeyword))) 5543foreach (var declarationSyntax in tree.GetCompilationUnitRoot().DescendantTokens().OfType<VariableDeclarationSyntax>().Where(syntax => syntax.GetFirstToken().IsKind(SyntaxKind.VoidKeyword))) 6023foreach (var binOpSyntax in tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>()) 6073foreach (var binOpSyntax in tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>()) 6485foreach (var binOpSyntax in tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>()) 7339var declarators = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(3).Reverse().ToArray(); 7385var declarators = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(numSymbols).Reverse().ToArray(); 7386var dereferences = tree.GetCompilationUnitRoot().DescendantNodes().Where(syntax => syntax.IsKind(SyntaxKind.PointerIndirectionExpression)).ToArray(); 7459var declarators = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(numSymbols).Reverse().ToArray(); 7781var syntaxes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SizeOfExpressionSyntax>(); 7843var syntaxes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SizeOfExpressionSyntax>(); 7903var syntaxes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SizeOfExpressionSyntax>(); 8453var stackAllocSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<StackAllocArrayCreationExpressionSyntax>().Single(); 8985var parameterSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 9025var foreachSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
Semantics\UsingStatementTests.cs (8)
60var usingStatement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().Single(); 69var memberAccessExpression = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 1340var usingStatement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().Single(); 1375var usingStatement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().Single(); 1852var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 1864var usingStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().ToList(); 1880var usingStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().ToList(); 1893var usingStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().ToList();
Semantics\Utf8StringsLiteralsTests.cs (14)
2969var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 2997var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3025var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3053var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3081var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3109var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3137var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3165var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3193var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3221var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3249var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3277var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3305var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 4063foreach (var node in tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(b => b.IsKind(SyntaxKind.AddExpression)))
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (367)
Compilation\GetSemanticInfoBrokenCodeTests.cs (14)
31VisitAllExpressions(model, tree.GetCompilationUnitRoot()); 109foreach (var expr in GetAllExpressions(tree.GetCompilationUnitRoot())) 134VisitAllExpressions(model, tree.GetCompilationUnitRoot()); 161foreach (var stmt in GetAllStatements(tree.GetCompilationUnitRoot())) 200Assert.Empty(tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingDirectiveSyntax>()); 202foreach (var identifierSyntax in tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>()) 224var usingSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().Single(); 245var typeOfSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single(); 267var literalSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 300var identifierSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(n => n.Identifier.ValueText == "CompletionItem"); 317VisitAllExpressions(model, tree.GetCompilationUnitRoot()); 332VisitAllExpressions(model, tree.GetCompilationUnitRoot()); 347VisitAllExpressions(model, tree.GetCompilationUnitRoot()); 362foreach (var expr in GetAllExpressions(tree.GetCompilationUnitRoot()))
Compilation\GetSemanticInfoTests.cs (24)
242var testClass = tree.GetCompilationUnitRoot().Members[1] as TypeDeclarationSyntax; 296var c = (TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]; 374var testClass = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 477var testClass = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 530var testClass = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 973var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 997var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 1133var root = tree.GetCompilationUnitRoot(); 1674var varIdentifier = (IdentifierNameSyntax)tree.GetCompilationUnitRoot().DescendantNodes().First(n => n.ToString() == "var"); 2356var lambdaSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(); 3607var literal = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 3632var literal = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 3665var literal = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 3701var literal = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 4106var localDecls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclarationSyntax>(); 4161var localDecls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclarationSyntax>(); 4212var syntax = tree.GetCompilationUnitRoot().FindToken(position).Parent.DescendantNodesAndSelf().OfType<OmittedTypeArgumentSyntax>().Single(); 4242var syntax = tree.GetCompilationUnitRoot().FindToken(position).Parent.DescendantNodesAndSelf().OfType<OmittedTypeArgumentSyntax>().Single(); 4272var syntax = tree.GetCompilationUnitRoot().FindToken(position).Parent.DescendantNodesAndSelf().OfType<GenericNameSyntax>().Single(); 4292var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<OmittedTypeArgumentSyntax>().Single(); 4355var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Last(id => id.Identifier.ValueText == "b"); 4400var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Last(); 5402var root = tree.GetCompilationUnitRoot(); 5913var tokens = tree.GetCompilationUnitRoot().DescendantTokens();
Compilation\ReferenceManagerTests.cs (3)
894var rd1 = t1.GetCompilationUnitRoot().GetReferenceDirectives().Single(); 895var rd2 = t2.GetCompilationUnitRoot().GetReferenceDirectives().Single(); 896var rd3 = t3.GetCompilationUnitRoot().GetReferenceDirectives().Single();
Compilation\SemanticModelAPITests.cs (95)
136var root = tree.GetCompilationUnitRoot(); 174var root = tree.GetCompilationUnitRoot(); 201var root = tree.GetCompilationUnitRoot(); 233var root = tree.GetCompilationUnitRoot(); 256var vardecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 276var vardecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 295var vardecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<QueryClauseSyntax>().First(); 315var vardecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<QueryClauseSyntax>().First(); 334var statement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<GotoStatementSyntax>().First(); 353var paramdecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 375var paramdecl1 = tree1.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 377var paramdecl2 = tree2.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 404var nsArray = tree.GetCompilationUnitRoot().DescendantNodes().Where(node => node.IsKind(SyntaxKind.NamespaceDeclaration)).ToArray(); 425var nsArray = tree.GetCompilationUnitRoot().DescendantNodes().Where(node => node.IsKind(SyntaxKind.FileScopedNamespaceDeclaration)).ToArray(); 533var bdecl = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 559var cdecl = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 585var cdecl = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 608var bdecl = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 642var classProgram = tree2.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 673var decl = tree1.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 701var decl = tree1.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 724var bdecl = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 750var adecl = tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 782var root = tree.GetCompilationUnitRoot(); 817var root = tree.GetCompilationUnitRoot(); 871var pType01 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().First(); 872var pType02 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Last(); 880var pMethod01 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 881var pMethod02 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last(); 898var pParam01 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 899var pParam02 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Last(); 924var root = tree.GetCompilationUnitRoot(); 964var root1 = tree1.GetCompilationUnitRoot(); 965var root2 = tree1.GetCompilationUnitRoot(); 966var para1 = tree1.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 967var para2 = tree2.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 1005var root1 = tree1.GetCompilationUnitRoot(); 1006var root2 = tree1.GetCompilationUnitRoot(); 1007var para1 = tree1.GetCompilationUnitRoot().DescendantNodes().OfType<TypeParameterSyntax>().First(); 1008var para2 = tree2.GetCompilationUnitRoot().DescendantNodes().OfType<TypeParameterSyntax>().First(); 1041var anonProps = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>(); 1072var anonProps = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>(); 1113var anonProps = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>(); 1157var anonProps = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>(); 1193var descendants = tree.GetCompilationUnitRoot().DescendantNodes(); 1232var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single(); 1265var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single(); 1278var aliasQualifiedSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AliasQualifiedNameSyntax>().Single(); 1306var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single(); 1311var aliasQualifiedSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AliasQualifiedNameSyntax>().Single(); 1338var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<NameEqualsSyntax>().Single().Name; 1341var usingSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single(); 1361var oldSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 1390var oldSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 1408var root = tree.GetCompilationUnitRoot(); 1452var root = tree.GetCompilationUnitRoot(); 1498var root = tree.GetCompilationUnitRoot(); 1547var root = tree.GetCompilationUnitRoot(); 1586var root = tree.GetCompilationUnitRoot(); 1626var root = tree.GetCompilationUnitRoot(); 1644var root = tree.GetCompilationUnitRoot(); 1662var root = tree.GetCompilationUnitRoot(); 1775var root = tree.GetCompilationUnitRoot(); 1826var root = tree.GetCompilationUnitRoot(); 1876var root = tree.GetCompilationUnitRoot(); 1915var root = tree.GetCompilationUnitRoot(); 1952var root = tree.GetCompilationUnitRoot(); 1989var root = tree.GetCompilationUnitRoot(); 2025var root = tree.GetCompilationUnitRoot(); 2072var oldSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 2141var oldSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 2168var root = tree.GetCompilationUnitRoot(); 2213var root = tree.GetCompilationUnitRoot(); 2255var root = tree.GetCompilationUnitRoot(); 2347var root = tree.GetCompilationUnitRoot(); 2442var root = tree.GetCompilationUnitRoot(); 2484var root = tree.GetCompilationUnitRoot(); 2529var root = tree.GetCompilationUnitRoot(); 2560var root = tree.GetCompilationUnitRoot(); 2632var root = tree.GetCompilationUnitRoot(); 2669var root = tree.GetCompilationUnitRoot(); 2760var root = tree.GetCompilationUnitRoot(); 2796var root = tree.GetCompilationUnitRoot(); 2811var root = tree.GetCompilationUnitRoot(); 2830var root = tree.GetCompilationUnitRoot(); 2860var root = tree.GetCompilationUnitRoot(); 2890var root = tree.GetCompilationUnitRoot(); 2919var root = tree.GetCompilationUnitRoot(); 2959var root = tree.GetCompilationUnitRoot(); 3004var root = tree.GetCompilationUnitRoot(); 3085var root = tree.GetCompilationUnitRoot(); 3610var root = tree.GetCompilationUnitRoot(); 4475var root = tree.GetCompilationUnitRoot(); 4539var root = tree.GetCompilationUnitRoot(); 4642GetExpressionSyntax(tree.GetCompilationUnitRoot(), exprSynList);
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (158)
37var root = tree.GetCompilationUnitRoot(); 59var root = tree.GetCompilationUnitRoot(); 78var root = tree.GetCompilationUnitRoot(); 103var root = tree.GetCompilationUnitRoot(); 123var root = tree.GetCompilationUnitRoot(); 146var root = tree.GetCompilationUnitRoot(); 168var root = tree.GetCompilationUnitRoot(); 188var root = tree.GetCompilationUnitRoot(); 209var root = tree.GetCompilationUnitRoot(); 232var root = tree.GetCompilationUnitRoot(); 256var root = tree.GetCompilationUnitRoot(); 276var root = tree.GetCompilationUnitRoot(); 299var root = tree.GetCompilationUnitRoot(); 332var root = tree.GetCompilationUnitRoot(); 379var root = tree.GetCompilationUnitRoot(); 405var root = tree.GetCompilationUnitRoot(); 428var root = tree.GetCompilationUnitRoot(); 429var node = root.FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("public event D Iter3", StringComparison.Ordinal)).Parent as BasePropertyDeclarationSyntax; 450var root = tree.GetCompilationUnitRoot(); 472var root = tree.GetCompilationUnitRoot(); 497var root = tree.GetCompilationUnitRoot(); 519var root = tree.GetCompilationUnitRoot(); 541var root = tree.GetCompilationUnitRoot(); 566var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 588var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 775var fieldDecl = (FieldDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 797var fieldDecl = (FieldDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 821var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 837var delegateDecl = (DelegateDeclarationSyntax)(tree.GetCompilationUnitRoot().Members[0]); 857var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 881var typeDecl = (TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]; 901var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 938var root = tree.GetCompilationUnitRoot(); 1004var root = tree.GetCompilationUnitRoot(); 1053var namespaceDecl = (BaseNamespaceDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]; 1081var cu = tree.GetCompilationUnitRoot(); 1124var cu = tree.GetCompilationUnitRoot(); 1171var cu = tree.GetCompilationUnitRoot(); 1210var cu = tree.GetCompilationUnitRoot(); 1246var cu = tree.GetCompilationUnitRoot(); 1280var cu = tree.GetCompilationUnitRoot(); 1330var cu = tree.GetCompilationUnitRoot(); 1380var cu = tree.GetCompilationUnitRoot(); 1433var cu = tree.GetCompilationUnitRoot(); 1481var cu = tree.GetCompilationUnitRoot(); 1529var cu = tree.GetCompilationUnitRoot(); 1593var cu = tree.GetCompilationUnitRoot(); 1627var cu = tree.GetCompilationUnitRoot(); 1665var cu = tree.GetCompilationUnitRoot(); 1709var cu = tree.GetCompilationUnitRoot(); 1813var cu = tree.GetCompilationUnitRoot(); 1869var cu = tree.GetCompilationUnitRoot(); 2006var cu = tree.GetCompilationUnitRoot(); 2050var cu = tree.GetCompilationUnitRoot(); 2250var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2286var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2323var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2359var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2395var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2425var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2457var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2494var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2531var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2562var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[1]; 2591var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[1]; 2616var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2641var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2671var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2699var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 2783var root = tree.GetCompilationUnitRoot(); 2810var root = tree.GetCompilationUnitRoot(); 2842var root = tree.GetCompilationUnitRoot(); 2904var root = tree.GetCompilationUnitRoot(); 2934var root = tree.GetCompilationUnitRoot(); 2966var root = tree.GetCompilationUnitRoot(); 3015var root = tree.GetCompilationUnitRoot(); 3042var root = tree.GetCompilationUnitRoot(); 3072var root = tree.GetCompilationUnitRoot(); 3108var root = tree.GetCompilationUnitRoot(); 3138var root = tree.GetCompilationUnitRoot(); 3177var accessorDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 3211var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[2]).Members[0]; 3234var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 3265var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 3311var root = tree.GetCompilationUnitRoot(); 3314var paramNode = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("param1", StringComparison.Ordinal)).Parent; 3340var root = tree.GetCompilationUnitRoot(); 3366var root = tree.GetCompilationUnitRoot(); 3381var root = tree.GetCompilationUnitRoot(); 3405var root = tree.GetCompilationUnitRoot(); 3408var foreachNode = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("foreach", StringComparison.Ordinal)).Parent; 3426var root = tree.GetCompilationUnitRoot(); 3429var delegateNode = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("delegate", StringComparison.Ordinal)).Parent; 3445var root = tree.GetCompilationUnitRoot(); 3448var usingNode = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("using", StringComparison.Ordinal)).Parent; 3477var foreachNode = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("aaa", StringComparison.Ordinal)).Parent; 3501var foreachNode = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("aaa", StringComparison.Ordinal)).Parent; 3528var foreachNode1 = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("aaa", StringComparison.Ordinal)).Parent; 3534var foreachNode2 = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("bbb", StringComparison.Ordinal)).Parent; 3565var catchDeclaration = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("aaa", StringComparison.Ordinal)).Parent; 3586var methodDecl = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("Goo", StringComparison.Ordinal)).Parent; 3611var methodDecl = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("Goo", StringComparison.Ordinal)).Parent; 3633var cu = tree.GetCompilationUnitRoot(); 3668dynamic methodDecl = (MethodDeclarationSyntax)tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf("Main", StringComparison.Ordinal)).Parent; 3686var globalStmt = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToFullString().IndexOf('/')).Parent.AncestorsAndSelf().Single(x => x.IsKind(SyntaxKind.GlobalStatement)); 3709var methodDecl = (MethodDeclarationSyntax)((TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]).Members[0]; 3737var root = tree.GetCompilationUnitRoot(); 3749var root2 = tree.GetCompilationUnitRoot(); 3847var queryExpr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedExpressionSyntax>().First(); 3866var node = (IdentifierNameSyntax)tree.GetCompilationUnitRoot().DescendantTokens().Where(t => t.ToString() == "Alias").Last().Parent; 3901var param = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.Identifier.ValueText == "name").First(); 3922var usingDirectives = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3966var attr = (AttributeSyntax)((ClassDeclarationSyntax)((CompilationUnitSyntax)tree2.GetCompilationUnitRoot()).Members[0]).AttributeLists[0].Attributes[0]; 3999var typeofSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single(); 4127var call = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 4145call = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 4415var lambda = (SimpleLambdaExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().First(x => x is SimpleLambdaExpressionSyntax); 4440var conversionDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConversionOperatorDeclarationSyntax>().Single(); 4471var conversionDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConversionOperatorDeclarationSyntax>().Single(); 4502var operatorDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<OperatorDeclarationSyntax>().Single(); 4604var node = (DefaultExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Where(i => i is DefaultExpressionSyntax).First(); 4691var decl = (ClassDeclarationSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.ClassDeclaration)); 4706var decl = (ClassDeclarationSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.ClassDeclaration)); 4721var decl = (ClassDeclarationSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.ClassDeclaration)); 4741var enumDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<EnumDeclarationSyntax>().Single(); 4742var eventDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<EventDeclarationSyntax>().Single(); 4769var structDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<StructDeclarationSyntax>().First(); 4770var interfaceDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InterfaceDeclarationSyntax>().Last(); 4799var decl = (TupleExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression)); 4822var decl = (TupleExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression)); 4845var decl = (TupleExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression)); 4868var decl = (TupleExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression)); 4891var decl = (TupleExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.TupleExpression)); 4914var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 4937var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 4960var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 4995var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 5041var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 5090var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 5113var decl = (ArgumentSyntax)tree.GetCompilationUnitRoot().DescendantNodes().Last(n => n.IsKind(SyntaxKind.Argument)); 5126var root = tree.GetCompilationUnitRoot(); 5175var cu = tree.GetCompilationUnitRoot(); 5224var decls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().ToArray(); 5245var decls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().ToArray(); 5266var decls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().ToArray();
Compilation\SemanticModelGetSemanticInfoTests.cs (3)
14484var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<OmittedArraySizeExpressionSyntax>().Last(); 14656var argumentSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Single(); 15434var syntax = tree.GetCompilationUnitRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.ThisExpression);
DeclarationTests.cs (1)
419_root = CloneNodeAsRoot(_underlyingTree.GetCompilationUnitRoot(CancellationToken.None));
DocumentationComments\CrefTests.cs (1)
6618var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
DocumentationComments\DocumentationCommentCompilerTests.cs (3)
1664var revisedSource = new DocumentationCommentAdder().Visit(Parse(source).GetCompilationUnitRoot()).ToFullString(); 1848var revisedSource = new DocumentationCommentAdder().Visit(Parse(source).GetCompilationUnitRoot()).ToFullString(); 2217var revisedSource = new DocumentationCommentAdder().Visit(Parse(source).GetCompilationUnitRoot()).ToFullString();
DocumentationComments\DocumentationCommentIDTests.cs (4)
31var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single(); 144var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<GotoStatementSyntax>().Single().Expression; 165var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 309var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<FromClauseSyntax>().Single();
DocumentationComments\ParameterTests.cs (1)
856var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>();
SymbolDisplay\SymbolDisplayTests.cs (2)
5754var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 5764methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Symbols\AnonymousTypesSemanticsTests.cs (1)
1967stack.Push(tree.GetCompilationUnitRoot());
Symbols\AnonymousTypesSymbolTests.cs (1)
1640var expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectCreationExpressionSyntax>().Single();
Symbols\AssemblyAndNamespaceTests.cs (1)
331var root = tree.GetCompilationUnitRoot();
Symbols\CompilationCreationTests.cs (1)
55var types = expectedSyntaxTrees.Select(tree => compilation.GetSemanticModel(tree).GetDeclaredSymbol(tree.GetCompilationUnitRoot().Members.Single())).ToArray();
Symbols\ConversionTests.cs (3)
391var variableDeclarator = (VariableDeclaratorSyntax)tree.GetCompilationUnitRoot() 398var sourceExpression1 = (ExpressionSyntax)tree.GetCompilationUnitRoot() 404var sourceExpression2 = (ExpressionSyntax)tree.GetCompilationUnitRoot()
Symbols\DestructorTests.cs (2)
407var destructorDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DestructorDeclarationSyntax>().Single(); 413var finalizeSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single().Name;
Symbols\ExtensionMethodTests.cs (7)
227syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single()).Symbol; 2437var expr = ((ExpressionStatementSyntax)((GlobalStatementSyntax)tree.GetCompilationUnitRoot().Members[0]).Statement).Expression; 2733var node = tree.GetCompilationUnitRoot().FindToken(code.IndexOf("GetHashCode", StringComparison.Ordinal)).Parent; 2743node = tree.GetCompilationUnitRoot().FindToken(code.IndexOf("Cast<T1>", StringComparison.Ordinal)).Parent; 2958var memberAccess = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 3016var memberAccess = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 3145var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToList();
Symbols\ImplicitClassTests.cs (3)
73IEnumerable<IdentifierNameSyntax> identifiers = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>(); 116var namespaceDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<NamespaceDeclarationSyntax>().Single(); 117var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
Symbols\IndexerTests.cs (5)
1288var indexerAccessSyntax = GetElementAccessExpressions(tree.GetCompilationUnitRoot()).Single(); 2530var actual = GetElementAccessExpressions(tree.GetCompilationUnitRoot()).Select(syntax => model.GetSymbolInfo(syntax).Symbol.ToTestDisplayString()); 2614var elementAccessSyntaxes = GetElementAccessExpressions(tree.GetCompilationUnitRoot()); 2701var elementAccessSyntaxes = GetElementAccessExpressions(tree.GetCompilationUnitRoot()); 2843ExpressionSyntax expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().FirstOrDefault();
Symbols\LocalFunctionTests.cs (4)
34var localSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 55var localSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 76var localSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 99var localsSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray();
Symbols\MethodEqualityTests.cs (1)
208var root = tree.GetCompilationUnitRoot();
Symbols\Source\BaseClassTests.cs (2)
271var classA = (TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]; 308var classA = (TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0];
Symbols\Source\DeclaringSyntaxNodeTests.cs (5)
155var node = tree.GetCompilationUnitRoot().FindToken(position).Parent.FirstAncestorOrSelf<TNode>(); 263var declaratorA1 = tree.GetCompilationUnitRoot().FindToken(posA1).Parent.FirstAncestorOrSelf<VariableDeclaratorSyntax>(); 307var declaratorQ = tree.GetCompilationUnitRoot().FindToken(posQ).Parent.FirstAncestorOrSelf<VariableDeclaratorSyntax>(); 314var declaratorX = tree.GetCompilationUnitRoot().FindToken(posX).Parent.FirstAncestorOrSelf<VariableDeclaratorSyntax>(); 321var declaratorZ = tree.GetCompilationUnitRoot().FindToken(posZ).Parent.FirstAncestorOrSelf<VariableDeclaratorSyntax>();
Symbols\Source\DelegateTests.cs (2)
828ExpressionSyntax lambdaSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 835lambdaSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single();
Symbols\Source\EnumTests.cs (1)
979var decls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<EnumDeclarationSyntax>().ToArray();
Symbols\Source\ExternAliasTests.cs (3)
350var root = tree.GetCompilationUnitRoot() as CompilationUnitSyntax; 408var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single(); 434var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single();
Symbols\Source\UsingAliasTests.cs (15)
30var root = tree.GetCompilationUnitRoot(); 87var root = tree.GetCompilationUnitRoot(); 147var root = tree.GetCompilationUnitRoot(); 202var root = tree.GetCompilationUnitRoot(); 267var root = tree.GetCompilationUnitRoot(); 294var root = tree.GetCompilationUnitRoot(); 340var root = tree.GetCompilationUnitRoot(); 381var root = tree.GetCompilationUnitRoot(); 402var root = tree.GetCompilationUnitRoot(); 421var root = tree.GetCompilationUnitRoot(); 440var root = tree.GetCompilationUnitRoot(); 459var root = tree.GetCompilationUnitRoot(); 478var root = tree.GetCompilationUnitRoot(); 499var root = tree.GetCompilationUnitRoot(); 522UsingDirectiveSyntax usingAlias = syntaxTree.GetCompilationUnitRoot().Usings.First();
Symbols\TypeTests.cs (1)
1851var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (709)
Diagnostics\LocationsTests.cs (1)
455var token = syntaxTree.GetCompilationUnitRoot().FindToken(sampleProgram.IndexOf("ct", StringComparison.Ordinal));
IncrementalParsing\BinaryExpression.cs (3)
31var type = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 207TypeDeclarationSyntax classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 216var statementType = newTree.GetCompilationUnitRoot().Members[0] as GlobalStatementSyntax;
IncrementalParsing\ChangingIdentifiers.cs (2)
274TypeDeclarationSyntax classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 282var method = newTree.GetCompilationUnitRoot().Members[0] as MethodDeclarationSyntax;
IncrementalParsing\CompoundAssignment.cs (2)
146var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 156var statementType = newTree.GetCompilationUnitRoot().Members[0] as GlobalStatementSyntax;
IncrementalParsing\GrammarAmbiguities.cs (3)
91Assert.False(originalTree.GetCompilationUnitRoot().ContainsDiagnostics); 95dynamic r = incrementalTree.GetCompilationUnitRoot(); 103var incrementalRoot = syntaxTree.GetCompilationUnitRoot();
IncrementalParsing\IncrementalParsingTests.cs (135)
50Assert.Equal(0, oldTree.GetCompilationUnitRoot().Errors().Length); 51Assert.Equal(0, newTree.GetCompilationUnitRoot().Errors().Length); 98Assert.Equal(0, oldTree.GetCompilationUnitRoot().Errors().Length); 99Assert.Equal(0, newTree.GetCompilationUnitRoot().Errors().Length); 134Assert.Equal(0, oldTree.GetCompilationUnitRoot().Errors().Length); 135Assert.Equal(0, newTree.GetCompilationUnitRoot().Errors().Length); 151Assert.Equal(0, oldTree.GetCompilationUnitRoot().Errors().Length); 152Assert.Equal(0, newTree.GetCompilationUnitRoot().Errors().Length); 167Assert.Equal(0, oldTree.GetCompilationUnitRoot().Errors().Length); 168Assert.Equal(0, newTree.GetCompilationUnitRoot().Errors().Length); 185Assert.Equal(0, oldTree.GetCompilationUnitRoot().Errors().Length); 186Assert.Equal(0, newTree.GetCompilationUnitRoot().Errors().Length); 203Assert.Equal(0, oldTree.GetCompilationUnitRoot().Errors().Length); 204Assert.Equal(0, newTree.GetCompilationUnitRoot().Errors().Length); 219Assert.Equal(0, oldTree.GetCompilationUnitRoot().Errors().Length); 220Assert.Equal(0, newTree.GetCompilationUnitRoot().Errors().Length); 241Assert.Equal(0, oldTree.GetCompilationUnitRoot().Errors().Length); 242Assert.Equal(0, newTree.GetCompilationUnitRoot().Errors().Length); 263Assert.Equal(0, oldTree.GetCompilationUnitRoot().Errors().Length); 264Assert.Equal(0, newTree.GetCompilationUnitRoot().Errors().Length); 287Assert.Equal(0, oldTree.GetCompilationUnitRoot().Errors().Length); 288Assert.Equal(0, newTree.GetCompilationUnitRoot().Errors().Length); 312Assert.Equal(0, oldTree.GetCompilationUnitRoot().Errors().Length); 313Assert.Equal(0, newTree.GetCompilationUnitRoot().Errors().Length); 331Assert.Equal(0, oldTree.GetCompilationUnitRoot().Errors().Length); 332Assert.Equal(0, newTree.GetCompilationUnitRoot().Errors().Length); 354Assert.Equal(0, oldTree.GetCompilationUnitRoot().Errors().Length); 355var oldDirectives = oldTree.GetCompilationUnitRoot().GetDirectives(); 363var errors = newTree.GetCompilationUnitRoot().Errors(); 367var newDirectives = newTree.GetCompilationUnitRoot().GetDirectives(); 397var errors = oldTree.GetCompilationUnitRoot().Errors(); 401var oldDirectives = oldTree.GetCompilationUnitRoot().GetDirectives(); 408errors = newTree.GetCompilationUnitRoot().Errors(); 410var newDirectives = newTree.GetCompilationUnitRoot().GetDirectives(); 540var fullText = newTree.GetCompilationUnitRoot().ToFullString(); 588var finalString = startTree.GetCompilationUnitRoot().ToFullString(); 592var finalText = newTree.GetCompilationUnitRoot().ToFullString(); 602var finalString = startTree.GetCompilationUnitRoot().ToFullString(); 606var output = newTree.GetCompilationUnitRoot().ToFullString(); 816Assert.Equal(0, syntaxTree.GetCompilationUnitRoot().Errors().Length); 836Assert.Equal(0, syntaxTree.GetCompilationUnitRoot().Errors().Length); 855Assert.Equal(0, syntaxTree.GetCompilationUnitRoot().Errors().Length); 1149Assert.Equal(parsedTree.GetCompilationUnitRoot().ToFullString(), incrementalTree.GetCompilationUnitRoot().ToFullString()); 1289Assert.Equal(parsedTree.GetCompilationUnitRoot().ChildNodesAndTokens().Count, incrementalTree.GetCompilationUnitRoot().ChildNodesAndTokens().Count); 1292for (int i = 0; i < parsedTree.GetCompilationUnitRoot().ChildNodesAndTokens().Count; i++) 1294Assert.Equal(parsedTree.GetCompilationUnitRoot().ChildNodesAndTokens()[i].Kind(), incrementalTree.GetCompilationUnitRoot().ChildNodesAndTokens()[i].Kind()); 1613Assert.Equal(parsedTree.GetCompilationUnitRoot().ChildNodesAndTokens()[0].AsNode().ToFullString(), incrementalTree.GetCompilationUnitRoot().ChildNodesAndTokens()[0].AsNode().ToFullString()); 1719Assert.Equal(parsedTree.GetCompilationUnitRoot().ToFullString(), incrementalTree.GetCompilationUnitRoot().ToFullString()); 2068CompareTreeEquivalence(parsedTree.GetCompilationUnitRoot(), incrementalTree.GetCompilationUnitRoot()); 2100CompareTreeEquivalence(parsedTree.GetCompilationUnitRoot(), incrementalTree.GetCompilationUnitRoot()); 2133CompareTreeEquivalence(parsedTree.GetCompilationUnitRoot(), incrementalTree.GetCompilationUnitRoot()); 2184CompareTreeEquivalence(parsedTree.GetCompilationUnitRoot(), incrementalTree.GetCompilationUnitRoot()); 2214CompareTreeEquivalence(parsedTree.GetCompilationUnitRoot(), incrementalTree.GetCompilationUnitRoot()); 2243CompareTreeEquivalence(parsedTree.GetCompilationUnitRoot(), incrementalTree.GetCompilationUnitRoot()); 2347CompareTreeEquivalence(parsedTree.GetCompilationUnitRoot(), incrementalTree.GetCompilationUnitRoot()); 2380CompareTreeEquivalence(parsedTree.GetCompilationUnitRoot(), reparsedTree.GetCompilationUnitRoot()); 2394Assert.Equal(oldText.ToString(), startTree.GetCompilationUnitRoot().ToFullString()); 2501var parsedTree = this.Parse(changedTree.GetCompilationUnitRoot().ToFullString()); 2504parsedTree.GetCompilationUnitRoot().EndOfFileToken.FullSpan, 2505changedTree.GetCompilationUnitRoot().EndOfFileToken.FullSpan); 2532var fullText = fullTree.GetCompilationUnitRoot().ToFullString(); 2533var incText = newTree.GetCompilationUnitRoot().ToFullString(); 2546fullText = fullTree.GetCompilationUnitRoot().ToFullString(); 2547incText = newTree.GetCompilationUnitRoot().ToFullString(); 2617int incCount = currTree.GetCompilationUnitRoot().ChildNodesAndTokens().Count; 2618int fullCount = fullTree.GetCompilationUnitRoot().ChildNodesAndTokens().Count; 2620WalkTreeAndVerify(currTree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 2653WalkTreeAndVerify(currTree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 2665tree.GetCompilationUnitRoot().Members.First().Green; 2746Assert.Equal(0, oldTree.GetCompilationUnitRoot().Errors().Length); 2747Assert.Equal(0, newTree.GetCompilationUnitRoot().Errors().Length); 2808WalkTreeAndVerify(newTree.GetCompilationUnitRoot(), SyntaxFactory.ParseSyntaxTree(newText).GetCompilationUnitRoot()); 2828WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 2849WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 2870WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 2891WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 2912WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 2934WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 2958WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 2982WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3006WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3030WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3054WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3080WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3105WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3131WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3157WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3175WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3193WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3211WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3225WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3239WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3254WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3291WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot()); 3342ParentChecker.CheckParents(parsedTree.GetCompilationUnitRoot(), parsedTree); 3343ParentChecker.CheckParents(incrementalTree.GetCompilationUnitRoot(), incrementalTree); 3351Assert.Equal(oldText.ToString(), startTree.GetCompilationUnitRoot().ToFullString());
IncrementalParsing\SyntaxDifferences.cs (2)
26GatherNodes(oldTree.GetCompilationUnitRoot(), hashSet); 29GetRebuiltNodes(newTree.GetCompilationUnitRoot(), hashSet, nodes);
IncrementalParsing\TypeChanges.cs (8)
32var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 47var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 62var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 77var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 92var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 108var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 124var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 140var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax;
IncrementalParsing\UnaryExpression.cs (2)
89var classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax; 99var statementType = newTree.GetCompilationUnitRoot().Members[0] as GlobalStatementSyntax;
LexicalAndXml\PreprocessorTests.cs (7)
94return SyntaxFactory.ParseSyntaxTree(itext, options).GetCompilationUnitRoot(); 3214TestRoundTripping(tree.GetCompilationUnitRoot(), text, false); 3551TestRoundTripping(tree.GetCompilationUnitRoot(), text, false); 3554VerifyErrorCode(tree.GetCompilationUnitRoot(), (int)ErrorCode.ERR_InvalidMemberDecl); // CS1519 - parser gives Two 3555VerifyDirectivesSpecial(tree.GetCompilationUnitRoot(), new DirectiveInfo { Kind = SyntaxKind.LineDirectiveTrivia, Status = NodeStatus.IsActive, Number = 100, Text = "test.cs" }); 3880var node = tree.GetCompilationUnitRoot(); 4562var root = tree.GetCompilationUnitRoot();
LexicalAndXml\XmlDocCommentTests.cs (310)
77Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 78Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 79var leading = tree.GetCompilationUnitRoot().EndOfFileToken.LeadingTrivia; 97Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 98Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 99var leading = tree.GetCompilationUnitRoot().EndOfFileToken.LeadingTrivia; 114Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 115Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 116var leading = tree.GetCompilationUnitRoot().EndOfFileToken.LeadingTrivia; 129Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 130Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 131var leading = tree.GetCompilationUnitRoot().EndOfFileToken.LeadingTrivia; 145Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 146Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 147Assert.Equal(SyntaxKind.ClassDeclaration, tree.GetCompilationUnitRoot().Members[0].Kind()); 148var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 167Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 168Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 169var leading = tree.GetCompilationUnitRoot().EndOfFileToken.LeadingTrivia; 191Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 192Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 193Assert.Equal(SyntaxKind.ClassDeclaration, tree.GetCompilationUnitRoot().Members[0].Kind()); 194var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 214Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 215Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 216var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 237Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 238Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 239var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 260Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 261Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 262var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 287Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 288Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 289var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 315Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 316Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 317var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 339Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 340Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 341var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 364Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 365Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 366var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 390Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 391Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 392var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 417Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 418Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 419var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 444Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 445Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 446var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 472Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 473Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 474var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 501Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 502Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 503var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 531Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 532Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 533var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 560Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 561Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 562var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 590Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 591Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 592var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 621Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 622Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 623var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 644Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 645Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 646var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 666Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 667Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 668var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 688Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 689Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 690var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 710Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 711Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 712var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 732Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 733Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 734var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 752Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 753Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 754var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 786Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 787Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 788var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 819Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 820Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 821var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 850Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 851Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 852var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 878Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 879Assert.Equal(1, tree.GetCompilationUnitRoot().Warnings().Length); 880var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 903Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 904Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 905var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 929Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 930Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 931var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 954Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 955Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 956var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 981Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 982Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 983var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1012Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1013Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1014var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1040Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1041Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1042var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1065Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1066Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1067var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 1090Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1091Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1092var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1117Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1118Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1119var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1150Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1151Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1152var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1181Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1182Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1183var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1207Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1208Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1209var leading = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); 1234Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1235Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1236var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1262Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1263Assert.Equal(1, tree.GetCompilationUnitRoot().Errors().Length); 1264var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1287Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1288Assert.Equal(2, tree.GetCompilationUnitRoot().ChildNodesAndTokens().Count); 1289Assert.Equal(SyntaxKind.ClassDeclaration, tree.GetCompilationUnitRoot().ChildNodesAndTokens()[0].Kind()); 1290var classdecl = (TypeDeclarationSyntax)tree.GetCompilationUnitRoot().ChildNodesAndTokens()[0].AsNode(); 1297Assert.Equal(SyntaxKind.EndOfFileToken, tree.GetCompilationUnitRoot().ChildNodesAndTokens()[1].Kind()); 1307Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1308Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1309var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1331Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1332Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1333var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1356Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1357Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1358var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1380Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1381Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1382var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1405Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1406Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1407var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1429Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1430Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1431var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1454Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1455Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1456var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1478Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1479Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1480var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1503Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1504Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1514Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1515Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1525Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1526Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1536Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1537Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1547Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1548Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1558Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1559Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1560var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1586Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1587Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1588var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1614Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1615Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 1616var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1640Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1641Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1642var leading = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1671Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1674Assert.Equal(1, tree.GetCompilationUnitRoot().Warnings().Length); 1677VerifyDiagnostics(tree.GetCompilationUnitRoot(), new List<TestError>() { new TestError(1570, true) }); 1688Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1691Assert.Equal(1, tree.GetCompilationUnitRoot().Warnings().Length); 1694VerifyDiagnostics(tree.GetCompilationUnitRoot(), new List<TestError>() { new TestError(1570, true) }); 1707Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1708Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1711var trivias = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1746Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1747Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1750var trivias = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1786Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1789Assert.Equal(1, tree.GetCompilationUnitRoot().Warnings().Length); 1792var trivias = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia(); 1827Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1828Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1831Assert.Equal(typeof(MethodDeclarationSyntax), (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0].GetType()); 1833var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType; 1862Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1863Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1866Assert.Equal(typeof(MethodDeclarationSyntax), (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0].GetType()); 1868var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType; 1897Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1898Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1901Assert.Equal(typeof(PropertyDeclarationSyntax), (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0].GetType()); 1903var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as PropertyDeclarationSyntax).Type; 1932Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1933Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1936Assert.Equal(typeof(IndexerDeclarationSyntax), (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0].GetType()); 1938var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as IndexerDeclarationSyntax).Type; 1967Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1968Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 1971Assert.Equal(typeof(MethodDeclarationSyntax), (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0].GetType()); 1974var method = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax; 2004Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2005Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 2008Assert.Equal(typeof(ClassDeclarationSyntax), tree.GetCompilationUnitRoot().Members[0].GetType()); 2011var typeParameter = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).TypeParameterList.Parameters.Single(); 2042Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2043Assert.Equal(1, tree.GetCompilationUnitRoot().Errors().Length); // 4 errors because of the incomplete class decl 2046Assert.Equal(typeof(MethodDeclarationSyntax), (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0].GetType()); 2048var keyword = ((tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Members[0] as MethodDeclarationSyntax).ReturnType; 2078Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2079Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 2081var bracket = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).CloseBraceToken; 2109Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2110Assert.Equal(1, tree.GetCompilationUnitRoot().Errors().Length); // error because of the incomplete class decl 2113var classDecl = (TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]; 2142Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2143Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); // 4 errors because of the incomplete class decl 2146var bracket = tree.GetCompilationUnitRoot().EndOfFileToken; 2172Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2173Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); // 4 errors because of the incomplete class decl 2176var bracket = tree.GetCompilationUnitRoot().EndOfFileToken; 2203Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2204Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 2207var bracket = tree.GetCompilationUnitRoot().EndOfFileToken; 2238Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2241Assert.Equal(1, tree.GetCompilationUnitRoot().Errors().Length); 2242VerifyDiagnostics(tree.GetCompilationUnitRoot(), new List<TestError>() { new TestError(1035, false) }); 2253Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2254Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 2256var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2281Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2282Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 2285var eofToken = tree.GetCompilationUnitRoot().EndOfFileToken; 2323Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2324Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 2326var eofToken = tree.GetCompilationUnitRoot().EndOfFileToken; 2355Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2358Assert.Equal(1, tree.GetCompilationUnitRoot().Warnings().Length); 2361var eofToken = tree.GetCompilationUnitRoot().EndOfFileToken; 2379Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2380Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 2383var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2409Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2410Assert.Equal(1, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 2413var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2438Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2440var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2461Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2464Assert.Equal(1, tree.GetCompilationUnitRoot().Warnings().Length); 2466var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2488Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2491Assert.Equal(2, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 2493var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2513Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2516Assert.Equal(2, tree.GetCompilationUnitRoot().Warnings().Length); 2518var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2538Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2540var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2564Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2566var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2590Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2593Assert.Equal(2, tree.GetCompilationUnitRoot().Warnings().Length); 2605Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2608Assert.Equal(1, tree.GetCompilationUnitRoot().Warnings().Length); 2619Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2622Assert.Equal(2, tree.GetCompilationUnitRoot().Warnings().Length); 2634Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2636var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2652Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2654var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2675Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2676Assert.Equal(0, tree.GetCompilationUnitRoot().Errors().Length); 2693Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2694Assert.Equal(4, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 2695VerifyDiagnostics(tree.GetCompilationUnitRoot(), new List<TestError> 2719Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2720Assert.Equal(4, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 2721VerifyDiagnostics(tree.GetCompilationUnitRoot(), new List<TestError> 2742Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2744var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword; 2766Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 2768var classKeyword = (tree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax).Keyword;
Parsing\LineSpanDirectiveParsingTests.cs (1)
30var node = ParseTree(text, options).GetCompilationUnitRoot();
Parsing\ParserErrorMessageTests.cs (25)
5601tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5604tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5623tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5626tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5688tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5691tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5707tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5710tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5750tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5753tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5785tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5788tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5819tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 5822tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6108tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6126tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6139tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6147tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6168tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6175tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6198tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6211tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6240tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6253tree.GetCompilationUnitRoot().GetDiagnostics().Verify(); 6527tree.GetCompilationUnitRoot().GetDiagnostics().Verify(
Parsing\ParsingErrorRecoveryTests.cs (9)
6606Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString()); 6625Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString()); 6659Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString()); 6684Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString()); 6709Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString()); 6735Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString()); 6759Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString()); 6784Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString()); 6798Assert.Equal(text, syntaxTree.GetCompilationUnitRoot().ToFullString());
Parsing\ParsingTests.cs (2)
87ParseTree(text, options).GetCompilationUnitRoot(); 154_node = tree.GetCompilationUnitRoot();
Parsing\RoundTrippingTests.cs (9)
29var toText = tree.GetCompilationUnitRoot().ToFullString(); 37Assert.NotEqual(0, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 41Assert.Equal(errorCount, tree.GetCompilationUnitRoot().ErrorsAndWarnings().Length); 47Assert.Equal(memberCount, tree.GetCompilationUnitRoot().Members.Count); 50ParentChecker.CheckParents(tree.GetCompilationUnitRoot(), tree); 56var toText = tree.GetCompilationUnitRoot().ToFullString(); 59var nodes = tree.GetCompilationUnitRoot().DescendantTokens(tk => tk.FullWidth > 0).ToList(); 104var toText = tree.GetCompilationUnitRoot().ToFullString(); 1583var newTest = tree.GetCompilationUnitRoot().ToFullString();
Parsing\ScriptParsingTests.cs (11)
36var parsedText = parsedTree.GetCompilationUnitRoot(); 191Assert.True(tree.GetCompilationUnitRoot().ContainsDiagnostics); 233Assert.True(tree.GetCompilationUnitRoot().ContainsDiagnostics); 2644Assert.False(tree.GetCompilationUnitRoot().ContainsDiagnostics); 2676Assert.False(tree.GetCompilationUnitRoot().ContainsDiagnostics); 9615Assert.Equal(1, tree.GetCompilationUnitRoot().ChildNodes().Count()); 9616Assert.Equal(SyntaxKind.GlobalStatement, tree.GetCompilationUnitRoot().ChildNodes().ToList()[0].Kind()); 9638var root = tree.GetCompilationUnitRoot(); 9649root = tree.GetCompilationUnitRoot(); 9665root = tree.GetCompilationUnitRoot(); 9712var root = tree.GetCompilationUnitRoot();
Syntax\SerializationTests.cs (15)
25var root = tree.GetCompilationUnitRoot(); 35Assert.True(droot.IsEquivalentTo(tree.GetCompilationUnitRoot())); 43var root = tree.GetCompilationUnitRoot(); 56Assert.True(droot.IsEquivalentTo(tree.GetCompilationUnitRoot())); 66var root = tree.GetCompilationUnitRoot().WithAdditionalAnnotations(annotation); 81Assert.True(droot.IsEquivalentTo(tree.GetCompilationUnitRoot())); 90var root = tree.GetCompilationUnitRoot().WithAdditionalAnnotations(annotation, annotation); 105Assert.True(droot.IsEquivalentTo(tree.GetCompilationUnitRoot())); 114var root = tree.GetCompilationUnitRoot().WithAdditionalAnnotations(annotation); 129Assert.True(droot.IsEquivalentTo(tree.GetCompilationUnitRoot())); 143var root = tree.GetCompilationUnitRoot().WithAdditionalAnnotations(annotation1); 189var root = tree.GetCompilationUnitRoot().WithAdditionalAnnotations(annotation1, annotation1); 210var root = tree.GetCompilationUnitRoot(); 220Assert.True(newRoot.IsEquivalentTo(tree.GetCompilationUnitRoot())); 279var root = tree.GetCompilationUnitRoot();
Syntax\StructuredTriviaTests.cs (7)
108var compilationUnit = tree.GetCompilationUnitRoot(); 122var compilationUnit = tree.GetCompilationUnitRoot(); 133var compilationUnit = tree.GetCompilationUnitRoot(); 146var compilationUnit = tree.GetCompilationUnitRoot(); 167var trivia = tree.GetCompilationUnitRoot().DescendantTrivia().Single(t => t.Kind() == SyntaxKind.SingleLineDocumentationCommentTrivia); 183var trivia = tree.GetCompilationUnitRoot().DescendantTrivia().Single(t => t.Kind() == SyntaxKind.MultiLineDocumentationCommentTrivia); 192var trivia = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia();
Syntax\SyntaxAnnotationTests.cs (33)
53var fromNode = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot(); 62var fromNode = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot(); 63var toNode = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot(); 72var toToken = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot().DescendantTokens().First(); 80var fromToken = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot().DescendantTokens().First(); 89var fromToken = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot().DescendantTokens().First(); 90var toToken = SyntaxFactory.ParseSyntaxTree(_helloWorldCode).GetCompilationUnitRoot().DescendantTokens().First(); 100var toTrivia = GetAllTrivia(tree.GetCompilationUnitRoot()).FirstOrDefault(); 110var fromTrivia = GetAllTrivia(tree.GetCompilationUnitRoot()).FirstOrDefault(); 119var fromTrivia = GetAllTrivia(tree.GetCompilationUnitRoot()).FirstOrDefault(); 120var toTrivia = GetAllTrivia(tree.GetCompilationUnitRoot()).FirstOrDefault(); 135var matchingNodesOrTokens = tree.GetCompilationUnitRoot().GetAnnotatedNodesAndTokens(annotation); 145var matchingTrivia = tree.GetCompilationUnitRoot().GetAnnotatedTrivia(annotation); 161var node = GetAllNodesAndTokens(tree.GetCompilationUnitRoot()).First(t => t.IsNode).AsNode(); 165var newRoot = tree.GetCompilationUnitRoot().ReplaceNode(node, annotatedNode); 193var token = GetAllNodesAndTokens(tree.GetCompilationUnitRoot()).First(t => t.IsToken).AsToken(); 197var newRoot = tree.GetCompilationUnitRoot().ReplaceToken(token, annotatedToken); 225var trivia = GetAllTrivia(tree.GetCompilationUnitRoot()).First(); 229var newRoot = tree.GetCompilationUnitRoot().ReplaceTrivia(trivia, annotatedTrivia); 253SyntaxNode newRoot = tree.GetCompilationUnitRoot(); 265TestMultipleAnnotationsInTree(tree.GetCompilationUnitRoot(), newRoot, annotations); 284var firstNode = GetAllNodesAndTokens(tree.GetCompilationUnitRoot()).First(t => t.IsNode).AsNode(); 289var newRoot = tree.GetCompilationUnitRoot().ReplaceNode(lastChildOfFirstNode, annotatedNode); 389var sourceTreeRoot = rewriter.Visit(tree1.GetCompilationUnitRoot()); 391var destTreeRoot = CopyAnnotationsTo(sourceTreeRoot, tree2.GetCompilationUnitRoot()); 476var currentRoot = syntaxTree.GetCompilationUnitRoot(); 507var candidatePool = GetAllNodesAndTokens(syntaxTree.GetCompilationUnitRoot()); 518var newRoot = Replace(syntaxTree.GetCompilationUnitRoot(), firstItem, firstAnnotated); 566foreach (var trivia in GetAllTrivia(syntaxTree.GetCompilationUnitRoot())) 570var newRoot = syntaxTree.GetCompilationUnitRoot().ReplaceTrivia(trivia, newTrivia); 580var allNodesAndTokens = GetAllNodesAndTokens(syntaxTree.GetCompilationUnitRoot()); 590newRoot = syntaxTree.GetCompilationUnitRoot().ReplaceToken(nodeOrToken.AsToken(), newToken); 595newRoot = syntaxTree.GetCompilationUnitRoot().ReplaceNode(nodeOrToken.AsNode(), newNode);
Syntax\SyntaxDiffingTests.cs (4)
28Assert.Equal(newTree.GetCompilationUnitRoot().FullSpan, spans[0]); 47var decl = (TypeDeclarationSyntax)(newTree.GetCompilationUnitRoot()).Members[0]; 67var decl1 = (TypeDeclarationSyntax)(newTree.GetCompilationUnitRoot()).Members[0]; 69var decl2 = (TypeDeclarationSyntax)(newTree.GetCompilationUnitRoot()).Members[1];
Syntax\SyntaxNodeTests.cs (106)
512var tokens = t1.GetCompilationUnitRoot().DescendantTokens().ToList(); 525var tokens = t1.GetCompilationUnitRoot().DescendantTokens().ToList(); 538var tokens = t1.GetCompilationUnitRoot().DescendantTokens().ToList(); 555var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(0, 16)).ToList(); 567var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(1, 14)).ToList(); 579var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(7, 17)).ToList(); 592var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(8, 15)).ToList(); 641var node = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(6, 3)).First(); 651var token = tree.GetCompilationUnitRoot().FindToken("class\n #i".Length); 654token = tree.GetCompilationUnitRoot().FindToken("class\n #i".Length, findInsideTrivia: true); 765var trivia = tree.GetCompilationUnitRoot().FindTrivia(position); 777Assert.True(tree.GetCompilationUnitRoot().IsEquivalentTo(tree.GetCompilationUnitRoot())); 785Assert.False(tree.GetCompilationUnitRoot().IsEquivalentTo(null)); 794Assert.NotEqual(tree1.GetCompilationUnitRoot(), tree2.GetCompilationUnitRoot()); 795Assert.True(tree1.GetCompilationUnitRoot().IsEquivalentTo(tree2.GetCompilationUnitRoot())); 803Assert.NotEqual(tree1.GetCompilationUnitRoot(), tree2.GetCompilationUnitRoot()); 804Assert.False(tree1.GetCompilationUnitRoot().IsEquivalentTo(tree2.GetCompilationUnitRoot())); 812Assert.NotEqual(tree1.GetCompilationUnitRoot(), tree2.GetCompilationUnitRoot()); 813Assert.False(tree1.GetCompilationUnitRoot().IsEquivalentTo(tree2.GetCompilationUnitRoot())); 821var m1 = ((TypeDeclarationSyntax)tree1.GetCompilationUnitRoot().Members[0]).Members[0]; 822var m2 = ((TypeDeclarationSyntax)tree2.GetCompilationUnitRoot().Members[0]).Members[0]; 834Assert.False(tree1.GetCompilationUnitRoot().IsEquivalentTo(tree2.GetCompilationUnitRoot())); 842Assert.True(tree.GetCompilationUnitRoot().IsIncrementallyIdenticalTo(tree.GetCompilationUnitRoot())); 850Assert.True(tree.GetCompilationUnitRoot().EndOfFileToken.IsIncrementallyIdenticalTo(tree.GetCompilationUnitRoot().EndOfFileToken)); 858Assert.False(tree.GetCompilationUnitRoot().GetFirstToken().IsIncrementallyIdenticalTo(tree.GetCompilationUnitRoot().GetFirstToken().GetNextToken())); 867Assert.True(tree1.GetCompilationUnitRoot().GetFirstToken().IsIncrementallyIdenticalTo(tree2.GetCompilationUnitRoot().GetFirstToken())); 876Assert.False(tree1.GetCompilationUnitRoot().IsIncrementallyIdenticalTo(tree2.GetCompilationUnitRoot())); 886tree1.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single().IsIncrementallyIdenticalTo( 887tree2.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single())); 897tree1.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single().IsIncrementallyIdenticalTo( 898tree2.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single())); 907var trivia = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia()[0]; 910var triviaAgain = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia()[0]; 920var first = tree.GetCompilationUnitRoot().GetFirstToken(); 928var first = tree.GetCompilationUnitRoot().GetFirstToken(includeZeroWidth: true); 936var last = tree.GetCompilationUnitRoot().GetLastToken(); 944var last = tree.GetCompilationUnitRoot().GetLastToken(includeZeroWidth: true); 947last = tree.GetCompilationUnitRoot().Members[0].GetLastToken(includeZeroWidth: true); 957var root1 = tree1.GetCompilationUnitRoot(); 980var tokens = tree.GetCompilationUnitRoot().DescendantTokens().ToList(); 983var token = tree.GetCompilationUnitRoot().GetFirstToken(includeSkipped: true); 1006Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1008var tokens = tree.GetCompilationUnitRoot().DescendantTokens(descendIntoTrivia: true).Where(SyntaxToken.NonZeroWidth).ToList(); 1013var token = tree.GetCompilationUnitRoot().GetFirstToken(includeSkipped: true); 1034var tokens = tree.GetCompilationUnitRoot().DescendantTokens().ToList(); 1038var token = tree.GetCompilationUnitRoot().GetFirstToken(includeSkipped: false); 1079var tokens = tree.GetCompilationUnitRoot().DescendantTokens().ToList(); 1082var token = tree.GetCompilationUnitRoot().GetLastToken(); // skip EOF 1106Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1108var tokens = tree.GetCompilationUnitRoot().DescendantTokens(descendIntoTrivia: true).Where(SyntaxToken.NonZeroWidth).ToList(); 1113var token = tree.GetCompilationUnitRoot().GetLastToken(includeSkipped: true); 1136Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); 1138var tokens = tree.GetCompilationUnitRoot().DescendantTokens().ToList(); 1142var token = tree.GetCompilationUnitRoot().GetLastToken(includeSkipped: false); 1186var tokens = tree.GetCompilationUnitRoot().DescendantTokens().ToList(); 1189var token = tree.GetCompilationUnitRoot().GetFirstToken(includeZeroWidth: true); 1228var tokens = tree.GetCompilationUnitRoot().DescendantTokens().ToList(); 1231var token = tree.GetCompilationUnitRoot().EndOfFileToken.GetPreviousToken(includeZeroWidth: true); 1255SyntaxToken token = ((SyntaxToken)((SyntaxTree)syntaxTree).GetCompilationUnitRoot().EndOfFileToken).GetPreviousToken(includeZeroWidth: true); 1275var children = tree.GetCompilationUnitRoot().Members[0].ChildNodesAndTokens().ToList(); 1293var children = tree.GetCompilationUnitRoot().Members[0].ChildNodesAndTokens().ToList(); 1312var child = tree.GetCompilationUnitRoot().ChildNodesAndTokens()[0]; 1313var member = (TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]; 1329var trivia = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia()[0]; 1340var trivia = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia()[0]; 1376var d = tree.GetCompilationUnitRoot().GetFirstDirective(); 1388var d = tree.GetCompilationUnitRoot().GetLastDirective(); 1405var d1 = tree.GetCompilationUnitRoot().GetFirstDirective(); 1433var d1 = tree.GetCompilationUnitRoot().GetLastDirective(); 1457var c = tree.GetCompilationUnitRoot().Members[0]; 1492var d = tree.GetCompilationUnitRoot().GetFirstDirective(); 1523var d = tree.GetCompilationUnitRoot().GetFirstDirective(); 1562var d = tree.GetCompilationUnitRoot().GetLastDirective(); 1593var d = tree.GetCompilationUnitRoot().GetFirstDirective(); 1627var d = tree.GetCompilationUnitRoot().GetFirstDirective(); 1661var d = tree.GetCompilationUnitRoot().GetLastDirective(); 1691var d = tree.GetCompilationUnitRoot().GetLastDirective(); 1714var d = tree.GetCompilationUnitRoot().GetFirstDirective(); 1735var d = tree.GetCompilationUnitRoot().GetLastDirective(); 1753var rootNode = tree.GetCompilationUnitRoot(); 1771var rootNode = tree.GetCompilationUnitRoot(); 1782var rootNode = SyntaxFactory.ParseSyntaxTree("using X; namespace Y { }").GetCompilationUnitRoot(); 1991Assert.Equal(SyntaxKind.MethodDeclaration, tree.GetCompilationUnitRoot().ChildNodesAndTokens()[0].ChildNodesAndTokens()[3].Kind()); 2000var actualTokens = syntaxTree.GetCompilationUnitRoot().DescendantTokens(); 2040dynamic root = tree.GetCompilationUnitRoot(); 3258var root = tree.GetCompilationUnitRoot(); 3343foreach (var t in syntaxTree.GetCompilationUnitRoot().DescendantTokens()) 3369var token = syntaxTree.GetCompilationUnitRoot().FindToken(code.IndexOf("using Lib;", StringComparison.Ordinal)); 3388var trivia = tree.GetCompilationUnitRoot().FindTrivia(code.IndexOf("#r", StringComparison.Ordinal)); // ReferenceDirective. 3403var compilationUnit = tree.GetCompilationUnitRoot(); 3429var compilationUnit = tree.GetCompilationUnitRoot(); 3470var node = SyntaxFactory.ParseSyntaxTree(" ").GetCompilationUnitRoot(); 3799var trivia = tree.GetCompilationUnitRoot().FindTrivia(position);
Syntax\SyntaxNormalizerTests.cs (3)
3709TestNormalize(tree.GetCompilationUnitRoot(), """ 3737TestNormalize(tree.GetCompilationUnitRoot(), 3766TestNormalize(tree.GetCompilationUnitRoot(),
Syntax\SyntaxRewriterTests.cs (9)
337var tokenT = tree.GetCompilationUnitRoot().DescendantTokens().Where(t => t.ToString() == "T").Single(); 338Assert.Same(tree, tree.GetCompilationUnitRoot().ReplaceToken(tokenT, tokenT).SyntaxTree); 339var newRoot = tree.GetCompilationUnitRoot().ReplaceToken(tokenT, SyntaxFactory.Identifier("U")); 349var typeName = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => n.IsKind(SyntaxKind.GenericName)).Single(); 350Assert.Same(tree, tree.GetCompilationUnitRoot().ReplaceNode(typeName, typeName).SyntaxTree); 351var newRoot = tree.GetCompilationUnitRoot().ReplaceNode(typeName, SyntaxFactory.ParseTypeName("Class2<U>")); 540Assert.NotNull(tree.GetCompilationUnitRoot().SyntaxTree); 542var rewrittenRoot = rewriter.Visit(tree.GetCompilationUnitRoot()); 601var ifStmt1 = tree1.GetCompilationUnitRoot().DescendantNodes().OfType<IfStatementSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
Extensions.cs (1)
54if (TryFindNodeOrToken(syntaxTree.GetCompilationUnitRoot(), kind, ref occurrence, ref foundNode))
SemanticModelTestBase.cs (1)
99var constructorInitializer = GetFirstConstructorInitializer(tree.GetCompilationUnitRoot());
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
CSharpSemanticFacts.cs (1)
134var root = original.SyntaxTree.GetCompilationUnitRoot(cancellationToken);
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\OperationTests.cs (1)
277var methodBodySyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Last();
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
SyntaxPathTests.cs (1)
92var root = tree.GetCompilationUnitRoot();